July 26, 2014 Raspberry PI Servo/Stepper/Motor Control
Building on what we have learned from the past few weeks, We are going to look at controling 3 types of motors from a rPI, using PAs you can see the rPI only has one PWM pin, you can of course bit-bang pins to get a pseudo-PWM (The timing could be off for this type of PWM thou).
From Lesson 8, 9, and 10 we also learn that the stock Raspbian Distro doesn’t have the correct libraries, or method for controlling the PWM pin (I am going to verify this of course), but Adafruit recommends to use it’s own distro called Occidentalis which can be found here:
We will also run this without a keyboard/mouse or monitor, so everything we did last week and this builds on top of that.
Lesson 8 Using a Servo - Servo motors are controlled by Pulses of varying lenghts or I should say Analog servos are. Digital Servos a a little bit different, but work along the same lines. I have an Analog servo, that I pulled out of an old RC plane.
What we need: The rPI, a PI Cobbler (Break Out Board for the Pins, not really needed, but does make it a bit easier to hookup quickly), some wire, bread board, and Servo. Adafruit also has a battery pack, and Occidentalis listed.
I’m not going to duplicate this here, but Adafruit does have some good information about what a servo expects to see - I have found that my servos are a bit more picky, and each servo is a little different (a clear advantage that digital servos have, they are all the same if they come from the same manufacturer).
Parallax has excellent documention on Servos that can be found here:
Servos need about 5v to 6v DC to power the motor, the rPI is not getting power from the battery pack (But the battery ground is connected to the rPI ground). The servo Pulse line will work at 3.3v.
The circuit is basic: power, ground, servo to GPIO 18.
UPDATE: Apr 7, 2015 - This demo was done about a year ago, it was with A Raspberry PI B - since doing this, there have been additions to Raspberry PI - such as the B+, and B 2 (It's being offered for Historical reasons)