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.


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.

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
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 hardware | Size |
|---|---|
| 688ZZ bearings | 8 × 16 × 5 mm |
| Two 6200ZZ bearings | 10 × 30 × 9 mm |
| Ten steel balls | 10 mm diameter |
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.
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.
| Actuator | PCA9685 channel |
|---|---|
| Miuzei shoulder pair | 1 primary, 0 mirrored |
| MG996R elbow | 2 |
| MG996R wrist pitch | 3 |
| MG996R gripper rotation | 4 |
| MG996R gripper opening | 5 |
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 message | Firmware action |
|---|---|
| channel,angle | Set one PWM channel |
| STEP:count | Queue a signed base move |
| ROT:direction | Spin the base or stop it |
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.
| Rail | Voltage | Feeds |
|---|---|---|
| Motor supply | 3S pack voltage | A4988 VMOT and XL4016 input |
| Servo supply | 6 V regulated | Six servo motors via PCA9685 V+ |
| Logic supply | 5 V from Uno | PCA9685 VCC and A4988 VDD |

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.
- Aim the base at the target using atan2(y, x). Express the point as horizontal reach and height relative to the shoulder.
- Follow the gripper link backward along the requested pitch to locate the wrist.
- 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.
- Return a candidate that passes the joint and tabletop checks, or report that the target is outside the model's limits.
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.
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.
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)| Joint | Reference angles | Saved servo command |
|---|---|---|
| Shoulder | 0° and +90° | 180 − joint angle |
| Elbow | 0° and −90° | 90 + joint angle |
| Wrist pitch | 0° and −90° | 90 − joint angle |
Links
Source codeCode on GitHub
Design teamQSET rover arm chassis
Python sourceJoint calibration tool





