3-DOF Robotic Arm with Inverse Kinematics
Arduino-powered robotic arm with analytical inverse kinematics and interactive 3D control dashboard
Project Overview
This project implements a complete robot arm control system combining embedded firmware with desktop visualization. The Arduino runs a real-time inverse kinematics engine that converts 3D coordinates to joint angles and controls servos with smooth interpolation. What makes this project unique is the custom desktop dashboard built with Raylib that provides interactive 3D visualization - you can literally click and drag the end effector in 3D space, and the physical robot arm moves in real-time to match.
The system achieves ±2mm positioning accuracy across a 210mm workspace using a geometric inverse kinematics solution. The Arduino firmware implements Cartesian-space path planning with 20-step interpolation for fluid movement, while the desktop GUI provides intuitive drag-and-drop control alongside precise numerical coordinate input. Serial communication at 115200 baud ensures seamless PC-to-robot coordination with minimal latency.
Technical Implementation
- Inverse Kinematics Engine: Custom geometric solution using law of cosines and triangle decomposition for 3-DOF manipulation with ±2mm accuracy over 210mm workspace
- Interactive 3D Dashboard: C++/Raylib desktop application with real-time 3D visualization, drag-and-drop end effector control, and orbital camera for inspection
- Smooth Motion Planning: Cartesian-space linear interpolation with 20-step path generation creates straight-line trajectories and fluid movement
- Hardware Integration: PCA9685 16-channel PWM driver via I²C provides 12-bit servo control resolution; 3× MG996R servos powered by dedicated 5V/3A supply
- Safety Systems: Workspace boundary validation, self-collision prevention via elbow angle constraints, and per-servo calibration for accurate positioning
- Dual Control Modes: IK mode for position control via 3D coordinates, manual mode for direct servo angle control during testing and diagnostics
Key Challenges
Building the GUI was a major learning curve. I had to implement ray casting to convert mouse clicks into 3D world coordinates, handle orbital camera controls with quaternions, and render the arm in real-time while maintaining smooth serial communication. The trickiest part was making the drag-and-drop feel natural - I needed to constrain the end effector to the robot's reachable workspace while the user dragged it around. If they tried to move it somewhere impossible, the system had to smoothly clamp to the nearest valid position rather than just failing.
On the embedded side, debugging the inverse kinematics was challenging. Small errors in the geometric derivations would cause the arm to move to incorrect positions or twist into singularities where the elbow "flipped" unexpectedly. I had to carefully verify each step of the mathematical solution and add elbow angle constraints to prevent self-collisions. The interpolation system also required careful tuning - too fast and the servos would jitter, too slow and the motion felt sluggish. Running everything within the Arduino's 2KB RAM constraint required memory-optimized code and non-blocking architecture for responsive control.