Balance
A two-wheeled robot that stands itself up and stays there.
A cheap IMU, a small microcontroller and a very opinionated PID loop, tuned through trial after trial.
An STM32 Pyboard runs the loop at about 200 Hz.
Two-cell LiPo, with regulators for the logic and the IMU.
Two geared motors, with a dead zone mapped so small corrections still move.

- Brief
- Make a two-wheeled robot stand itself up, and stay there.
- Role
- Built, programmed and tuned it: sensing, the PID loop, motors and power.
- Outcome
- It snaps to vertical and shrugs off a shove.
Balance is a great teacher: sensors lie, motors lag, batteries sag, and the maths still has to work.
- 01
Sense
The gyro gives rate, the accelerometer gives gravity. A complementary filter blends them.

- 02
Decide
Setpoint 0°. PID pushes the wheels to cancel the error, with anti-windup.

- 03
Stand
Tuned through trial after trial until it shrugs off a shove.
