MyRoboPath
Control & Stabilization
Est. 15 Hours
Budget: $90 - $140

Self-Balancing Inverted Pendulum Robot (PID + Kalman)

Master non-linear control systems by creating a two-wheeled balancing robot using an MPU6050 IMU and high-speed stepper motors.

The ultimate classic robotics challenge: stabilizing an inherently unstable inverted pendulum robot using high-speed IMU complementary / Kalman filtering, cascaded PID position and angle controllers, and zero-backlash NEMA 17 stepper motors.

Bill of Materials (BOM) & Components

ComponentSpecificationsQtyEstimated Cost
NEMA 17 Stepper Motors (0.4Nm Torque, 1.8°)Instantaneous response with zero gearbox backlash2$26
TMC2209 SilentStepStick Stepper Drivers1/256 microstepping with SpreadCycle high-torque mode2$16
MPU6050 6-Axis Gyroscope & Accelerometer ModuleI2C 400kHz fast mode with hardware DLPF filter1$4
ESP32 DevKit V1 Microcontroller240MHz 32-bit dual-core for 500Hz deterministic PID execution1$7
3S 11.1V 1500mAh 30C LiPo BatteryLow internal resistance for high-acceleration current spikes1$18

Electrical & Architecture Summary

ESP32 samples MPU6050 over I2C at 500Hz. Computes pitch angle via Kalman filter. Inner loop computes balancing torque, outer loop stabilizes position and responds to Bluetooth joystick commands.

Step-by-Step Assembly & Configuration

1

Frame Assembly & Mass Distribution Optimization

Duration: 3 Hours

Mount the battery at the top of the chassis. Counter-intuitively, higher center of mass increases the moment of inertia and makes inverted pendulum stabilization easier.

Checklist:
  • Assemble 3-tier acrylic / 3D printed stack.
  • Mount MPU6050 exactly on the wheel axle center line to eliminate centripetal acceleration artifacts.
2

Kalman Filter Implementation & 500Hz Sensor Loop

Duration: 4 Hours

Fuse accelerometer tilt angle with integrated gyroscope rate to calculate drift-free true pitch angle.

Checklist:
  • Calibrate gyro zero-rate bias offsets at startup.
  • Verify filter output on Serial Plotter: response must have zero lag and clean filtering.
3

Cascaded PID Controller Tuning

Duration: 5 Hours

Tune the fast inner pitch loop (Kp_angle, Kd_angle) until the robot balances stably in place, then tune the outer position/velocity loop.

Checklist:
  • Increase Kp until robot oscillates slightly.
  • Add Kd to dampen oscillation until balance is rock-solid.
  • Add position P-loop to prevent the robot from drifting across the room.