Projects / Four-servo robotic arm with knobs

Four-servo robotic arm with knobs

Beginner3 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. UNO

    Assemble the arm

    Follow the kit instructions. Set every servo to its centre with a test sketch before fitting the horns, so the range is right.

  2. UNO

    Power the servos separately

    Use the 4 AA pack for the servos and join its ground to the Uno ground.

  3. UNO

    Wire signals and knobs

    Servo signals to D3, D5, D6 and D9, pots to A0 to A3.

  4. UNO

    Test each joint

    Move one knob at a time and set the limit angles so the arm never strains.

  5. UNO

    Record

    Press Record, move the knobs through a pick and place routine, press Record again to stop.

  6. UNO

    Play

    Press Play and the arm repeats the move. Press Record to stop playback.

In short

How do you build a four-servo robotic arm with knobs?

Four potentiometers control the base, shoulder, elbow and gripper of an acrylic SG90 arm, and a button records and replays moves. You need Arduino Uno R3, Robot arm kit 4-DOF (acrylic, SG90), Potentiometer 10 kΩ × 4, Tactile push button 6 mm × 2, Battery holder 4 × AA with switch, AA alkaline battery × 4, Electrolytic capacitor 1000 µF, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 180 minutes.

Level
Beginner
Time
About 180 min
Parts
9

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Servo signal wires (base, shoulder, elbow, gripper)Uno D3, D5, D6, D9PWM-capable pins
Servo power wires (red)AA pack + (about 6 V)Do not power from the Uno
Servo ground wires (brown)AA pack - and Uno GNDCommon ground
1000 µF capacitorAcross the AA pack + and -Absorbs servo current surges
Potentiometer 1 to 4 middle pinsUno A0 to A3One knob per joint
Potentiometer outer pinsUno 5V and GNDReference
Record buttonUno D7 and GNDStart or stop recording
Play buttonUno D8 and GNDReplay

Code

Arduino IDE, board "Arduino Uno". Uses the Servo library that comes with the IDE. The Uno has 2 KB of RAM, so 100 frames of 4 bytes is fine, but do not make the buffer much larger. Set the limit angles for your own arm.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <Servo.h>

Servo s[4];
const byte SERVO_PIN[4] = {3, 5, 6, 9};
const byte POT_PIN[4]   = {A0, A1, A2, A3};
const byte MINA[4] = {10, 20, 20, 30};      // safe limits so the arm does not hit itself
const byte MAXA[4] = {170, 160, 160, 120};
const byte REC = 7, PLAY = 8;
const int MAXF = 100;                       // 100 frames at 100 ms is 10 s
byte frames[MAXF][4];
int count = 0;
bool recording = false;

void setAngles(const byte *a) { for (byte i = 0; i < 4; i++) s[i].write(a[i]); }

void readKnobs(byte *a) {
  for (byte i = 0; i < 4; i++) a[i] = map(analogRead(POT_PIN[i]), 0, 1023, MINA[i], MAXA[i]);
}

void setup() {
  for (byte i = 0; i < 4; i++) s[i].attach(SERVO_PIN[i]);
  pinMode(REC, INPUT_PULLUP); pinMode(PLAY, INPUT_PULLUP);
}

void loop() {
  byte a[4];
  if (digitalRead(REC) == LOW) {
    delay(250);
    recording = !recording;
    if (recording) count = 0;
  }
  if (digitalRead(PLAY) == LOW && count > 0) {
    delay(250);
    for (int f = 0; f < count && digitalRead(REC) == HIGH; f++) { setAngles(frames[f]); delay(100); }
    return;
  }
  readKnobs(a);
  setAngles(a);
  if (recording && count < MAXF) { for (byte i = 0; i < 4; i++) frames[count][i] = a[i]; count++; }
  delay(100);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Turn a knobIts servo follows smoothly without jitter
Record a 5 s movePlayback matches within a few degrees
Press Record during playbackPlayback stops
Power the arm with the Uno onlyShows resets, which proves the AA pack is needed

If it does not work

Servos twitch

The pot has noise. Add a 0.1 µF capacitor from each wiper to GND or average readings.

Uno resets when servos move

The servos are on the Uno 5 V pin. Use the AA pack.

Gripper stalls and buzzes

Its limits are too wide, so it pushes against its stop. Narrow MINA and MAXA.

Recording stops early

The 100-frame buffer is full. Reduce the frame rate or shorten the move.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the four-servo robotic arm with knobs?

Arduino Uno R3, Robot arm kit 4-DOF (acrylic, SG90), Potentiometer 10 kΩ × 4, Tactile push button 6 mm × 2, Battery holder 4 × AA with switch, AA alkaline battery × 4, Electrolytic capacitor 1000 µF, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the four-servo robotic arm with knobs take to build?

About 180 minutes for a beginner maker, in 6 steps.

How do I know the four-servo robotic arm with knobs works?

Turn a knob: Its servo follows smoothly without jitter. Record a 5 s move: Playback matches within a few degrees. Press Record during playback: Playback stops.

Servos twitch: what should I check?

The pot has noise. Add a 0.1 µF capacitor from each wiper to GND or average readings.

Uno resets when servos move: what should I check?

The servos are on the Uno 5 V pin. Use the AA pack.

Gripper stalls and buzzes: what should I check?

Its limits are too wide, so it pushes against its stop. Narrow MINA and MAXA.

Recording stops early: what should I check?

The 100-frame buffer is full. Reduce the frame rate or shorten the move.