Self Balancing Motorcycle




Big Idea

The idea behind Self Balancing Motorcycle is to use the "Inertial Wheel or a Flywheel" on the back to balance the motorcycle. Observe that the problem behind "Balancing the motorcycle" can be analogous to the problem of "Balancing an Inverted Pendulum".


State Space model

The image below shows the notable points




The final acceleration equaton of the inertial wheel is

θ ¨ = m r g l A B sin ( θ ) + m w g l A C sin ( θ ) τ m ( m w ( 0.5 R 2 + l A C 2 ) + 1 12 m r ( 3 r 2 + l A D 2 ) + m r l A B 2 )

Where


The final state space equation is as follows


x ˙ ( t ) = ( θ ˙ θ ¨ ω ˙ ) = ( θ ˙ g sin ( θ ) ( m r l A B + m w l A C ) τ m m w ( 0.5 R 2 + l A C 2 ) + 1 12 m r ( 3 r 2 + l A D 2 ) + m r l A B 2 τ m / I w C θ ˙ )


Simulink Program


The overall simulink program is a closed loop control system, sensor data from the motorcycle sub-block is sent to the controller sub-block, the raw sensor data is preprocessed, PD controller and state flow logic is programmed in the controller sub-block and control commands to the motorcycle sub-block to control the motors.


The image below shows the overall structure of the simulink program.



Sensor Preprocessing


State Flow Chart

The State flow chart shown below defines the logic for the motorcycle.


Controller

The closed loop control system is a simple PD controller as shown below





Working Video

The overall simulink block diagram and working of the motorcycle is shown in the video below