Beaglebone PWM servo

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
tcmichals
 
Posts: 2
Joined: Thu May 24, 2012 2:23 pm

Beaglebone PWM servo

Post by tcmichals »

Can the beaglebone drive a typical servo PWM line? For example, servo is connected to a 5v power supply, and connected to the beaglebone ground, and PWM is connected to beaglebone.

User avatar
akamediasystem
 
Posts: 79
Joined: Tue Apr 30, 2013 1:38 pm

Re: Beaglebone PWM servo

Post by akamediasystem »

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 funciton:

Code: Select all

def servo(pinName,position):
    # 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?

Thanks!

AKA

ps, my full code is here https://github.com/AKAMEDIASYSTEM/speedtest if that helps

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Beaglebone PWM servo

Post by adafruit_support_mike »

I don't have a datasheet for the servos we sell on hand, and can't find any clear information elsewhere, but I don't think a 3.3v signal is strong enough to control a 5v servo directly. You'd probably be better off using the BBB's output to drive a transistor, and use the transistor to drive the servo.

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”