Robotic Arm Control from the BeagleBone Black. via linux
In this tutorial, we’ll learn how to control a robotic arm from the BeagleBone Black. Then we’ll give your project the ability to manipulate real world objects and perform repetitive tasks for you.
A robotic arm uses many servo motors to turn arm sections, wrists and move a gripper (fingers). The more servos used, the more moving joints the arm will have leading to greater flexibility. More servos also brings greater cost and control complexity.
The base model of the Lynxmotion AL5D robot arm uses five servos; one for rotation, a shoulder joint, an elbow, a wrist and a gripper for holding things (sort of like the thumb coming together with all fingers).
The little computer board shown next to the robot arm in the picture above is the Serial Servo Controller (SSC-32). The SSC-32 accepts commands on a serial port and lets you control up to 32 servos.
We have already seen that the BeagleBone Black is capable of directly controlling servos so you might wonder why the SSC-32 might be useful. The main advantages of the SSC-32 are that it can handle speed-based servo movement and batch multiple servo movements together into a single logical action. For example, you can issue a single command to move the shoulder, elbow, wrist and fingers to a specific location in 2 seconds and each servo will move at a speed that will cause it to arrive at your destination at the same time as the other servos. With the SSC-32 you do not have to consume 5-6 of the pulse-width modulation (PWM) outputs on the BeagleBone Black to run the robot arm and the SSC-32 takes care of providing the servo motors the 6 Volts they need.
Assembling the robot arm
The robot arm comes in kit format and assembly instructions are available online. There is also a video showing the key points of the assembly process. I found slight differences between the above guides and followed the online instructions when in doubt. Basic assembly performed at a comfortable pace took me around six hours. You should definitely bolt the robot arm base to something, even if it is only a half meter square of MDF board. Otherwise you are likely to discover as I did that servo motors used by the robot arm can easily topple it over if the arm is not secured.
In the bottom left of the image is a RS-232 cable which can be connected to the DB-9 port of the SSC-32 for control. The SSC-32 is shown in an anti static bag in the middle of the lower part of the image. Right next to the RS-232 port on the SSC-32 are some TTL connectors which are of much greater interest for controlling the SSC-32 from the BeagleBone Black. TTL serial communication operates in a smaller voltage range and is simpler to work with from micro controllers than RS-232.
The two main U shape pieces between the shoulder and the elbow use friction plates to take some of the load off of the servos. There is also a spring that is fit between the servos to assist in bringing the arm back from extended maneuvers. The wrist can move up and down about 90 degrees. A wrist upgrade option is available to allow the wrist to rotate around its axis as well.
Attaching the Arm to the BeagleBone Black
The BeagleBone Black digital pins operate at 3.3 volts. A rather ominous warning message indicates not to use anything over 3.3 V on any pin of the BealgeBone Black. The SSC-32 operates at 5 V. Sending data from the BeagleBone Black to the SSC-32 will be fine as a 3.3 V “high” will still be detected as a “high” signal level on the SSC-32.Serial communication from the SSC-32 to the BeagleBone Black requires additional attention and some extra hardware to do voltage level shifting down to 3.3 V or lower to send to the BeagleBone Black. The 74HC4050 IC has support for level shifting six lines and input pins are over-voltage tolerant. So running the 74HC4050 at 3.3 V, one of the input pins can shift the 5 V serial signal from the SSC-32 to a 3.3 V signal that is within voltage range for the BeagleBone Black.
The BeagleBone Black has 4.5 universal asynchronous receiver/transmitters (UARTs). UART4 is toward the power and ground end of P9 making it convenient to connect wiring because you don’t have to count too far along any header. All of the pins of interest on the BeagleBone Black are on the outside of P9 starting with pin 1. The pins are ground (1), 3.3 V (3), skip over the next 3 pins, and then RX (11), and TX (13).
The 3 TTL serial pins of interest on the SSC-32 are right next to the DB9 connector and are ground, rx, and tx. These pins are clearly labeled with ground the nearer pin to the edge of the board.
The photograph of the 4050, above, shows a 3.3 V power line (red) going to pin 1 of the 4050. Pin 8 of the 4050 is ground and the green wires go to ground on the SSC-32 and ground (pin 1) on the BeagleBone Black.
The transmit line (pin 13) from the BeagleBone Black uses yellow cabling and can be connected directly to the receive RX pin on the SSC-32. These wires just meet on the breadboard for convenience, they do not connect to the 4050 at all. Level shifting has to be performed on signals bound for the receive RX (11) pin of the BeagleBone Black. I used orange wires for the signal going from the TX pin of the SSC-32 to the 4050 level shifter (pin 3 of the 4050). The level shifted signal is taken from the 4050 (pin 2, near power) and sent to the RX (11) pin on the BeagleBone Black.
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!