Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

SELF BALANCING ROBOT

Principle
• Based on the principle of inverted pendulum
• Balanced by driving its wheel in the direction
in which it is falling, just like balancing a stick
in our finger.
Components Required
• Arduino Uno
• MPU 6050
• Pair of DC Motors
• L293N Motor Driver
• 9V Battery
• Pair of Wheels
Basic Working
• Get data from accelerometer and gyroscope
• Calculate required angle of inclination
• Control PID for generating output
• Tune the PID constants
• Run the motors according
Getting Data From MPU
• Libraries like “Wire.h” or “I2Cdev.h” can be
used.
• Necessary to calibrate the MPU for eliminating
offset errors.
Calculating Required Angles
• According to orientation of MPU, gyro angle
and accelerometer angle must be calculated.
• Combine the results with a complementary
filter.
• The complementary filter is essentially a high
pass filter acting on the gyroscope and a low
pass filter acting on the accelerometer to filter
out the drift and noise from the
measurement.
PID Control
• PID stands for Proportional, Integral and Derivative
• Proportional : generates a response proportional to
the error (for our system, it is angle of inclination of
robot).
• Integral : generates a response based on
accumulated error.
• Derivative : proportional to the derivative of the
error.
• Multiplying each of these terms by their
corresponding constants (i.e. Kp, Ki and Kd) and
summing the result, output is generated which is
sent as command to drive the motor.
Tuning the PID Constants

• Set Ki and Kd to zero and gradually increase Kp


so that the robot starts to oscillate about the
zero position.
• Increase Ki so that the response of the robot is
faster when it is out of balance.
• Increase Kd so as to reduce the oscillations.
• Repeat the above steps by fine tuning each
parameter to achieve the best result.
Sources To Learn
• Understanding PID Control by MATLAB on
Youtube.

You might also like