Tải bản đầy đủ (.pdf) (72 trang)

(Đồ án hcmute) research and design the self balancing robot

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.22 MB, 72 trang )

MINISTRY OF EDUCATION AND TRAINING
HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION

CAPSTONE PROJECT
MECHATRONICS ENGINEERING TECHNOLOGY

RESEARCH AND DESIGN THE SELF-BALANCING
ROBOT

ADVISOR: VU QUANG HUY, PhD.
STUDENT: PHAN THANH VINH

S K L0 1 0 0 1 7

Ho Chi Minh City, January 2018


UNIVERSITY OF TECHNOLOGY AND EDUCATION
FACULTY FOR HIGH QUALITY TRAINING
DEPARTMENT OF MECHATRONICS

GRADUATION THESIS
RESEARCH AND DESIGN THE SELF-BALANCING ROBOT
ADVISOR: VU QUANG HUY

STUDENT’S NAME:
.Phan Thanh Vinh

13146268

ACADEMIC BATCH: 2013 - 2017


MAJOR: MECHATRONICS

Ho Chi Minh City, January 2018

1


MISSION OF THESIS
Student‘s name: Phan Thanh Vinh

ID:13146268

Major:Mechatronics

Class:13146CLC

Advisor: VU QUANG HUY, PhD
Delivery date:
Submission date:
1.Title of thesis: Research and designtheself-balancing robot

2.The original data, document:
- Datasheet of electronic components
- Android developer’s document website
- Researches and studies on self-balancing robot

3. Main content:
- Researcheson self-balancing robot
- Research and development self-balancing robot model
- Conducting experiments to verify the error rate

- Comparing results with different commercial products

4. Product:
- The fundamentals of balancing.
-Calculating the dynamic parameters, space-state of the model.
2


- Self-balancing robot model

Program Chair

Advisor

3


SOCIALIST REPUBLIC OF VIETNAM
Independence - Freedom - Happiness
----***---ADVISOR’S COMMENT
Student’s name:

Phan Thanh Vinh

ID:

13146268

Major: Mechatronics
Title of thesis: RESEARCH AND DESIGN THE SELF-BALANCING ROBOT

Advisor’s name:
COMMENTS
1. The content of thesis and workload allocated:
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………
2. Advantages:
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………
3. Improvement points:
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………...
4. Thesis defense approval: Yes  No 
5. Evaluation remark:
……………………………………………………………………………………………
6. Grade:………..

(in word:…………………………………………………………)
Ho Chi Minh City, January 2018
Advisor
(Name, signature)

4


SOCIALIST REPUBLIC OF VIETNAM
Independence - Freedom - Happiness
----***---REVIEWER’S COMMENT

Student’s name:

Student’s ID: 13146268

Phan Thanh Vinh

Major: Mechatronics
Title of thesis: RESEARCH AND DESIGN THE SELF-BALANCING ROBOT
Reviewer’s name:
COMMENTS
1. The content of thesis and workload allocated:
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………
2. Advantages:
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………...
3. Improvement points:
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………....
4. Thesis defense approval: Yes  No 
5. Evaluation remark:
………………………………………………………………………………………………
6. Grade: ……………(in word:…………………………………………………….)
Ho Chi Minh City, January 2018
Reviewer
(Name, signature)


5


TABLE OF CONTENTS

ACKNOWLEDGEMENT ................................................................................................ 9
ABSTRACT ..................................................................................................................... 10
LIST OF TABLES ........................................................................................................... 11
LIST OF FIGURES ......................................................................................................... 12
LIST OF ABBREVIATIONS ......................................................................................... 14
CHAPTER 1: OVERVIEW ............................................................................................ 15
1.1 The need for the two wheels self balancing.......................................................... 15
1.2 Some self-balancing robots .................................................................................... 18
1.2.1. nBot .................................................................................................................. 18
1.2.2 TOYOTA's rolling man-powered robot ........................................................ 19
1.2.3 Balance-bot I .................................................................................................... 20
1.2.4 JOE .................................................................................................................... 21
1.2.5Balancing robot (Bbot) ..................................................................................... 22
1.2.6. Equibot ............................................................................................................ 23
1.2.7 Bender ............................................................................................................... 24
CHAPTER 2: FUNDAMENTALS ................................................................................ 25
2.1. Dynamic calculation method ................................................................................ 25
2.2 Inverted pendulum ................................................................................................. 26
2.3 Dynamic of self-balancing robot ........................................................................... 29
2.4 Design the PID ........................................................................................................ 34
2.4.1 Introduction to PID ......................................................................................... 34
2.4.2 Simulating PID controller systems by Matlab .............................................. 36
6



2.5 Signal processing from the sensor ........................................................................ 37
2.5.1 Introduction to the Kalman filter ................................................................... 37
2.5.2 The theory of Kalman filter ............................................................................ 38
2.5.3 Process estimation ............................................................................................ 40
2.5.4 Overall Diagram .............................................................................................. 42
2.6 Microcontroller ...................................................................................................... 43
2.7 Accelerometer ......................................................................................................... 45
2.8 Bluetooth ................................................................................................................. 46
2.9 Dc servo motor GA25............................................................................................. 48
2.10 Motor driver ......................................................................................................... 49
CHAPTER 3:DESIGNS ................................................................................................................... 51
3.1Hardware ................................................................................................................. 51
3.1.1. Hardware Architecture Description ............................................................. 51
3.1.2 General block diagram .................................................................................... 52
3.1.3 Mechanical designs .......................................................................................... 52
3.1.4 Analysis the motor and the sensors ................................................................ 53
3.1.5 Module Placing ................................................................................................. 55
3.2.Software composition ............................................................................................. 56
3.2.1 Receiving data from MPU6050....................................................................... 56
3.2.2 Smoothing data using Kalman filter .............................................................. 56
3.2.3 Code block diagram ......................................................................................... 57
3.3 Control .................................................................................................................... 57
3.3.1 Block diagram of control system .................................................................... 57
3.3.2Adjust PID ......................................................................................................... 59
7


3.3.3 Arduino Bluetooth Controller ........................................................................ 61
CHAPTER 4:EXPERIMENT AND ANALYSIS ................................................................... 62
4.1 Modes of experiments ............................................................................................ 62

4.1.1 Position Drift ....................................................................................................... 62
4.1.2 Angle of tilt ....................................................................................................... 63
4.1.2 Run from 1 point .............................................................................................. 65
4.1.3 Test the velocity of the robot........................................................................... 66
4.2Analysis .................................................................................................................... 67
CHAPTER 5: CONCLUSION AND RECOMMENDATION ........................................... 68
5.1 Conclusion ............................................................................................................... 68
5.2 Recommendation .................................................................................................... 68
REFERENCES ..................................................................................................................................... 69

8


ACKNOWLEDGEMENT
Firstly, we would like to express our sincere gratitude to our advisor Dr. Vu Quang Huy
for the continuous support of our thesis, for his patience, motivation, and immense
knowledge. His guidance helped us in all the time of research and writing of this thesis.
We could not have imagined having a better advisor and mentor.
Secondly, we would like to thank our friends Thang and Kien for their help. Without
their help, we can’t finish this thesis.
Last but not the least, we would like to thank our families: our parents and to our
brothers and sisters for supporting spiritually throughout writing this thesis.

9


ABSTRACT
The main purposes of my project are designing and manufacturing a self-balancing robot,
based on the theory of the balancing inverted pendulum. Calculating parameters of the
model to construct the simulation, designing the model, making electronic boards and

controller, and programming the microcontroller are the missions in the project. The
method analyzing the auto-balancing robot’s dynamic is roughly based on Newton’s laws
and mechanics of solid. To keep the model remains balanced when it don’t move, it must
drive the wheels staying under the gravity, and making a small error in tilt angle (angle of
the chassis with respect to the ground) when it moves.
The result of our work is a self-balancing robot. It is structured of a chassis carrying two
wheels coupled a DC motors for each. Arduino UNO, a microcontroller is used to
implement as the main controller of the model’s system. To have the exact information of
angle received from the noisy accelerometer, a discrete Kalman filter is implemented in
microcontroller.
Keywords:Self-balancing, Inverted pendulum, Balance, Controller, PID

10


LIST OF TABLES
Table 1 Table of symbol .................................................................................................... 30
Table 2 Arduino Uno Specifications ................................................................................ 44
Table 3 MPU 6050 Specification ..................................................................................... 45
Table 4 HC-05 Specifications ........................................................................................... 47
Table 5 MPU6050 connect with Aruino UNO .................................................................. 54
Table 6 Ziegler – Nichols method ..................................................................................... 59
Table 7 Trial and error method .......................................................................................... 60
Table 8 Position drift measured in various experiments ................................................... 63
Table 9 Angle of tilt measured in various experiments ..................................................... 65
Table 10 Run from 1 point ................................................................................................ 66
Table 11 Test velocity ....................................................................................................... 66

11



LIST OF FIGURES
Figure 1 Tricycle status when traveling on flat, steep terrain ........................................... 16
Figure 2 Coaxial two-wheel vehicle status when traveling on flat, steep terrain .............. 17
Figure 3 nBot ..................................................................................................................... 19
Figure 4 The robot, Rolling type of TOYOTA ................................................................. 20
Figure 5 Balance-bot I ....................................................................................................... 21
Figure 6 JOE ...................................................................................................................... 22
Figure 7 Bbot ..................................................................................................................... 23
Figure 8 Equibot ................................................................................................................ 24
Figure 9 Bender ................................................................................................................. 24
Figure 10 Describe how to start moving ........................................................................... 25
Figure 11 Force analysis on the car and on the pendulum ................................................ 27
Figure 12 Demonstrate the force and momentum of the model ........................................ 29
Figure 13 Block diagram of PID controller ....................................................................... 35
Figure 14 PID controller diagram...................................................................................... 36
Figure 15 Simulation result ............................................................................................... 37
Figure 16 Signal acquisition not filtered ........................................................................... 39
Figure 17 Signal passed Kalman filter .............................................................................. 39
Figure 18 Ongoing Discrete Kalman Filter Cycle [4] ....................................................... 42
Figure 19 ArduinoUNO ..................................................................................................... 43
Figure 20 Accelerometer MPU-6050 ................................................................................ 45
Figure 21 MPU-6050 pin out ............................................................................................ 46
Figure 22 Bluetooth module HC-05 .................................................................................. 46
Figure 23 HC-05 pins out .................................................................................................. 47
Figure 24 GA25 servo motor ............................................................................................. 48
Figure 25 GA25 pins out ................................................................................................... 49
Figure 26 The DC L298 motor control.............................................................................. 49
Figure 27 The DC L298 diagram ...................................................................................... 50
Figure 28 The bluetooth controller .................................................................................... 51

12


Figure 29 General block diagram ...................................................................................... 52
Figure 30 Mechanical designs ........................................................................................... 52
Figure 31 The Actuator Block ........................................................................................... 53
Figure 32 Encoder ............................................................................................................. 55
Figure 33 Module Placing ................................................................................................. 55
Figure 34 3-axis acceleration values form MPU6050 ....................................................... 56
Figure 35 Code block diagram .......................................................................................... 57
Figure 36 Control system flowchart .................................................................................. 58
Figure 37 Bluetooth Controller ......................................................................................... 61
Figure 38 RPM output from PID controller while balancing ............................................ 62
Figure 39 Angle of tilt when it balance at one point ........................................................ 64
Figure 40 Test the robot when it is balancing ................................................................... 65

13


LIST OF ABBREVIATIONS
I2C

-

Inter Integrated IC

LQR

-


Linear Quadratic Regulator

PID

-

Proportional Integral Derivative

CV

-

Control Variable

SP

-

Set Point

PV

-

Process Value

FR

-


Front Right

FL

-

Front Left

IMU

-

Inertial Measurement Unit

RPM

-

Rotation Per Minute

PWM

-

Pulse Width Modulation

14


CHAPTER 1: OVERVIEW


1.1 The need for the two wheels self balancing

Mobile robots that almost are three-wheeled robots, with two co-axes, and a small tail.
There are many different types, but this is the most common type. In the case of fourwheeled vehicles, one of the two-wheel-drive vehicles and the other one are fitted with
one or two rudders.
The design of three or four wheels makes the mobile /mobile robot stable by its weight
divided by two main rudders and tailwind, or anything else to support the weight of the
car. If the weight is heavily placed on the rudder, the vehicle / robot will be unstable to
fall over, and if placed on the tail, the two main wheels will lose the ability to cling.
Many car / robot designs can travel well on flat terrain, but can not move up and down on
convex (tilted) terrain. When moving up the slope, the weight of the car / robot in the tail
causes the wheel to lose its ability to slip and slip, for the steps, even stopping and
turning the wheel only.
When moving down the slope, things get worse, the focus shifts forward and even
makes the car / robot overturn while moving on the stairs. Most of these vehicles can
climb up the slopes less than they move down, capsize when the slope is only 15 0 or 200.
The four-wheel layout, like toy cars or four-wheelers, is used in traffic without problems,
but this will make the mobile robots neat and design the steering wheel ) has a bit of a
nuisance to be able to accurately determine the distance travelled. [18]

15


Figure 1 Tricycle status when traveling on flat, steep terrain [18]
In contrast, coaxial vehicles have a very flexible balance when traveling on complex
terrain, although it is itself an unstable system. As it climbs the slopes, it automatically

16



tilts forward and keeps the weight on two wheels. It’s the same when it goes down the
slopes.

Figure 2 Coaxial two-wheel vehicle status when traveling on flat, steep terrain [18]
Designing a new transport vehicle in a narrow area can move right into high-rise
apartment buildings, assisted transportation for the elderly, and transported children.
Make transportation of goods to places already programmed in the buildings, working
rooms, tight spaces, difficult to turn. Even combining on the humanoid robots, if
combined with camera robots, track robots, road surface robots, the efficiency of specific
applications is extremely flexible. However, it is necessary to proceed further to the down
stairs (can not climb up the stairs high).
This is a new transportation to the city in the future with many advantages: lightweight,
less use of the street, easy to carry, removable and transport, clean fuel, easy control for
people large and children , goes on some complexes.
17


At present, in the context of narrow road traffic, air pollution, the research and
manufacture of lightweight, easy-to-manage electric vehicles is a real need. Besides
designing a mobile robot is also a necessity in today's society, to help children, the
elderly, the transporter, the supervisor, etc. in daily life, which has many transportation
and travel.
In terms of science and technology, the self-balancing robot model is an important
stepping stone for the experience of computing, modeling and manufacturing humanoid
robots that is the pinnacle of science and technology. Universities around the world want
to reach out. In addition, the model will also be a necessary addition to the mobility
solutions of three-wheel robots, four-wheelers as well as mobile robots with legs,
enriching the choice of solutions to move for robots.
In terms of human psychology, the self-balanced two-wheeler model is actually a big

question mark for those who have seen or used it. This appeals to the need to use a selfbalancing car.
For the objective reasons as mentioned, the topic may have a certain need in the current
situation of Vietnam as well as the world.

1.2 Some self-balancing robots
1.2.1. nBot [18]
nBot created by David P. Anderson. nBot gets the idea to balance as follows: the
wheels will have to drive in the direction that the upper part of the robot is about to fall. If
the wheel can be driven in a way that stands firmly in the center of the robot, the robot
will remain balanced. In practice, this requires two feedback sensors: the tilt sensor to
measure the robot's inclination with gravity, and the encoder on the wheel to measure the
robot's basic position.

18


Figure 3 nBot
1.2.2 TOYOTA's rolling man-powered robot
This is one of the types of robots for human use designed by TOYOTA. It is 100cm
high and weighs 35kg. This robot is capable of moving fast without taking up a large
space, and its hands can do a variety of tasks, mainly used as an assistant in the industry.

19


Figure 4 The robot, Rolling type of TOYOTA

1.2.3 Balance-bot I [17]

Balance-bot I (by Sanghyuk, Korea) is a self-balancing robot that controls feedback.

The system is 50cm high. The main frame is made of aluminum. It has two shafts
connected to the gearbox and the DC motor for the launch. A total of three Atmel
processors are in use. The master controller implements the control principles and
estimation algorithms. Another microcontroller controls all analog sensors. The third
microcontroller controls the DC motor.
Linear quadratic regulator (LQR) is designed and implemented control circuit. It has
four different values - the angle of inclination, the angular velocity, the angle of rotation
of the wheel, and the rotational speed, which then commands the DC motor to adjust the
speed of the wheel.

20


Figure 5 Balance-bot I
1.2.4 JOE
The Federal Institute of Technology's Industrial Electronic Laboratory, Lausanne,
Switzerland, created the first revolution in building a two-wheeled vehicle. JOE 65cm
high, weighs 12kg, maximum speed about 1.5m / s, can climb up to 30o slope. Power
supply is a 32V battery capacity of 1.8Ah.
Its shape consists of two axle wheels, each with a DC motor, which can be rotated in
the U shape. The control system is mounted on two separate state-space controls. Motor
control to keep system balanced. Information about the state of the JOE is provided by
two optical encoders and the speed of the gyroscope. JOE is controlled by a R / C remote
controller commonly used to control model aircraft. The central controller and signal
processor is a digital signal processing board (DSP) developed by the team and the
Federal Institute, capable of floating point processing (SHARC floating point), XILINC
FPGA, 12 12bit A / D converter and 4 10bit D / A converters.
21



Figure 6 JOE

1.2.5Balancing robot (Bbot) [15]

In 2003, Jack Wu and Jim Bai were students at Carnegie Mellon University with the
help of GS. Chris Atkeson conducted a two-dimensional robot equilibrium with graduate
text. This robot can determine its orientation to the environment and is guided by this
guide. To measure the angle of the robot, these students used the built-in Rotofotion's
2DOF corner system. Systems includes ADXL202 and gyro circuit. Controlling the
control circuit on this robot is BasicX 24, which has many different features. It is used as
a controller, COM1 is connected to the Pocket PC and COM3, and is connected to the
Mini SSC 12 servo controller. It is also used as the main CPU for robot controlled robots.

22


Figure 7 Bbot

1.2.6. Equibot [16]

Equibot is a balanced robot made by Dan Piponi. It basically relies on the ATMega32
RISC microcontroller.
Both standard Hitec HS-311 servo motors are modified for 360° rotation and the input
power is directly connected to the motors for PWM control. One of the two servos is
attached to the quadrature controller LQR, which is the most complex part of the robot
structure, and the other imitates the speed of the first gear. Equibot has only one Sharp
infrared sensor instead of a corner sensor. It is placed low to measure distance to the
floor. The output from the device is used to determine the direction of the moving robot.

23



Figure 8 Equibot
1.2.7 Bender[10]
The Bender Equilibrium is a project implemented by TedLarson, San Francisco. His
current goal is to build a self-leveling robot on the floor, and from there use the platform
to build a self-propelled robot using the wheel.

Figure 9 Bender

24


×