Self Balancing Robot
That's all it does
Background
Ok this project is not that impressive when you look at it, but overall I just had a lot of fun playing around with PID control and watching this little guy fall a bunch. The project was one of the first ones for Mechatronics taught by Dr. Jeremy Brown and was meant to be more of an intro project. It ended up getting pretty competitive with all of the class trying to get their bots to stand the longest.
The Design
The way we designed the bot was that we used the gyroscope on the imu to get its orientation, 2 DC motors and an H-bridge, an Arduino Uno, and 2 9V batteries.
A stacking chassis was designed that allowed for all the components to be kept near the center of the bot. The arduino and IMU were places in the center of the middle part of the chassis to keep the center of gravity low and allow for more accurate IMU readings. We cut the chassis out of acyrilic using a laser cutter and mounted the different components. We kept the batteries on the top and placed them in such a way for them to work as a counterweight.
The code to run it involved setting a zero point by holding the position we wanted to keep the robot in and saving the orientation. Then, when the bot was let go, the imu orientation would be read and compared to the zero position. The error between the two would then be sent to the PD controller which would then command the motors to go forward or backwards and set the speed using pwm.
Results
The bot worked and it was able to stand longer than the required 5 seconds! However, the center of gravity wasn't really in the center so as you can see, when the robot started moving backwards, it ended up tipping. Another issue that came up was that the batteries would drain very fast which would reduce power to the motors. I blame that these were reusable 9V batteries that had been through the gauntlet, so they barely could hold a charge.