Explorerhat + Servo motor, quick help


#1

Hey there, using an explorer phat (the pizero one) and would like to know how to connect servos to it, I was planning on using a handful of the micro servos and wondered how I would connect them. I know I connect one wire to ground and one to power (+5v in this case) But which outputs on the explorerhat would be ok to use to drive the data line?


#2

You can’t directly use the outputs on Explorer HAT with a servo, since they’re active-low, sinking outputs. IE: When you turn an output On it connects (sinks) to Ground, and when you turn it Off it’s left floating.

In order to make this work with a servo, you would need a pull-up resistor between the output and +5v. This changes the behaviour so that when it’s Off, instead of floating it will pull to +5v and give you a HIGH signal. Then when turned On it will pull back to Ground (the low impedance on state will easily defeat the pull-up).

This arrangement will also invert your signal, so when generating your ~1-2ms HIGH pulses every 20ms to update a typical server, you will actually need to send ~1-2ms LOW pulses.

You’ll need something like Servo Blaster to get a reliable enough signal for your servos not to be a jittery mess, though, see: https://github.com/richardghirst/PiBits/tree/master/ServoBlaster