6-DOF robotic arm

I type a 3D coordinate. My Python code works out the joint angles and the printed arm moves its gripper to the target.

The gripper moves between two commanded targets.
Simulation The gripper moves between two commanded targets.Hardware clip in progress
Assembled blue robotic arm on a black base, with its gripper holding a black object and wired electronics alongside.
The printed arm holding an object, with the electronics next to the base.
Close view of the blue printed jaws holding a black object.
The gripper holding an object on the bench.

Try it

Choose Move the arm, then drag the green sphere to give the gripper a target. To move one joint, choose Joints and adjust its slider.

Rendered model of my blue robotic arm

A browser model of my 6-DOF arm reaching commanded targets.

Estimated dimensions and limits. No hardware is connected.

Role
Personal projectMechanicalElectricalSoftware
Timeline
Jan - Mar 2026
Tools
Arduino Uno, Python, Matplotlib, 3D printing
Actuators
Six servos, including two at the shoulder, and a geared NEMA-17 stepper at the base
Status
Typed targets and slider controls both move the physical arm.

Main components

  • Arduino UnoReads serial commands
  • PCA9685Generates servo pulses
  • A4988 + NEMA-17Turns the base
  • Miuzei 20KG pairLifts the shoulder
  • Four MG996R servosMove the elbow, wrist and gripper
  • 3S LiPo + XL4016Supplies the 6 V servo rail

How it's built

I designed and assembled the arm, wired the drivers and wrote the Arduino firmware and Python control tools.

The arm moves through six degrees of freedom. In the workspace model, a tilted gripper can reach 63 cm above the table. Python solves for the joint angles and sends them over USB to the Arduino, which drives the servos and base stepper.

Actuated axes
6 DOF
Highest sampled tip position · model
63 cm
Python → Arduino serial
115,200 baud
Hardware demo · in progress

Rotating base and shoulder

Bearing-supported yaw

A geared NEMA-17 stepper turns the entire printed assembly about the base axis. The rotating assembly uses 688ZZ bearings, two 6200ZZ bearings and ten steel balls. Once the base faces a target, the shoulder, elbow and wrist can set the reach and height in that vertical plane.

I measured the links between joint centres so the coordinate model uses the arm's geometry. The shoulder is 80 mm above the table. From there, the shoulder-to-elbow link is 200 mm, the elbow-to-wrist link is 125 mm and the wrist-to-tip distance is 225 mm. The last distance matters when I tilt the gripper. Even with the wrist in the same place, changing the pitch moves the tip.

Base hardwareSize
688ZZ bearings8 × 16 × 5 mm
Two 6200ZZ bearings10 × 30 × 9 mm
Ten steel balls10 mm diameter
Side view with the shoulder height and three joint-to-joint dimensions.
Distances used by the coordinate model, measured between joint centres and to the gripper tip.
The 3D-printed arm from the side, with its shoulder assembly and geared base visible.
Side view of the arm and geared stepper base.

Opposed shoulder servos

The shoulder lifts the forearm and gripper together. I used two opposed Miuzei 20KG metal-gear digital servos and metal horns at that joint. Both servos drive the same movement from opposite sides. When the primary gets a command of u degrees, its partner gets 180° minus u so the two horns turn the shoulder in the same physical direction.

Opposed shoulder horns with mirrored command arrows.
Reversing channel 0 makes both horns lift the link together.
Shoulder photo · in progress

Four MG996R servos move the elbow, pitch the wrist, rotate the gripper and open or close it. The four axes set by the coordinate controller are base yaw, shoulder, elbow and wrist pitch. Turning the gripper about its own axis and closing its jaws are separate commands. I can set them from the gamepad while working with the arm on the bench.

ActuatorPCA9685 channel
Miuzei shoulder pair1 primary, 0 mirrored
MG996R elbow2
MG996R wrist pitch3
MG996R gripper rotation4
MG996R gripper opening5

Control signals and motor power

System architecture

Python sends one command per line to the Arduino Uno at 115,200 baud. The Uno passes a servo command to the PCA9685 over I²C on A4 and A5. The chip runs at 50 Hz and generates pulses on the six servo outputs. In the sketch, the 0° and 180° servo commands map to 100 and 500 PWM counts. The calibration accounts for how each servo horn sits on its shaft.

For the base, the Uno drives STEP and DIR on pins D3 and D4. A signed step command adds to the pending move. The sketch checks the time before each new pulse and returns to reading serial between pulses. That lets it accept servo commands while the base is turning. The gamepad uses a separate command for continuous rotation. On reset the firmware commands the six servos to 90°.

Serial messageFirmware action
channel,angleSet one PWM channel
STEP:countQueue a signed base move
ROT:directionSpin the base or stop it
Control and power diagram. Python sends serial commands to the Uno, which writes PWM settings to the PCA9685 and pulses the A4988. A 3S battery feeds the A4988 and the buck converter for the 6 V servo rail.
The Uno routes motion commands to the two drivers. The 3S battery feeds the stepper driver and the regulator for the 6 V servo rail.
From Python over USB to the Uno, servo driver and stepper driver.
The signal paths share the Uno. Motor power comes from the 3S pack.

The 6 V servo rail

The 3S LiPo feeds the A4988 motor input directly. An XL4016 buck converter supplies the 6 V servo rail from that same battery. I put a 1,000 µF electrolytic capacitor across the servo rail to help smooth supply fluctuations when the servos move. The PCA9685 sets the signal pulse width while the rail supplies the servo motors.

RailVoltageFeeds
Motor supply3S pack voltageA4988 VMOT and XL4016 input
Servo supply6 V regulatedSix servo motors via PCA9685 V+
Logic supply5 V from UnoPCA9685 VCC and A4988 VDD
Close view of the yellow battery connector, converter heatsinks and capacitor.
The LiPo lead enters at the yellow connector. The XL4016 board and its capacitor sit below the lead, beside the servo wiring.

From a target to joint motion

Geometric inverse kinematics

I enter an XYZ target in centimetres and can specify the gripper's pitch in degrees. A level gripper is 0° and a gripper pointing down is −90°. The calculation projects the point into the vertical plane of the arm, then uses the law of cosines to solve for the shoulder and elbow. Specifying pitch fixes the direction of the last link and therefore fixes the wrist location for that target.

The solver uses 0° to 150° at the shoulder, −90° to 0° at the elbow and −90° to +90° for wrist pitch. It also requires the modeled elbow, wrist and tip to stay at least 0.5 cm above the tabletop in the solved pose. These limits give the solver a way to discard poses for a target that the triangle equations can solve.

With pitch left open, the solver searches from −90° to +90° in 5° increments, starting with the pitch closest to level. For example, at a tip target of (30, 0, 20) cm the level-gripper solution exceeds the elbow limit. The solver accepts the same target at a pitch of −30°. Tilting the last link moves the wrist to a point that the shoulder and elbow can reach.

  1. Aim the base at the target using atan2(y, x). Express the point as horizontal reach and height relative to the shoulder.
  2. Follow the gripper link backward along the requested pitch to locate the wrist.
  3. Solve the shoulder and elbow as a two-link triangle. Try both signs of the elbow angle and set wrist pitch to complete the tool angle.
  4. Return a candidate that passes the joint and tabletop checks, or report that the target is outside the model's limits.
Gripper workspace
Side-view workspace plot with horizontal reach and height in centimetres. It shows targets accepted with a level gripper and the additional points accepted when the solver chooses the pitch.
The original Python solver accepted 585 targets with a level gripper and 1,830 more with automatic pitch selection. It sampled 3,584 targets at 1 cm spacing in the plane y = 0.
Shoulder, elbow and wrist form a triangle with two fixed links.
The shoulder-to-wrist distance closes the triangle. The two fixed link lengths determine the elbow angles.

Typed moves and live slider control

For a typed move, the controller interpolates the four joint angles from the previous command to the new pose in 40 updates, with a 20 ms pause after each update on hardware. Each update converts the three pitch angles to servo commands and sends any change in base yaw as a signed step count. Interpolating those angles makes the gripper follow the resulting joint motion, which can curve through space.

The Matplotlib control panel gives me Reach, Height and Base yaw sliders. Base yaw spans −120° to +120° in this interface. Slider callbacks store the new target and a 40 ms timer checks for changes. The draw code reuses the plotted arm line and target marker. It uses forward kinematics to place the predicted joints and tip, so I can compare the requested point with the computed pose and see when the solver rejects a target.

Live slider control sends valid targets directly, with a 60 ms minimum interval between sends. The typed-target script also has a dry-run mode that prints the serial commands so I can inspect the command path with the arm disconnected. The public source includes the control scripts, calibration tools and Uno firmware. The kinematics module is a separate dependency.

Joint angle interpolation
Four joint angle traces across a typed move.
The controller generated 40 updates for (30, 0, 20) cm. Index 0 is the starting pose. Base yaw stays at 0°.
Controller export showing the computed arm, target and three input sliders.
The Python controller’s model and sliders at its default target, (30, 0, 20) cm.
The controller’s 3D model with its target marker.
Computed arm pose at (30, 0, 20) cm.
Reach, height and base-yaw sliders from the same controller state.
Reach, height and base yaw for the plotted pose.
A printed arm beside its drivers, a gamepad and a laptop running the 3D control view.
The arm, drivers and laptop running the 3D control view.

Testing the joint calibration

I used two reference poses per joint to fit the relationship between joint angle and servo command. I calibrated the base by counting steps through a right-angle turn. The base tracks position from commanded steps.

For the shoulder I jogged the first link from horizontal to vertical. For the elbow and wrist I used an in-line pose and a right-angle fold. I recorded the servo command at each pose and fitted a scale and offset. An offset sets the command for the joint's zero angle and the sign of the scale accounts for which way the installed servo turns.

For base yaw I marked the starting position and moved the stepper in batches of 20 pulses until the base had turned 90°. The saved calibration is 2.222 steps per degree. During a move the controller applies that scale to the requested change in yaw and rounds it to a whole pulse count. The controller starts from an assumed base zero, so the direction it reports depends on aligning the base before a run and the motor following its commands.

I kept separate bench scripts for checking servo centring and sweeps, the stepper and the I²C connection. Forward kinematics checks the solver's pose in the model. I use the marked target at a −30° tool pitch for the physical check.

2.222steps/deg · base yaw
The controller applies the saved scale and offset, then mirrors the partner shoulder command.
def joint_to_servo(self, joint, angle_deg):
    c = self.cal[joint]
    return c["m"] * angle_deg + c["b"]
def _apply_pose(self, angles):
    for joint in ("shoulder", "elbow", "wrist"):
        v = self.joint_to_servo(joint, angles[joint])
        self._send_servo(JOINT_SERVO[joint], v)
        if joint == "shoulder":
            # Inverse shoulder pair
            self._send_servo(SHOULDER_PARTNER, 180 - v)
First link horizontal at zero degrees and vertical at ninety degrees.
I recorded one servo command with the first link horizontal and another with it vertical.
JointReference anglesSaved servo command
Shoulder0° and +90°180 − joint angle
Elbow0° and −90°90 + joint angle
Wrist pitch0° and −90°90 − joint angle