Mini electric unicycle.

Self-Balancing Electric Unicycle

November 18, 2025

Here I present a self-balancing mini electric unicycle based on the ESP32 MCU and MPU-6050 IMU. I had motors and batteries that were pulled from broken hoverboards, so I devised this project to put them to good use. Self-balancing unicycles are an applied solution for a classic problem in dynamics and control theory called the inverted pendulum. The ESP32 takes measurements from the accelerometer and gyroscope, performs sensor fusion and filtering to calculate a stable approximation of pitch, and calculates power output for the BLDC motor to correct pitch towards zero and stabilize the system.

The hardware was built with these components:

  • ESP32 MCU
  • MPU-6050 IMU
  • ZS-X11H brushless motor controller
  • Hoverboard motor (36V, 300W)
  • Hoverboard battery (36V, 400Wh)
  • Passive components as needed (i.e. resistors, capacitors, fuse, power switch)

The build process is described below.

Hoverboard motors have an axel that only extends on one side so the first step was to extend the axel on the other side, the modified motor stator is presented below. 
 

Image
Modified hoverboard motor stator.


After reassembling the motor, I designed a frame for the mini electric unicycle using FreeCAD, which can be viewed in the CAD Modelling section, and 3D printed the parts. A short video clip of the printing process is presented below. 
 


The core assembly, with the motor and battery included, is presented below. 
 

Image
Assembled EUC frame.


After assembling the electronics, I wrote software for the ESP32 using PlatformIO. The process involved tuning a PID controller, I used TelePlot to view IMU measurements, calculations and PWM output in real-time. 
 

Image
TelePlot measurements.


A short video clip of very early testing is presented below. 
 


Next the shell was 3D printed, a short video clip of the printing process is presented below. 
 


The final assembled mini electric unicycle is presented below. Full demonstration coming soon. 
 

Image
Mini electric unicycle.
Tags: ESP32, IMU, PID