How to drive a parallax continuous rotation servo with a raspberry pi
luisnaranjo733
Posts: 1
I'd like to drive this servo with a raspberry pi.
The servos require 4 to 6 VDC at 15 -200 mA.
If I understood what I've read correctly, raspberry pi can safely source at max 16mA at 3.3V.
I plan on powering both the raspberry pi and the servos in parallel with a 5V battery.
I understand that two of the three wires for the servo (red and black) go to a constant power source (+ and -, respectively). So I should be ok wiring these two to my 5V battery.
The third white wire is the one intended for I/O, and according to the specs, that one takes 3.3V min, and about 6.2V max, with 5V being typical voltage.
I think that PWM (the control system for the servo) varies the voltage.
I'm pretty sure I can't safely power the servos from the pi, or control the signal wire with PWM directly from the pi.
How would I do this? I've thought about using a transistor that draws current directly from the 5V battery, but I have no idea how to pick the right one or how to use it.
Thanks!
The servos require 4 to 6 VDC at 15 -200 mA.
If I understood what I've read correctly, raspberry pi can safely source at max 16mA at 3.3V.
I plan on powering both the raspberry pi and the servos in parallel with a 5V battery.
I understand that two of the three wires for the servo (red and black) go to a constant power source (+ and -, respectively). So I should be ok wiring these two to my 5V battery.
The third white wire is the one intended for I/O, and according to the specs, that one takes 3.3V min, and about 6.2V max, with 5V being typical voltage.
I think that PWM (the control system for the servo) varies the voltage.
I'm pretty sure I can't safely power the servos from the pi, or control the signal wire with PWM directly from the pi.
How would I do this? I've thought about using a transistor that draws current directly from the 5V battery, but I have no idea how to pick the right one or how to use it.
Thanks!
Comments
http://www.societyofrobots.com/actuators_servos.shtml
First of all. Don't think about driving the servo PWM signal by bit-banging on a GPIO pin on the Pi. At least not if you are using Linux on it as you probably are. It's too slow. And anyway Linux is a multiuser multi tasking OS with no real-time guarantees so your PWM can be interrupted and stalled all the time. I would not even want to do it if you set up real-time scheduling in Linux.
A quick solution is use something like this serve driver for the Pi: http://adafruit.com/products/815
If you only have one servo then a Pi has a PWM output you can use as shown here http://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor/overview
Of course the correct answer:) is to use a Propeller chip to drive your servos PWM signals. Then command those server positions via a serial or other link from Prop to Pi.
You can drive 28 servos from the Propeller using ready made software found in the Propeller Object Exchange (OBEX)
To do it he had to write a Linux kernel module.
I wonder how much of the Pi's performance gets used up running that. Might have to give it a go myself...