Arduino Uno assembled in US now available in the Store @arduino & Adafruit #TeamArduinoCC

Beaglebone PWM servo
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Beaglebone PWM servo

by tcmichals on Tue Jun 19, 2012 12:57 pm

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.
Posts: 1
Joined: Thu May 24, 2012 2:23 pm

Re: Beaglebone PWM servo

by akamediasystem on Wed Jun 26, 2013 11:07 am

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 | TOGGLE FULL SIZE
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?



ps, my full code is here if that helps

Posts: 70
Joined: Tue Apr 30, 2013 1:38 pm
Location: New York

Re: Beaglebone PWM servo

by adafruit_support_mike on Wed Jun 26, 2013 11:45 pm

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

Posts: 16940
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.