Engineering / Independent project

Self-balancing two-wheel robot

A two-wheel robot that balances itself with only an IMU. I designed and printed the chassis, wired it by hand and wrote all the firmware.

Organisation
Independent project
Abdullah Gül University
Period
2024 – 2025
Role
Solo build — chassis, electronics, firmware
Tools
Blender, FDM 3D printing, Arduino C, Cascaded PID, MPU6050, Bluetooth

Problem

Build a two-wheel robot that stays upright on its own and drives forward and back, with no wheel encoders and no optical sensors — only an MPU6050 IMU.

What I did

  • Designed the chassis in Blender, 3D printed it, wired the electronics by hand, and wrote the full firmware in Arduino C.
  • Implemented a cascaded PID controller — an inner tilt-angle loop for balance and an outer velocity-feedback loop for controlled forward and backward movement.
  • Estimated tilt with a complementary filter on the MPU6050 readings.
  • Fixed I2C bus corruption from motor EMI with isolated power domains, twisted-pair wiring and a firmware bus-reset timeout.
  • Made all PID parameters tunable live over Bluetooth, without reflashing, and logged telemetry to a live dashboard.

Result

Stable balance within ±0.5° of the setpoint, using only the IMU and a complementary filter.

The robot

Open in viewer
Holding balance while being pushed by hand.
Open in viewer
Driving forward under the outer velocity loop.
Open in viewer
Project overview.

Chassis

Modelled in Blender and 3D printed.

Open in viewer
Chassis model.
On the bench, connected for tuning.
Open in viewer
On the bench, connected for tuning.

Telemetry

Tilt angle, PID terms and motor output are streamed from the robot and plotted live while tuning.

Open in viewer
Live dashboard next to the real robot.
Full run: IMU angle vs target, PID components and motor command.
Open in viewer
Full run: IMU angle vs target, PID components and motor command.
70-second window of the same signals.
Open in viewer
70-second window of the same signals.
20-second window.
Open in viewer
20-second window.