In my mechatronics lab in school, I wanted to build a balancing robot using an Arduino and a gyro sensor. The robot consists of a chassis and two wheels on opposite sides. The DC motors didn't need too much power, and the wiring was simple, so that part was easy. The hard part was using gyro data to make the robot achieve balance.
I used an MPU6050 gyro+accelerometer. Honestly, the hardest part of the project wasn't balancing the robot itself, but rather getting accurate data from the gyro. To make the gyro readings usable, I learned a lot about different types of filters and started experimenting.
To make the robot balance, I used PID control to make the wheels move to counter the robot's tilt. When the wheel's movements match up with the tilt, the robot achieves a nice stability.
*note - the big pole on the robot is a counterweight because the Arduino is not in the center of the robot. The wires going to the motors were too short 🤷♂️