Skip to the content
2 layers156 × 89.4 mm4-DOF Robotic Arm, the printed circuit board in 3D

This repository contains the complete engineering files for a 4-Degree-of-Freedom (4-DOF) Robotic Arm System, featuring a gesture-controlled master-slave architecture.

Size
156 × 89.4 mm
Copper layers
2
Thickness
1.6 mm
Parts
24
Nets
46
Pads
120
Tracks, vias
170, 22
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
20 Jun 2026
Updated
20 Jun 2026

Overview

4-DOF Robotic Arm is an open-source printed circuit board by Mkhalaf203, from the Mkhalaf203/4-DOF-Robotic-Arm repository on GitHub. It is a 2-layer board of 156 × 89.4 mm with 24 parts on 46 nets, routed with 170 tracks and 22 vias.

It is built around the ESP32-S2-DEVKITC-1. Its parts include 13 capacitors, 7 connectors and 1 IC. It belongs with the ESP32 boards of this library.

Main components

1

README

README.md

4-DOF Robotic Arm System

Wireless Master–Slave Teleoperation via ESP-NOW

This repository contains the complete engineering files for a 4-Degree-of-Freedom (4-DOF) Robotic Arm System, featuring a gesture-controlled master-slave architecture. The system uses two ESP32 microcontrollers communicating wirelessly via ESP-NOW, closed-loop PID joint control with encoder feedback, custom KiCad electronics, and a hybrid mechanical structure featuring 3D-printed cycloidal gearboxes and rigid aluminum links.


📸 System Overview

mermaid
graph TD
    %% Master Controller (Transmitter)
    subgraph MasterUnit ["Master Controller - Handheld"]
        MCU_M["ESP32 DevKit WROOM-32"]
        IMU["MPU6050 IMU Sensor"]
        B_Open["Gripper Open Button"]
        B_Close["Gripper Close Button"]
        LED["Status LED"]
        
        IMU -->|I2C: SDA/SCL| MCU_M
        B_Open -->|GPIO 25| MCU_M
        B_Close -->|GPIO 26| MCU_M
        MCU_M -->|GPIO 16| LED
    end

    %% Wireless Link
    MCU_M -. "ESP-NOW 2.4 GHz Wireless" .-> MCU_S

    %% Slave Unit (Receiver & Arm Driver)
    subgraph SlaveUnit ["Slave Controller - Robotic Arm"]
        MCU_S["ESP32-S3 DevKitC"]
        OLED["SSD1306 OLED Display"]
        H1["L298N Dual H-Bridge 1"]
        H2["L298N Dual H-Bridge 2"]

🛠️ Software Architecture & Logic

Master Controller (Sender)

  1. Calibration: At startup, it reads the gyroscope Z-axis for 500 iterations to calibrate the yaw bias.
  2. Sensor Fusion: Reads raw accelerometer and gyroscope data from the MPU6050 at a 200 Hz update rate ($dt = 5\text{ ms}$).
  3. Kalman Filtering: Calculates roll and pitch through a custom 2-state Kalman filter, integrating gyroscopic velocities and correcting drift using gravity vectors.
  4. Taring: Pressing both the Gripper Open and Close buttons simultaneously resets the reference frame, setting current pitch, roll, and yaw as zero ($0^\circ$).
  5. Transmission: Packages joint target values (base, shoulder, elbow, servo_angle) and sends them to the slave's MAC address using the ESP-NOW protocol.

Slave Controller (Receiver)

  1. ESP-NOW Callback: Listens asynchronously for ESP-NOW command packets, updating volatile target variables.
  2. PID Position Control: Runs a discrete-time PID calculation for each axis independently: $$u(t) = K_p e(t) + K_i \int e(t)dt + K_d \frac{de(t)}{dt}$$ Tuned parameters: $K_p = 1.0$, $K_i = 0.01$, $K_d = 1.4$, with anti-windup clamping ($[-3000, 3000]$) and a deadband threshold of 20 encoder counts to prevent motor chattering.
  3. Telemetry & Modes: Updates the OLED display every 200ms. In ESP-NOW mode, it contrasts target positions against current encoder positions. Pressing the Mode switch toggles it to Joystick Mode, enabling direct manual control via the integrated joystick and buttons.

📁 Repository Structure

The repository is organized into four main directories:

text
robotic-arm-project/
├── README.md               # Main project documentation (this file)
├── .gitignore              # Git ignore patterns for OS, KiCad, and PlatformIO
├── cad/
│   └── models/             # 3D mechanical designs and parts
│       ├── Robot Gripper.f3d             # Fusion 360 project archive
│       ├── Robot Gripper prototype v3.step # STEP assembly file
│       ├── Robot Gripper prototype v3.stl  # STL mesh print file
│       ├── Readme.txt                      # Web link to the CAD design
│       └── *.png                           # Individual link orthographic views
├── hardware/
│   ├── schematic_and_pcb/  # KiCad hardware design
│   │   ├── 4dof_robotic_arm.kicad_sch    # Circuit schematic
│   │   ├── 4dof_robotic_arm.kicad_pcb    # Double-sided PCB layout
│   │   └── 4dof_robotic_arm.kicad_pro/prl# Project management files
│   └── libraries/          # Custom symbols and footprint libraries
│       └── Library_custom.pretty/        # Custom hardware footprints
└── firmware/
    ├── robot-arm-controller/             # ESP32-S3 Slave Unit Firmware (PlatformIO)
    │   ├── src/main.cpp                  # PID control & ESP-NOW receiver
    │   └── platformio.ini                # Build env & dependencies
    └── robotic-arm-master-controller/    # ESP32 Master Unit Firmware (PlatformIO)
        ├── src/main.cpp                  # Kalman filter, taring & sender
        └── platformio.ini                # Build env & dependencies

🔌 Hardware Connections & Pinouts

1. Slave Unit (ESP32-S3 DevKitC)

The slave unit coordinates joint movements using closed-loop PID control and renders system statistics on an OLED.

ComponentPin FunctionESP32-S3 GPIONotes
OLED DisplaySDAGPIO 17I2C Data (400kHz clock)
SCLGPIO 18I2C Clock
Servo GripperPWM SignalGPIO 850Hz PWM, 0.5-2.4ms pulse width
Motor A (Base)ENA (Speed PWM)GPIO 48Connected to L298N Module 1
IN1 (Dir 1)GPIO 1
IN2 (Dir 2)GPIO 2
Encoder Channel AGPIO 11Interrupt attached (RISING edge)
Encoder Channel BGPIO 12
Motor B (Shoulder)ENB (Speed PWM)GPIO 47Connected to L298N Module 1
IN3 (Dir 1)GPIO 42
IN4 (Dir 2)GPIO 41
Encoder Channel AGPIO 13Interrupt attached (RISING edge)
Encoder Channel BGPIO 14
Motor C (Elbow)ENC (Speed PWM)GPIO 21Connected to L298N Module 2
IN5 (Dir 1)GPIO 39
IN6 (Dir 2)GPIO 40
Encoder Channel AGPIO 9Interrupt attached (RISING edge)
Encoder Channel BGPIO 10
User ControlsReset Position PBGPIO 15Active LOW, triggers joint home routine
Mode Switch PBGPIO 16Active LOW, toggles wireless/joystick mode
Joystick VRXGPIO 4Analog Input (Joystick Mode)
Joystick VRYGPIO 5Analog Input (Joystick Mode)
Elbow Up PBGPIO 6Active LOW (Joystick Mode)
Elbow Down PBGPIO 7Active LOW (Joystick Mode)
Gripper Open PBGPIO 3Active LOW (Joystick Mode)
Gripper Close PBGPIO 38Active LOW (Joystick Mode)

2. Master Unit (ESP32 DevKit WROOM-32)

The master unit tracks user arm/wrist tilt gestures via an IMU sensor and drives gripper commands.

ComponentPin FunctionESP32 GPIONotes
MPU6050 IMUSDAGPIO 21I2C Data
SCLGPIO 22I2C Clock
ControlsGripper Open PBGPIO 25Active LOW, triggers interrupt
Gripper Close PBGPIO 26Active LOW, triggers interrupt
FeedbackStatus LEDGPIO 16Blinks for calibration status

🏗️ Getting Started

1. Hardware Assembly

  • Fabricate the custom PCB in hardware/schematic_and_pcb/ and solder components according to the bill of materials in the 4DOF Report.
  • Note the isolated power layout: supply 12 V to the motor drivers and 5 V (via buck converter isolation) to the microcontrollers and servo.
  • Build the 3D-printed parts and assemble the arm structure as modeled in the cad/models/ folder.

2. Firmware Compilation & Upload

This project is built using the PlatformIO ecosystem:

  1. Open VS Code with the PlatformIO IDE extension installed.
  2. Open either folder: firmware/robot-arm-controller/ or firmware/robotic-arm-master-controller/.
  3. In firmware/robotic-arm-master-controller/src/main.cpp, change the broadcastAddress[] array to match the MAC address of your slave ESP32-S3 unit:
    cpp
    uint8_t broadcastAddress[] = {0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX};
  4. Click Build (checkmark button in the status bar) to compile.
  5. Connect your board and click Upload (right-arrow button in the status bar).

📐 Mechanical Details

  • Cycloidal Gearboxes: Built into joint frames to provide high reduction ratios, mechanical torque multiplication, and low backlash.
  • Hybrid Construction: Combines 3D-printed joint casings with structural V-slot aluminum extrusions for high-rigidity structural support.
  • Fusion 360 Web Viewer: You can view the live interactive CAD model online using the link in cad/models/Readme.txt or by visiting https://a360.co/466JKWE.

Parts

24
QtyValueFootprintReferences
7100 nanoCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC3, C4, C5, C6, C7, C8, C10
4100 microCapacitor_THT:CP_Radial_D6.3mm_P2.50mmC1, C2, C9, C13
420kPotentiometer_THT:Potentiometer_Vishay_T73XW_HorizontalP1, P2, S1, S2
2~Library_custom:HW-677BUCK12-3.3, BUCK12-12
110 microCapacitor_THT:CP_Radial_D5.0mm_P2.00mmC11
1100 nanoCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P2.50mmC12
1ESP32-S2-DevKitC-1Library_custom:ESP32-S3-DevKitCU1
1SSD1306spo2_stuff:SSD1306SSD1306 OLED SCREEN
1Screw_Terminal_01x02TerminalBlock:TerminalBlock_MaiXu_MX126-5.0-02P_1x02_P5.00mmJ2
1Screw_Terminal_01x08TerminalBlock:TerminalBlock_MaiXu_MX126-5.0-08P_1x08_P5.00mmJ1
1Screw_Terminal_01x12TerminalBlock:TerminalBlock_MaiXu_MX126-5.0-12P_1x12_P5.00mmJ3

Similar boards

  • 2 layersAir Hockey, the printed circuit board in 3D

    Air Hockey

    RaviPatel021/Air-Hockey-Bot

    This repository contains all the code and hardware files for an autonomous air hockey table system. The system uses a 2-axis gantry controlled by an ESP32, with real-time vision and inference running on either a laptop…

    3 parts2
  • 2 layers107.8 × 91.5 mmWave reflector, the printed circuit board in 3D

    Wave reflector

    interspecifics/wave_reflector

    wave_reflector is a eeg instrument/interface for live performance and installation

    52 parts
  • 2 layersRobot PCB, the printed circuit board in 3D

    Robot PCB

    Mario-dango/Proyecto-RV

    Dispositivos de Entrada: Joystick analógico (2 GDL) para tracción, pulsadores de acción y MPU6050 (Acelerómetro/Giroscopio) para seguimiento de gestos de inclinación.

    38 parts
  • 2 layers101.2 × 86.5 mmWindmeasureboard, the printed circuit board in 3D

    Windmeasureboard

    GGoodacre/WindChargeController-Capstone2024

    Solar Charge Controller for BEng Capstone 2024

    28 parts1
  • 2 layers56 × 65 mmSeaTalk1, the printed circuit board in 3D

    SeaTalk1

    dotnet/iot

    This repo includes .NET Core implementations for various IoT boards, chips, displays and PCBs.

    24 parts2.4kMIT
  • 2 layers26.2 × 45.5 mmPL18 multiprotocol, the printed circuit board in 3D

    PL18 multiprotocol

    pascallanger/DIY-Multiprotocol-TX-Module

    Multiprotocol TX Module (or MULTI-Module) is a 2.4GHz transmitter module which controls many different receivers and models.

    24 parts1.9kGPL-3.0
  • 2 layers58 × 35.5 mmHat, the printed circuit board in 3D

    Hat

    menloresearch/asimov-1

    v1 of Asimov, an open-source humanoid robot

    24 parts1.4kCERN-OHL-S-2.0

Questions

How big is the 4-DOF Robotic Arm PCB?

It measures 156 × 89.4 mm and has 2 copper layers, 1.6 mm thick.

What parts does the 4-DOF Robotic Arm use?

24 parts, built around the ESP32-S2-DEVKITC-1. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the 4-DOF Robotic Arm KiCad files?

From the Mkhalaf203/4-DOF-Robotic-Arm repository on GitHub, at the commit this page was made from: the board is hardware/schematic_and_pcb/4dof_robotic_arm.kicad_pcb and its schematic hardware/schematic_and_pcb/4dof_robotic_arm.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the 4-DOF Robotic Arm design in my own project?

Its repository states no licence, so its author keeps all rights: ask Mkhalaf203 before reusing the design.