Mitchell
Mitchell

Reputation: 11

Trying to use PWM to control a servo on my BBB, servo not moving

When I try to use my servo with my BBB, using the following commands to try to move it, the servo doesn't move.

  modprobe pwm_test 
  echo am33xx_pwm > /sys/devices/bone_capemgr.9/slots 
  echo bone_pwm_P9_14 > /sys/devices/bone_capemgr.9/slots 
  echo 500 > /sys/devices/ocp.2/pwm_test_P9_13.14/period 
  echo 250 > /sys/devices/ocp.2/pwm_test_P9_13.14/duty
  echo 1 > /sys/devices/ocp.2/pwm_test_P9_13.14

I'm using the parallax continuous rotation servo (http://www.parallax.com/product/900-00008). I have the servo's out connected to the BBB's ground (pin 1 on the left header, if the ethernet port is on top), in connected to +3v (pin 3), and pwm connected to pin 14.

Upvotes: 1

Views: 742

Answers (2)

loonix
loonix

Reputation: 171

I have this step working fine. I can control 2 servos from command line.

what I did for one servo:

echo am33xx_pwm > /sys/devices/bone_capemgr.9/slots 
echo bone_pwm_P9_14 > /sys/devices/bone_capemgr.9/slots 
echo 0 > /sys/devices/ocp.3/pwm_test_P9_14.15/run
echo 0 > /sys/devices/ocp.3/pwm_test_P9_14.15/polarity
echo 20000000 > /sys/devices/ocp.3/pwm_test_P9_14.15/period
echo 1500000 > /sys/devices/ocp.3/pwm_test_P9_14.15/duty
echo 1 > /sys/devices/ocp.3/pwm_test_P9_14.15/run

The servo moves with duty values from 1000000 to 2000000 with 1500000 being the center position.

I could enable a second servo with: echo bone_pwm_P8_19 > /sys/devices/bone_capemgr.9/slots

btw. it seems that the provided device tree overlays do not allow to use multiple pwm outputs from one pwm chip (for example P9_14 and P9_16).

Upvotes: 0

Puck
Puck

Reputation: 2120

According to the datasheet of this servo, the minimum voltage for the power supply is 4V, so I would advise to try to connect the red wire (pin2) to the 5V supply source which is on pins 5 and 6 on the the header P9 on the BBB.

@elimirks: BBB stands for BeagleBone Black

Upvotes: 1

Related Questions