Robot arm (4 servos)

A four-servo desktop robot arm: base, shoulder, elbow and claw, each an SG90 on its own signal pin.

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: a pulse of 1 ms to 2 ms, fifty times a second, puts its servo between 0 and 180 degrees. 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);
}

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