https://www.youtube.com/watch?v=oF5KkxXLeEQ
With a 9-DoF IMU (inertial measurement sensor), M2 microcontroller, motors and wheels, I made a self-contained balancing robot that only touch the ground through two coaxially-mounted wheels. In this project, I applied PID control (input: rate gyro and accelerometer; output: motors's duty cycle) and digital filters (remove noises in C# code) to realize self-balance, anti-disturbance as well as balance on sloped surface.