Trying to connect a servo to explorer hat


can you help?

LOL - since I am a new user, I am only allowed to use two links in my post - but the toll autoconverts my one linkt into four… here is the link from above as direct link:


Automation pHAT Servo Question

I think the problem with using a 10K pullup resistor with one of the Explorer HAT ouputs is that it inverts your signal.

High, becomes Low ( Shorted to ground because the Darlington Array is turned on ) and Low becomes High ( Pulled up by the resistor ).

This can really ruin your day if you’re trying to drive servos because they rely on a signal with something like a 20ms period and a HIGH pulse of between 1ms and 2ms.

When you invert this, you get a 20ms period still, but you now get a high pulse between 18ms and 19ms. The servo wont know what on earth is going on!

Fortunately I think servod has a fix for this, although I’ve not tried it myself. Try adding the --invert option to your command line.


that’s what I thought, too. But the --invert option didn’t solve my problem. Maybe something else was wrong. I will give it another try…


just gave it another try - nope didn’t work. But I’ve now updated my stackexchange question with my setup.


Darn. I don’t see any reason why that shouldn’t work. I’m going to have to set up a servo on Explorer HAT tomorrow and see if I can replicate it.

Your earlier tests seem to have eliminated software from the equation, so it must be something we’re missing with the hardware. I’d swear that darlington will switch fast enough to drive a servo.


that’s what I think, too. But my eletronics whisdom is now some years old.
Aren’t the LEDs connected through the same darlingtion chip?


hm. I will also try to add an external powersource tomorrow… seems that the pi sometimes reboots because the servo is drawing too much power. btw: dies does not happen if I connect the control wire to the LED…


Hmm, try putting a current limiting resistor in series with the control wire, something like 1k, the LEDs will, of course, have a current-limiting resistor in series because they’d tend to go fuzz and stop working otherwise.

Do you have anything bigger than 10K to pull up with? 1Meg perhaps? I don’t think there’s any specific reason why you’d need 10K unless the servo has a significant amount of capacitance on its control line.


Hm. I have the feeling that this works better now, but it still reboots - I’ll check the additional powersource tomorrow… thanx!


just found the time to connect an external power source.
the results are not good:

  • raspberry does not reboot anymore :-)
  • I can’t see that I can position the servo :-(
  • the servo “stutters”

I am really surprised since the servo works fine when I connect it to the led - there is even no problem with the power source when I do so…

I shouldn’t have sold my old oszilloscope :-(


Have you got anything smaller to pull up with? I was thinking about the problem the wrong way up- a bigger pull-up will cause a bigger rise time and I’m guessing the servo needs a really sharp square signal to function properly. Or at least something approaching that.

Try 2.2k- which is used commonly as an i2c pull-up so it’s a sensible value to start with.

You have to achieve the right balance of rise time vs just burning away current in an almost open circuit: through the pull-up and to ground when the Darlington is activated.

I’m sure this is possible! I’d have thought the response times of the transistors in the Darlington would be in nanoseconds or less and shouldn’t bother the servo.


ok, now I’ve tried to use 22k, 2k2 and k22 - results are different, but none of them really works.
I now would like to leave try and error mode and am looking to a cheap oszilloscope.

Doesn’t the explorer hat come with analog inputs? Couldn’t these be fast enough?

Together with this, it may be possible to measure the output signal interfacing the servo… the ADC-Chip is a little bit different from the one used in the blog entry, but this shouldn’t be a problem…


I’ve never tried, but that’s an interesting idea. At a guess I don’t think you’d get the sample resolution you’d need to properly see the fall times, although you might get a rough idea of whether the period is correct, or if the --invert flag is working at all.

Do you have a datasheet for your servo with any information on its requirements?

I’ll peek at the ServoBlaster source, to see what --invert actually does.


the --invert flag seems to work: when I use it on the port which drives the LED, the LED shines much brighter and the servor will not work anymore on this port :-)

The servos are hitec HS-300 - they look a bit different than the one on the picture, but I guess the specs are the same:


now I’ve got the piscope up and running, but I get more or less funny readings… I get the feeling that I have to slightly change the source of the piscope to interface the anlog inputs the right way…
If I use the explorer hat code, the readings are ok.

Could it be that I run into the same problem with servoblaster? But I configured it to use GPIO-6 which should be digital out 1 on explorer hat, isn’t it?


I|ve now managed to get good readings form the oscilloscope :-)
The sampling rate is quite low - it seems that most of the time, I get the high pulse as one spike. Sometimes not.
0-Level seems to be at aprox 0.6V and with a k470 pull-up I managed to get a high level of aprox 4V5.

I guess this is the point where I give up… :-(


Have you tried it on the PWM pin, in the 3v3 breakout header? That’s BCM 18 if servo blaster supports it.


No, but PWM would only be one servo, wouldn’t it? I hoped to be able to control 3 or 4 servos plus two motors…


btw: I tried servoblaster without explorer hat and it works like a charm - I guess that’s what you wanted to test with the PWM pin?


I just bought an explorer pHAT and I was hopping to be able to control several servos motors. My goal is to control the servos from a python scrip Unfortunately, it seems it is quite complicated. Here is a link I found:

I tried to do that:
servo = open(’/dev/pi-blaster’)

But I get a message error that says: File not open for writing
What I am doing wrong?

Many thanks for your help