rjhazeld
Posts: 38
Joined: Mon Feb 16, 2015 9:19 am

Servos on I2C at start up

Tue Feb 24, 2015 10:43 am

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!!

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Servos on I2C at start up

Tue Feb 24, 2015 10:52 am

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... :(

rjhazeld
Posts: 38
Joined: Mon Feb 16, 2015 9:19 am

Re: Servos on I2C at start up

Tue Feb 24, 2015 11:12 am

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.

pjr_pdco
Posts: 17
Joined: Thu Jan 08, 2015 6:08 pm

Re: Servos on I2C at start up

Wed Feb 25, 2015 1:18 am

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.

Pat

Return to “Automation, sensing and robotics”