Page 1 of 1

Servos on I2C at start up

Posted: Tue Feb 24, 2015 10:43 am
by rjhazeld
I am new to Rpi etc. I am converting an old large Rc car to a cambot. I have finally got the servos of a pan and tilt system working and was near to getting the steering set correctly. However, when I rebooted the Rpi the servos move to the motors default start rather than staying where they were last until commanded otherwise. This has resulted in one broken servo horn:(. How can I stop the motors moving on boot up ? or moving to a set default position i.e. centre of servoMin and servoMax.

Suggestions gratefully received!!

Re: Servos on I2C at start up

Posted: Tue Feb 24, 2015 10:52 am
by Ravenous
Well my suggestion would be two power switches. One to a 5V regulator which drives the controller (raspi in your case), and another switch that provides power to the servos, motor drivers etc. Make sure the controller has booted and set its outputs appropriately, before enabling power to the motors.

(Also handy to prevent the thing running away while twiddling with the software.)

It'd be a pain to fit an extra power switch into a compact model though... :(

Re: Servos on I2C at start up

Posted: Tue Feb 24, 2015 11:12 am
by rjhazeld
Thanks for the suggestion. As the wiring is a little cobbled together at the moment I was able to try rebooting without the servo board powered up sadly as soon as I added power to the servo board the servos moved so this doesn't seem to be a solution.

Re: Servos on I2C at start up

Posted: Wed Feb 25, 2015 1:18 am
by pjr_pdco
My guess would be when the Pi starts running & generating the servo signals it defaults to the pulse width which positions a servo to its middle of travel. Perhaps what is needed is to retain the last servo position value in some form of non-volatile memory and have the servo power controlled by the Pi as well. The after the Pi boots up, read the last servo position values & apply them as needed. Then turn on the power to the servos. So when the servos power up the will be receiving a pulse width to keep them where they were. There may still be some servo output jitter when they power up.