Skip to content
MCU Atlas

3D-printed ESP32 self-balancing robot with steppers

A 3D-printed two-wheel balancing robot: an ESP32 reads an MPU6050 IMU and drives two stepper motors through DRV8825 drivers to keep itself upright.

Difficulty:IntermediateSource available

Key Facts

  • Chip: ESP32
  • IMU: MPU6050
  • Motors: steppers via DRV8825
  • Control: PID

About This Project

This early, compact project shows the classic balancing-robot recipe on an ESP32: an MPU6050 measures tilt, a PID loop computes correction, and two stepper motors driven by DRV8825 drivers keep it upright. The frame is 3D printed. The repo is old (2017) and documentation is light, so treat it as a reference implementation rather than a step-by-step guide.

Source & Attribution

Source: GitHub
License: Apache-2.0
Last verified: 10/15/2026
3D-printed ESP32 self-balancing robot with steppers

Illustration

How to Build It

A 3D-printed two-wheel self-balancing robot using an ESP32, an MPU6050 IMU and stepper motors driven by DRV8825 drivers, with PID control keeping it upright. The repo README is minimal, so expect to work from the source code.

Parts Needed

  • ESP32 dev board
  • MPU6050 IMU
  • 2x DRV8825 stepper drivers
  • 2x NEMA 17 stepper motors + wheels
  • Battery pack (around 12V for the steppers) and a buck converter for the ESP32
  • 3D-printed frame

Steps

  1. 1

    Print and assemble the frame

    Print the chassis, mount the steppers and wheels low down, and fix the IMU firmly near the axle line.

  2. 2

    Wire the electronics

    Connect each DRV8825's STEP and DIR pins to the ESP32 GPIOs used in the source, power the drivers from the battery, and set each driver's current limit with its potentiometer before you connect the motors. The MPU6050 connects over I2C (SDA/SCL).

  3. 3

    Build the firmware

    Open the code in the Arduino IDE or PlatformIO, check the pin numbers against your wiring, and upload.

  4. 4

    Tune the PID

    Hold the robot upright and adjust the PID gains (start with P, then add D and I) until it balances without oscillating.

  5. 5

    Tips

    The README is very sparse, so read the source before wiring and verify the pins yourself. Steppers draw current constantly, so plan for battery life.

Bill of Materials

Parts list

5 parts · 4 linked

Heads up: some Buy links are affiliate links. If you buy through one, MCU Atlas may earn a small commission at no extra cost to you. It never changes which parts we list. How this works

Not included: 3D-printed case, wire, solder, USB cable

Download CSV

Related Projects

SimpleFOC Arduino balancer: BLDC two-wheel balancing robot
Illustration
ARDUINOUNO
A modular two-wheel balancing robot using gimbal BLDC motors and the SimpleFOC library on Arduino-class boards.
Advanced·Code
5 parts listed
Dune Weaver: open-source kinetic sand table
Illustration
ESP32
An open-source kinetic sand table: two stepper motors pull a steel ball through sand to draw patterns, driven from a phone app on an ESP32-based DLC32 controller.
Advanced·Code
4 parts listed
grbl: high-performance CNC motion control on Arduino Uno
Illustration
ARDUINOUNO
grbl is the classic open-source g-code interpreter: flash it onto an Arduino Uno and it becomes a 3-axis CNC motion controller for mills, engravers and plotters.
Intermediate·Code
4 parts listed