Self-Balancing-Momentum-Wheel model project help

Hello there.
My name is Adam, and I need your help. As a part of my graduation assignment in mechatronics, I have to make some sort of model featuring electronics, programming and mechanics. Most of the work is done. However, because of Corona, I was unable to consult the work with my teacher and have fallen behind because of uncertainity, if the graduation work will be required this year (materials cost a lot for a student so I halted the progress).
Right now I have the last part of the project left to do, but it is the most difficult one, and with my newly acquired skills I am not able to pull it off myself. Therefore, I please and ask you all for help. I am a student and with all my expenses I am not going to be able to reward anyone with money for the help provided :frowning:

The project:
I am constructing a self-balancing motorcycle model with the help of a momentum wheel. Gyroscope takes is monitoring the tilt in one axis, and arduino processes the data and sends a signal to a 12V DC motor at the top of the model, which is connected to a momentum wheel, rotating it to counter balance the forces and tilts created, keeping the motorcycle upright. A video of a similar project is provided in the following link:

Available hardware:
Arduino Mega 2560 R3
Arduino Nano
2xServo Motors with ranged angle, 2x Full-rotating Servo motors
Dual Bridge L298N Control Module for motors
3-Axis Gyroscope DOF MPU-6050 - GY-521
Cytron 10Amp 5V-30V DC Motor Driver
Cytron 10Amp 5V-30V DC Motor Driver
12 V DC 900rmp motor with magnetic encoder

What is already done:
The whole 3d printed model,
Mobile app for controlling the model
Bluetooth model paired with the mobile app and servo motors ( so I can control the front wheel for direction and the back wheel for forward and backward movement)

What I need help with:
I need to hook the gyro module up and get the needed rotation along one axis ( roll axis) ( and I might be able to do that myself )
Next I need to somehow process this information and feed it to my 12V DC motor to rotate so that it keeps the whole motorcycle in balance with the balance wheel. The motor can be controlled very accurately as it has built-in encoder.

If needed, I can provide the up-to-date code from the work I have to control the two servo motors.

In case of any further questions I am here and you can also contact me via mail on

Thank you in advance to anyone even reading this far. I very much appreciate your help!

Interesting project.
Just to be clear, the stabilization is not from gyroscopic forces. Rather, a corrective torque moment is supplied by accelerating the balance wheel in one direction or the other. So what is important is not the speed of the balance wheel, or its angular position, but its acceleration.

Off the top of my head I'd say you will need to know the mass and center of mass of the entire assembly, the exact position of the balance wheel axis, the angular inertia of the balance wheel, and the torque which can be supplied by the balance wheel motor. You will also need to know the precise roll angle of the motorcycle, presumably via an accelerometer. The roll angle is used via some function to control the balance wheel motor. The exact nature of that function is really the whole meat and potatoes of this project. It will require tinkering.


For a static or very slowly rotating model, tilt can be very simply measured using the accelerometer, as described in this short tutorial.

For faster rotation the accelerometer gives false indications which can be to some extent corrected using the rate gyro. The usual approach is a fusion filter, like Madgwick or Mahony.

For the MPU-6050, Mahony IMU code can be found here. You will need to calibrate the gyro at minimum, but for best results, calibrate the accelerometer too.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.