Skip to content
MCU Atlas
ESP32ESP32Draft

3D-printed ESP32 self-balancing robot with steppers

A two-wheeled balancing robot using an ESP32, MPU6050 IMU and DRV8825-driven stepper motors.

Difficulty:IntermediateCost:Source 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/16/2026
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.
Draft: steps not yet verified

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.

Parts List (BOM)
Parts list inferred by MCU Atlas — check the original
inferred
PartQtyRoleEst. PriceBuy
1main board$5–$10View
1IMU$2–$5View
2drivers$2–$4View
Motor size not specified in repo
2motors$8–$15View
Battery pack (unspecified)
1power——
Estimated Total$27–$53 USD

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

Download CSV

Related Projects

Watchy: open-source ESP32 e-ink smartwatch
Illustration
ESP32Draft
An open-source smartwatch with a 1.54in e-paper screen and ESP32, hackable watch faces in Arduino.
Beginner·Under $15·Code
2 parts listed
Low-power ESP32 e-paper weather display (7.5in)
Illustration
ESP32Draft
A wall-mounted 7.5in e-paper weather display on an ESP32 that runs for months on one battery charge.
Intermediate·Cost varies·Code
5 parts listed
OpenEPaperLink: reuse e-ink shelf labels with an ESP32 access point
ESP32ESP32-S3Draft
Turns cheap second-hand electronic shelf labels into a Wi-Fi-managed e-ink display fleet via an ESP32 access point.
Advanced·Under $15·Code
3 parts listed