Short answer: I was able to get a micro servo moving using the wiring setup you suggested, but I'm having trouble actually controlling its movement.
I did a really simple PWM duty cycle sweep using the Adafruit version of the PyBBIO library - at various points along the sweep, the servo moves normally. However, at other points it stalls and gets hot, and at other points it just emits an audible hi-freq whine.
I'm aware that this probably isn't the best thing to do to the servo, but I was out of ideas ;-)
I'm still a little stuck, though, trying to get the servo to actually respond to commands.
From what I understand, I want to be generating a 1 to 2ms pulse and then a low period of about 18ms. So in other words, a duty cycle that ranges from 5 to 10% on a 50Hz signal (20ms period -> 50Hz, 1ms = 5% of a 20ms period)
Here's the code I have - the mapVals
function is a clone of the Processing map
- Code: Select all | TOGGLE FULL SIZE
# position should be 0-180, with 90 at center
# 1ms pulse is 5% of 50Hz duty cycle, this should be angle 0
# 2ms pulse is 10% of 50Hz duty cycle, this should be angle 180
rot = mapVals(position,0,180,5.0, 10.0)
print 'servo position should be', rot
pwm.start(pinName, rot, 50.0)
However, this code just results in a hi-freq whining noise and eventually the servo gets a little hot. I've also tried inverting the duty cycle (ie, having it range from 90-95% rather than from 5-10%) but I get similar results.
Anyone have any ideas?
ps, my full code is here https://github.com/AKAMEDIASYSTEM/speedtest
if that helps