My First Self-Balancing Robot
Demo video (YouTube Shorts):
Hardware Setup
- 1 × Makerbase ESP32 FOC v2.0
- 2 × AS5600 magnetic encoders (I2C)
- 1 × BMI160 IMU (I2C)
- 2 × Mitoot gimbal motors 2804 – 100KV
- 3 × 18650 Li-ion batteries
Control Architecture
This robot uses a dual-loop PID control system:
-
Pitch Angle PID
- Keeps the robot balanced (inverted pendulum control)
- Uses pitch data from the BMI160 IMU
-
Velocity PID
- Controls forward/backward movement
- Uses motor velocity feedback from AS5600 encoders
The output of the pitch PID feeds into the velocity loop, allowing smooth and stable balancing while responding to movement commands.