Peripherals – Servos

So two of the PiWars 2018 events suggest using servos to operate something: duck-shoot and golf.

Servos have been around for a long time and have a very simple interface.  About every 20ms, you need to send them a pulse.  That pulse needs to be between 1ms and 2ms long.  A pulse length of 1.5ms will cause the servo to move to the centre position, 1ms and 2ms correspond to the two ends of travel.  Note that some servos can move beyond these limits, and some can be damaged if you drive them beyond these limits!  If you fail to send a pulse every 20ms, the servo will power down (stop actively driving the motor to a particular position).

See https://www.raspberrypi.org/forums/viewtopic.php?t=46771 for more details and Pi driven solutions.

In Tigerbot, our servos are driven by the Propeller Hat.  This is a microcontroller with 8 cores.  It takes some of the load off the Pi and because it isn’t running an operating system, it is possible to *guarantee* pulse timings.  Our controlling Pi then sends desired servo positions over to the Propeller using I2C, then the Propeller sends servo pulses.  Here’s a demo:

Leave a Reply

Your email address will not be published. Required fields are marked *