Robotic Arm using Potentiometer and Servo Motor

Robotic Arm with 4 Servos & Potentiometers – Arduino Project | MakeMindz
Arduino Project · Advanced

Robotic Arm Control
with 4 Servos & Potentiometers

Build a manually controlled robotic arm with 4 independent joints. Turn a knob, move a joint — exactly like a real robot manipulator.

⏱ ~55 minutes 🎯 Advanced 🔌 Arduino UNO ⚙️ 4 Servos + 4 Pots 🌐 Tinkercad
01 · Overview

What Are We Building?

This project simulates the basic movements of a robot arm and legs using Arduino UNO, 4 servo motors, and 4 potentiometers. Each servo represents a joint (shoulder, elbow, hip, knee) and each potentiometer acts as a manual control knob. Turn the knob — the joint moves. It's a hands-on introduction to robotic control systems.

🔄Reading multiple analog inputs simultaneously
⚙️Controlling 4 servo motors independently
📐Using the map() function to scale values
🦾Principles of robotic joint control
02 · Joint Mapping

4 Potentiometers → 4 Joints

Each potentiometer directly controls one servo joint. Turn the knob, the joint moves proportionally — from 0° to 180°.

Joint 1

🦾 Shoulder

Controls the base rotation of the arm. Determines left-right reach direction.

Pot 1 · A0 Servo 1 · Pin 3
Joint 2

💪 Elbow

Controls upper arm bend. Raises or lowers the forearm segment.

Pot 2 · A1 Servo 2 · Pin 5
Joint 3

🕺 Hip

Controls leg/body rotation. Simulates forward-backward leg movement.

Pot 3 · A2 Servo 3 · Pin 6
Joint 4

🦵 Knee

Controls lower leg bend. Simulates crouching or stepping motions.

Pot 4 · A3 Servo 4 · Pin 9
03 · Components

What You Need

List of components required for the robotic arm project
#ComponentQtyRole
1Arduino UNO×1Reads all 4 potentiometers and commands all 4 servos
2Servo Motor (SG90)×4Shoulder, Elbow, Hip, Knee joints
310 kΩ Potentiometer×4Manual control knobs — one per joint
4Breadboard×1Clean wiring layout for all components
5Jumper Wires×~25All component connections
6Power Supply×1Arduino 5V or external 5V/2A for 4 servos
Power tip: Running 4 servos from Arduino's 5V pin may cause resets. For hardware builds, power the servos from an external 5V/2A supply and share GND with Arduino. In Tinkercad simulation, the Arduino's supply is sufficient.
04 · Interactive Arm

Control the Arm with Sliders

Drag each slider to simulate turning a potentiometer. Watch the robotic arm joints move in real time.

Interactive Robotic Arm — 4-Joint Controller

90°
Pot 1 · A0180°
90°
Pot 2 · A1180°
90°
Pot 3 · A2180°
90°
Pot 4 · A3180°
analogRead() values
Robotic arm circuit diagram with 4 servo motors and 4 potentiometers on breadboard Wiring schematic for Arduino robotic arm servo and potentiometer connections
05 · Circuit Connections

Wiring All 4 Pairs

Wiring schematic for Arduino robotic arm servo and potentiometer connections
Wiring schematic overview
Close-up of servo motor PWM pin connections on Arduino UNO
Servo PWM pin connections on Arduino UNO

📻 Potentiometers (all 4 share 5V and GND)

Left Pin (all 4)5V on Arduino
Right Pin (all 4)GND on Arduino
Wiper – Pot 1Analog Pin A0
Wiper – Pot 2Analog Pin A1
Wiper – Pot 3Analog Pin A2
Wiper – Pot 4Analog Pin A3

⚙️ Servo Motors

All Red Wires (5V)5V on Arduino (or external supply)
All Brown Wires (GND)GND on Arduino
Servo 1 SignalDigital PWM Pin 3
Servo 2 SignalDigital PWM Pin 5
Servo 3 SignalDigital PWM Pin 6
Servo 4 SignalDigital PWM Pin 9
💡 Why PWM pins? Servo motors need PWM (Pulse Width Modulation) signals to set their angle. On Arduino UNO, pins 3, 5, 6, 9, 10, 11 support PWM — marked with ~ on the board.
06 · How It Works

The Control Loop

The Arduino continuously reads all 4 potentiometers and updates all 4 servos — this loop runs approximately every 15 ms.

  1. Turn Potentiometer Knob

    The wiper pin outputs a voltage between 0 V (fully left) and 5 V (fully right).

  2. Arduino Reads All 4 Analog Pins

    analogRead(A0) through analogRead(A3) each return a value from 0 to 1023.

  3. map() Converts the Range

    0–1023 is linearly scaled to 0°–180° using map(val, 0, 1023, 0, 180).

  4. All 4 Servos Move Simultaneously

    servo.write(angle) is called for each joint, moving it to the correct position.

  5. Loop Repeats Every 15 ms

    The delay(15) gives each servo time to physically reach its position before the next update.

🔄 The map() Function for All 4 Joints

map(potValue, 0, 1023, 0, 180)

// Same formula used for ALL 4 joints:
angle1 = map(analogRead(A0), 0, 1023, 0, 180); // Shoulder
angle2 = map(analogRead(A1), 0, 1023, 0, 180); // Elbow
angle3 = map(analogRead(A2), 0, 1023, 0, 180); // Hip
angle4 = map(analogRead(A3), 0, 1023, 0, 180); // Knee
07 · Arduino Code

The Program

The code follows the same pattern for all 4 joints — read, map, write. Clean, readable, and easily expandable.

robotic_arm.ino
#include <Servo.h>

// ── Servo Objects ─────────────────────────────
Servo servo1;   // Shoulder
Servo servo2;   // Elbow
Servo servo3;   // Hip
Servo servo4;   // Knee

// ── Potentiometer Pins ────────────────────────
int pot1 = A0;
int pot2 = A1;
int pot3 = A2;
int pot4 = A3;

// ── Angle Variables ───────────────────────────
int val1, val2, val3, val4;
int angle1, angle2, angle3, angle4;

void setup() {
  servo1.attach(3);   // Shoulder → Pin 3 (PWM)
  servo2.attach(5);   // Elbow    → Pin 5 (PWM)
  servo3.attach(6);   // Hip      → Pin 6 (PWM)
  servo4.attach(9);   // Knee     → Pin 9 (PWM)
}

void loop() {

  // ── Read Potentiometers ───────────────────────
  val1 = analogRead(pot1);   // 0–1023 from Shoulder pot
  val2 = analogRead(pot2);   // 0–1023 from Elbow pot
  val3 = analogRead(pot3);   // 0–1023 from Hip pot
  val4 = analogRead(pot4);   // 0–1023 from Knee pot

  // ── Map to Servo Angles (0°–180°) ─────────────
  angle1 = map(val1, 0, 1023, 0, 180);
  angle2 = map(val2, 0, 1023, 0, 180);
  angle3 = map(val3, 0, 1023, 0, 180);
  angle4 = map(val4, 0, 1023, 0, 180);

  // ── Move Servo Joints ─────────────────────────
  servo1.write(angle1);   // Shoulder
  servo2.write(angle2);   // Elbow
  servo3.write(angle3);   // Hip
  servo4.write(angle4);   // Knee

  delay(15);   // Allow time for servos to reach position

}

💡 Key patterns in this code

  • Consistent structure — read, map, write is repeated identically for all 4 joints
  • Servo objects — each servo needs its own Servo object (servo1, servo2…)
  • PWM pins only.attach() must use pins 3, 5, 6, 9, 10, or 11 on UNO
  • delay(15) — 15 ms minimum for a servo to settle at its commanded angle
08 · Try It Online

Run the Full Simulation

All 4 servo-potentiometer pairs are pre-wired in Tinkercad. Start simulation and drag each potentiometer knob to control the robotic joints.

Open Robotic Arm Simulation

Pre-built circuit with 4 servos and 4 potentiometers. Click each pot dial and rotate it to control the corresponding joint.

▶ Launch Simulator ↗

🧪 Challenges to try

  1. Start simulation — rotate each potentiometer and watch its servo respond.
  2. Try moving all 4 knobs simultaneously to see complex arm poses.
  3. Change map(..., 0, 180) to map(..., 30, 150) to limit the shoulder's travel range.
  4. Challenge: Add a 5th potentiometer and servo for a gripper/claw.
  5. Advanced: Store a sequence of positions and replay them automatically (teach & playback).
09 · Check Your Understanding

Quick Quiz

Click an option to check your answer instantly.

Q1. How many Servo objects are needed to control 4 servo motors?

1 — one object can control all
2
4 — one object per servo

Q2. Potentiometer 3 controls which joint?

Shoulder
Elbow
Hip
Knee

Q3. Why must servos be attached to PWM pins (3, 5, 6, 9)?

They provide higher voltage to servos
Servo motors need PWM pulse signals to set their angle
Only PWM pins can read potentiometer values

Q4. If analogRead(A2) returns 768, what angle will Servo 3 (Hip) be at?

~45°
~90°
~135°
~180°
10 · Applications

Where Is This Used?

Industrial ArmsFactory pick-and-place robot arms
Camera RigsMulti-axis motorized camera gimbals
ProstheticsMotorized prosthetic hand control
RC VehiclesSteering, throttle, and arm control
3D PrintingMulti-axis print head positioning
EducationHands-on robotics for schools

🚀 Ready to level up?

  • Add a 5th servo for a gripper to pick up objects
  • Replace potentiometers with a joystick module (2-axis control with one hand)
  • Add EEPROM memory to save arm positions and replay them
  • Use inverse kinematics to control end-effector position instead of joint angles
  • Add a Bluetooth module to control the arm from a smartphone app

Comments

try for free