RoboticsEngineer

6-Axis Robotic Arm Controlled by Raspberry Pi

Drive six servos smoothly, record poses and replay pick-and-place sequences.

LevelEngineer
Time5 h
Est. cost~$201
Steps5

A desktop robot arm teaches kinematics, power planning and motion smoothing. The PCA9685 handles the servo signals; your Python code handles the choreography.

⚠ SAFETY
Keep fingers clear of the gripper and joints while powered. Add an emergency-stop switch on the servo power line.

Video tutorial

Video by Bob Davis, embedded from YouTube. The written steps below are our own and match the parts list.

Mission steps

  1. Assemble the arm

    Center every servo (90°) before attaching its horn. This prevents the arm from slamming at first power-up.

  2. Size the power supply

    Six MG996R servos can draw several amps when moving under load. Use a 5–6 V supply rated 5 A or more for the servo rail — never the Pi.

  3. Wire the PCA9685

    Connect over I2C (pins 3, 5, 3V3 and GND) and plug the servos into channels 0–5.

  4. Move smoothly

    Use the easing function below so joints glide instead of jumping.

  5. Record and replay

    Save lists of angles as poses and play them back. Add a camera later for vision-guided picking.

Code

import time
from adafruit_servokit import ServoKit
kit = ServoKit(channels=16)
cur = [90] * 6

def move(target, secs=1.0, steps=50):
    start = cur[:]
    for s in range(1, steps + 1):
        t = s / steps
        e = t * t * (3 - 2 * t)          # smoothstep easing
        for j in range(6):
            cur[j] = start[j] + (target[j] - start[j]) * e
            kit.servo[j].angle = cur[j]
        time.sleep(secs / steps)

HOME = [90, 90, 90, 90, 90, 60]
PICK = [40, 120, 60, 90, 90, 20]
for pose in (HOME, PICK, HOME):
    move(pose)

Tip: test every script on the bench before installing it in a moving machine.

Questions

The Pi reboots when the arm moves

The servos are dragging the voltage down. Give them their own bigger supply and connect only ground and signal to the Pi side.