How to control a servo motor from a BeagleBone Black on Linux. via Ben Martin at Linux.com
Servo motors can rotate to a specified angle and hold that angle against a resistive force. This makes Servos great for creating a DIY pan-and-tilt camera system, for moving panels through a limited distance in a model aircraft where the wind might provide resistance to that movement, and in many cases in robotics where you might need to rotate something to a specific angle. In this tutorial, we’ll cover how to connect and control a servo motor with a BeagleBone black running Linux.
Higher torque servos can run at a higher voltage than a BeagleBone Black will supply, so you might need to bring an external power source into the mix. To make things interesting, the servo for this article needs at least 6 Volts and is mounted into a gearbox to trade some RPM for even more torque.
Using an external power source means you only need two pins from the BeagleBone Black, a PWM pin (the white wire in the figure, above) to control the Servo and a ground pin to ensure that both power sources have a common ground (green wire) to operate from.
The BeagleBone Black is a small 1 Gigahertz (Ghz) ARM machine with 512 Megabytes (MB) of RAM, 2 Gigabytes (GB) of on-board flash memory, and most importantly, two headers each with two rows of pin sockets ready for your next embedded project. In this series on the BeagleBone Black we have seen how to use the Linux interface allowing us to access chips over SPI and receive interrupts when the voltage on a pin changes.
Each Tuesday is BeagleBone Black Day here Adafruit! What is the BeagleBone? The BeagleBones are a line of affordable single-board Linux computers (SBCs) created by Texas Instruments. New to the Bone? Grab one of our Adafruit BeagleBone Black Starter Packs and check out our extensive resources available on the Adafruit Learning System including a guide to setting up the Adafruit BeagleBone IO Python Library. We have a number of Bone accessories including add-on shields (called “capes”) and USB devices to help you do even more with your SBC. Need a nice display to go along with your Bone? Check out our fine selection of HDMI displays, we’ve tested all of them with the Beagle Bone Black!