The desktop robot arm from the kits is a laser-cut acrylic arm in the MeArm shape, with an SG90 servo in the base, one on each side for the shoulder and the elbow, and one working the claw. It is the classic second robot, after the car.
Pins
| Pin | What it does |
|---|---|
VCC, GND |
The four servos' red and brown wires, joined. 5 V from its own supply. |
BASE |
The base servo's signal: turns the whole arm. |
SHOULDER |
The shoulder servo's signal: tilts the upper arm. |
ELBOW |
The elbow servo's signal: tilts the forearm. |
GRIP |
The claw servo's signal: opens and shuts the jaws. |
On the bench these are four separate servo leads, and every build joins their power wires on the breadboard rails. Here that joining is already done.
Driving it
Each joint is an SG90 on the Arduino Servo library's window: a pulse of 544 to
2400 microseconds, fifty times a second, puts its servo between 0 and 180
degrees, so write(90) (1472 microseconds) is 90. min_pulse and max_pulse
change the window for all four joints, to match attach(pin, min, max), and
speed, 600 degrees a second by default, is how fast each joint turns. From
an Uno, the Servo library does it:
#include <Servo.h>
Servo base, shoulder, elbow, claw;
void setup() {
base.attach(3);
shoulder.attach(5);
elbow.attach(6);
claw.attach(9);
}
void loop() {
base.write(45); // turn the base one way
delay(1000);
base.write(135); // and back
delay(1000);
}
Or drive all four from a PCA9685 servo board, which makes the pulses itself and leaves the Uno's pins free.
| Servo | 90 degrees | toward 180 |
|---|---|---|
| Base | facing ahead | turned one way |
| Shoulder | upper arm upright | leaning forward |
| Elbow | forearm level | pointing up |
| Claw | half open | wide open (0 is shut) |
The side view draws the arm from those rules, and the dial in the corner shows the base's turn from above.
Power
Four SG90s moving at once can pull more than an amp. An Uno's 5 V pin on USB cannot give that, the board browns out and resets, and the arm twitches. Give the arm its own 5 V supply and join its ground to the board's.
What the model gets right
- Each joint is the same servo model as the hobby servo: the pulse width window, 600 degrees a second, and no motion under 4 V.
- A joint with no more pulses holds where it was.
What it does not model
- The current, so the brown-out above cannot happen here.
- The linkage's own limits: a real arm jams its forearm into its upper arm at some angles. Keep the shoulder and elbow away from the ends, as the kit sketches do.
- Anything the claw picks up.
See it in a project
- Robot arm with joysticks
- Pick and place arm on a PCA9685
- Robot arm inverse kinematics: two knobs set where the claw should be, and the sketch solves for the joint angles
- Robot arm record and playback: poses saved to EEPROM and played back
- Wireless robot arm with nRF24L01: the sticks on one Uno, the arm on another, and a failsafe when the link drops