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: http://goo.gl/vNzNJi
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.
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.
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.
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 http://blog.ankitaggarwal.me/PiScope/, 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 :-)
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.
Hi,
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: https://gist.github.com/Gadgetoid/f26f088463c431b40aa3
I tried to do that:
servo = open(’/dev/pi-blaster’)
servo.write(‘18=0.3\n’)
servo.flush()
But I get a message error that says: File not open for writing
What I am doing wrong?