There were two self balancing robots made, the first one was a smaller robot whose objective was to balance its battery weight(a 2200 mAH) and was made with small Geared DC motors. The second robot used the similar control system, and its job was to balance around half a kilo of weight on top of it and was a prototype designed for TedX event Mumbai.
Hardware: Arduino Uno , L298n motor driver, MPU-6050 IMU, 2200mAH Li-Po Battery, dc geared motor.
Software: Arduino IDE
Two wheeled Inverse Pendulum robot.
The IMU Mpu-6050 is read using the i2C Arduino wire library. The register bits are set and the gyroscope and the accelerometer are read. The values are converted to angles and the complementary filter is used to combine the values. The angle is then fed into a PID function and the output is mapped to an analog output 0-255 value for each wheel. This causes the tilt to get corrected as the wheels race to get under the center of gravity located near the battery.
Subsequent iterations were then tried with the same electronics for bigger motors and bigger wheel sets, PID values wee applied experimentally in all the robots, a failed iteration was with using Stepper Motors instead of geared DC set on 1/8th microstepping. However that iteration failed as the moor was wrongly selected for the required torque given the inertia of the large system. The final iteration was achieved using relatively small 5kg-cm stall torque dc geared motor and large wheels to compensate for the low 120 rpm speed motors.
Same electronics, Different PID Values, 10 kg-cm DC geared motors
Failed iteration: Stepper motors with 3.0 Amp drivers as actuators, interrupt service routines used to provide pulses for the drivers.
Final Prototype
Motors: 6 kg-cm DC motors
Wheel Diameter : 6 inches
Succesfully balanced around 250 gms of weight.
Max weight balanced : 1 kg