Professional Documents
Culture Documents
i
4.3.5 Calibrate the analog value...................................................................................................23
4.3.6 Algorithm..............................................................................................................................24
4.4. Power supply.........................................................................................................................26
5. CHAPTER 5: CONTROLLER SYSTEM.....................................................................................................27
5.1 Specification:.............................................................................................................................27
5.2 Decentralized control system:..................................................................................................27
5.3 Micro-controller.......................................................................................................................28
6. CHAPTER 6: MODELLING AND SIMULATION.......................................................................................30
6.1 Kinematic model.......................................................................................................................30
6.2 Input parameters......................................................................................................................31
6.3 Result of simulation..................................................................................................................33
7. CHAPTER 7: CONCLUSION AND FURTHER DEVELOPMENT.................................................................35
7.1 Conclusion.................................................................................................................................35
7.2 Further development................................................................................................................35
REFERENCE.................................................................................................................................................36
ii
FIGURE CATEGORY
iii
Figure 3.6: Diagram for detemining minimum distance between 2 active wheels_____________15
Figure 4.1: GA25V1 Motor_______________________________________________________16
Figure 4.2: L298N______________________________________________________________16
Figure 4.3: Relationship between velocity and duty cycle_______________________________18
Figure 4.4: Motor responding graph_______________________________________________18
Figure 4.5: System indentification tool_____________________________________________18
Figure 4.6: Respond with PID controller___________________________________________20
Figure 4.7: Module BFD-1000___________________________________________________20
Figure 4.8: Vertical and horizontal position of sensor_________________________________21
Figure 4.9: Analog value corresponding to heights___________________________________22
Figure 4.10: Working range of emitter & detector of 2 consecutive sensor_________________23
Figure 4.11: Relation between calculated distance and real distance______________________25
Figure 4.12: Linear regression____________________________________________________25
Figure 4.13: Module LM2596_____________________________________________________26
iv
TABLE CATEGORY
v
DESIGN GOALS
Designing & simulating a line following robot to follow the race-track which has the following
properties
Line color: black
Base color: white
Line width: 25mm
Terrain surface: plane
START
500
Fig.0.1: Race - track
vi
1. CHAPTER 1: GENERAL
Many line following robots have been made all over the world, not only to race but also for
study cases. To design, many technical factors need to be considered: mechanic, sensor, motor,
mechanical design & control algorithm.
1.1. Mechanical construction
Nowadays, many principal diagrams have been used to design robot.
Here are some models come from some international racing competition:
o Cenkk:
Figure 1.1: Cenkk robot Figure 1.2: Cenkk robot’s principal diagram:
Advantages:
3 wheels → easy to be complanar
Electrical system, motors, batteries all are placed capitally, move centre of gravity to
near rear wheels.
Disadvantages:
2rear drives → unstable while turning
o Swarm-2
vii
Figure 1.3: Swarm-2 robot Figure 1.4: Swarm-2 robot ‘s principal diagram
Table 1.2: Prameters of Swarm-2 Robot
L ×W × H v max v avg m ϕ mainwheel ϕ caster wheel Sensor
sensor
distance
0.46 m/s
Advantages:
3 wheels → easy to be complanar
2 front driving drives, 1 caster wheel is behind → high stable dynamic capability
Vacuum aspirator on the background reduces the effect of centrifugal force when
turning.
o Pinto
Figure 1.2: Pinto robot Figure 1.3: Pinto robot’s principal diagram
Table 1.3: Parameters of Pinto Robot
L ×W × H v max v avg m ϕ mainwheel ϕ caster wheel Sensor
sensor
distance
210×130×120 0.8 m/s 60 mm 1QTR-8RC
Advantages:
3 wheels → easy to be complanar
2 front drives, 1 caster wheel is behind → high stable dynamic capability
Motors are placed eccentrically, used belt transmission for driving, which helps lower
robot’s width.
o Pika Robot in Roboxy 2015
viii
Figure 1.7: Pika Robot Figure 1.8: Pika robot’s principal diagram
Table 1.4: Parameters of Pika robot
L ×W × H v max v avg m ϕ mainwheel ϕ caster wheel Sensor
sensor
distance
2.7 m/ s 1.9 m/s
Advantages:
3 wheels →easy ¿ be complanar
Electricalsystem, motors, batteries all are placed capitally, move centre of gravity to
near driving wheels.
Disadvantages:
Driving wheels is in the rear side→ unstable while turning
o Bolt at SUMO Challenge 2015
Figure 1.4: Bolt robot Figure 1.5: Bolt robot’s principal diagram
Table 1.5: Parameters of Bolt Robot
L ×W × H v max v avg m ϕ mainwheel ϕ caster wheel Sensor
sensor
distance
69 g 12 mm
Advantages:
2 caster wheels→ stable while turning.
Use carbon line to connect sensor with microcontroller to reduce weight, electrical
system, motors, batteries all are placed behind, which moves centre of gravity to near
rear drives.
Disadvantage
4 wheels → difficult to be complanar.
ix
o Suckbot robot
Figure 1.6: Suckbot robot Figure 1.7: Suckbot robot’s principal diagram
Table 1.6: Parameters of Sukbot Robot
L ×W × H v max v avg m ϕ mainwheel ϕ caster wheel Sensor
sensor
distance
2.7 m/s 0.93 m/s 300 g 70 mm 6QTR-1RC 12 mm
Advantages:
2 caster wheel→ stable while turning
Vacuum aspirator on the background reduces the effect of centrifugal force when
running in the curve.
All the electrical system, battery, motor are placed behind, between two active
wheels, which moves center of gravity to wheel axis, reduce torque while turning.
Disadvantages:
4 wheels → difficult to be complanar
o Sunfounder Robot
Figure 1.8: Sunfounder Robot Figure 1.9: Sunfounder Robot’s principal diagram
Table 1.7: Parameters of Sunfoundr Robot
L ×W × H v max v avg m ϕ mainwheel ϕ caster wheel Sensor
sensor
distance
x
280 ×153 ×83 2.7 m/s 1089 g TCRT5000 12 mm
Advantages:
Batteries are placed near the ground, lower the centre of mass.
The main electric system & batteries are placed behind → centre of gravity are near
the driver axis
Disadvantages:
Robots have 3 dof, therefore they have an odd dof → difficult to control
synchronously, make robot to be unstable.
1.2. Sensor
Camera
Figure 1.10: OV9655 Figure 1.11: CMUcam5 Figure 1.12: RPI cam
o High accuracy due to high resolution.
o Low processing rate.
Using LDR (Light Dependent Resistor) / IR (infrated) LED.
o LDR: TSOP38238, TSOP38438, …
o IR LED: GP1S36J0000F, S2829, TCRT5000, ….
Figure 1.13: LDR TSOP38238 Figure 1.14: TCRT5000 Reflectance Sensor Array (IR
LED)
xi
Figure 1.17: QTR-8RC
The IR LED is the most optimized sensor for line following robot, it comprises of IR-
transmitter (T x ) and receiver ( R x).
Distance between sensors and ground surface must be 2 to 10 mm and distance between each
sensor is dependent on the line width.
Figure 1.19: Straight line Figure 1.20: Matrix Figure 1.21: Profile:∨,∧,∩,…
Signal processing algorithms from optical sensor
Signal is processed by comparative algorithm
xii
Figure 1.23: Approximation algorithm
The signal’s value is received from sensors ( y 1, y 2, …, y n) that is considered to determine
position of the line. Having some algorithms: quadratic interpolation technique, weighted
average, linear, etc.
The processing time depends on reading the analog output values from all sensors, so the
processing time is long; however, this method has high accuracy.
1.3. Control
The line tracking robots have main modules including : sensor module, control module and
driver. There are two main methods for linking these modules together: centralized method
and decentralized control method.
In the centralized control method , an MCU receives signals from the sensor, processes the
data and transmits the control signal to the actuator. This is the structure commonly used in
many competitions like the CartisX04, Le'Mua (Robot Challenge 2015), Pika. The centralized
control structure has simple hardware characteristics, however the MCU must process all the
information before updating the new information.
2.
Sensor
Micro
Driver Driver
Controller
xiii
communication between MCUs is a concern, but it’s capable of handling multiple tasks at
once, allowing rapid system sampling. than when using centralized structure.
Sensor
Slave 3
Driver Driver
xiv
v=v r
1 0 0 Right deviation ꞷ=+ d ꞷ
[ ][ ][
ė 2 = v R sin e 3 + 0 −d −e 1 ⌈ ⌉
ė 3
o Controller
ωR 0 −1 ] ω
v
v=v R cos e 3 +k 1 e 1
{
ω=k 2 v R e2 +ω R + k 3 sin e3
Fix v=v max → e 1=0
Assume angle deflection is small, e 3 ≈ 0
Requirement for designing
Designing the line follower robot with the line given before:
Maximum following line error: e max =±6 mm
Velocity: v max=1 m/ s
xv
START
500
Figure 1.27: Race path
xvi
xvii
3. CHAPTER 2: DESIGN OPTIONS
Accuracy √ √
Processing rate √ √
Cost √ √
o Technique specification:
Comprises 5 IR LED.
Line detection distance:
0.5 40 mm .
Analog Output.
1 obstacle avoidance sensor
(optinal).
Dimension: 128 x 45 x 12mm .
Figure 3.29: IR Sensor TCRT5000
2.3 Controller
o Decentralizing controller for developing process then be integrated into Capitalizing one
o PID controller.
xviii
4. CHAPTER 3: MECHANICAL DESIGN
3.1 Wheels
3.1.1 Active wheels
Technical parameters
Diameter: 80 mm
Width: 27 mm
Mass: 0.07 kg
Axis diameter: 5 mm
Material: Plastic, rubber Fig 4.30: V1 Wheel
3.1.2 Passive wheels
Technical parameters
Mass: 0.04 kg
Load: 18 kg
Material: Plastic
∅ wheels : 49 × 32mm
Hole dimension: 40 mm
∅ holes: 4 mm
Height: 20 mm
Ball diameter: 16 mm Fig 4.31: Ball caster
3.2 Calculation to choose motors
m R2
Inertia moment: I =
2
Moment equation: τ =Iγ+ F ms R
M m R2 M
Applying Newton II Law: F ms=
2 ( )
+ m a ⇒τ =
2
γ+
2 (
+ m aR )
xix
Initial parameters:
Maximum velocity 1 m/s
Desired speed up time 1s
Wheel radius 40 mm
Wheel weight 0,025 Kg
Estimated load mass 2 Kg
Friction coefficient 0,8
Safe coefficient 2
xx
3.2.1 Height
T
ሬ
𝐹ሬ
ሬሬ
Ԧ
𝑙𝑡
𝑃ሬ
Ԧ
ሬ
𝐹ሬ
ሬሬ
ሬ
𝑚𝑠
ሬ
Ԧ
C
𝑏/2
Pb
F ¿ h− ≤0
2
m v2 b
→ h−mg ≤ 0
R 2
gbr
→h≤
2 v2
While:
Height h ≤ 44,15 cm
xxi
3.2.2 Basic dimension of car
General dimension of car depends on dimention of mechanical & electronic components,
distance between sensor and active wheels.
Calculate distance between two active wheels: Given that R = 500 mm, velocity = 1 m/s.
Determine the minimum distance between two active wheels as not to flip
Z
Y
ሬ𝐹ሬሬ𝑙𝑡ሬԦ
X
`
R = 500mm
𝑃ሬ
Ԧ
Fig 3.6: Diagram for detemining minimum distance between 2 active wheels
Given that:
Height of car: 100 mm
Height of center of gravity (G) from the ground: 30 mm
Distance between two active wheels: b
Distance between two active wheels: b
Centrifugal force: F ¿
Obvious:
m v2 12
F ¿= =1.5 . =3( N )
R 0.5
Therefor:
Pb (3.6)
F¿ h ≤
2
2 F¿ h
→b≥ =12,23 mm
P
Consequently, our group choose b = 140 mm and depth = 240 mm.
xxii
3. CHAPTER 4: ELECTRICAL DESIGN
4.1.2 Driver
Voltage characteristics - The velocity through the driver must be linear. Driver L298N is
chosen
xxiii
o Dimensions: 43x43x27mm
4.1.1.3 Determining transfer function for motor and driver
Note the corresponding input-output and use either the System Identification Toolbox or
control theory to find the transfer function.
Note the corresponding input-output and use either the System Identification Toolbox:
Table 4.1: Motor and driver characteristic:
PWM % Duty cycle Measur
e
0 0 0
25 9.8039 0
50 19.6078 75
75 29.4118 106
100 39.2157 137
125 49.0196 167
150 58.8235 199
175 68.6275 226
200 78.4314 255
225 88.2353 281
250 98.0392 307
xxiv
Fig 3.3: Relationship between velocity and duty cycle
PWM Driver+ DC
(duty cycle) motor
xxv
Fig 3.5: System Identification tool
So, transfer function of motor and driver:
11.06
TF=
s+ 7.8
4.2 PID control design for motor and driver
The driver-motor system is almost linear; the feedback is quadratic, so we can add PID
controller into this system.
PID controller disgn requirement:
o Settling time:0.02 s .
o Overshoot: 12 % .
xxvi
Fig 3.6: Respond with PID controller
4.3 Sensor
4.3.1 Sensor module
According to the design goals & chapter 4 (electrical design), module single IR sensor
TCRT5000 is chosen which has an emitter & a detector and is able of changed the returned
analog value by the changeable resistor
xxvii
Typical output current 1 mA
Forward current 60 mA
Reverse voltage 5 V
xxviii
Fig 3.9: Analog value corresponding to heights
The most suitable distance for sensor is 2−8 mm. Therefore, we choose the d 1=6 mm.
4.3.4 Checking distance between 2 sensors
The distance between 2 sensors (d 2 ¿ should be check so that the sensor system is able to
recognize the line while the working range of 2 consecutive sensor is not override each
other.
To determine d 1, horizontally move a sensor from another to far away and read analog
values, the best horizontally distance is corresponding to the uniformity of the two feedback
analog values
xxix
Fig 3.10 Working range of emitter & detector of 2 consecutive sensor
From the figure, it is obvious that distance of the two consecutive sensors should greater
than 12 mm
.3.5 Calibrate the analog value
As:
x max, i , x min, i are the maximum and minimum analog value of ith sensor when lie 9 mm
above the black line /white paper plane respectively.
y max , y min are the desired maximum and minimum analog value.
x ij is the analog value read finally.
xxx
y jo is the analog value of ith sensor after calibrating.
The minimum and maximum analog value (data shown as xls file in [3]/3.Calibrate)
Sensor x min x max y jo
x1 243 2411 y jo =200+1.184 ( x j , 1−254 )
Suppose that the coordinate of the 7 reflective optical sensors are x 0 , x 1 , x 2 , x 3 , x 4 , x 5 , x 6 and
the corresponding analog output values are y 0 , y 1 , … , y 5 , y 6. The estimated line position
can then be calculated by the formula:
4
∑ xi yi
0
x= 4
d
∑ yi
i=0
3 ( y 4− y 0 ) + 2 ( y 3 − y 1 ) +( y 2 )
¿ 4
d
∑ yi
i=0
xxxi
The calculated distance is far different from the actual distance when we step by step move
the sensor array to one direction. This is due to “the unidentified distance” where the analog
value unchanged although sensor array already moved for a distance of ∆ mm.
40
37.5
35
10 10.3
5 5.9
3.1
0 0
0 5 10 15 20 25 30 35 40 45 50
Real distance (mm)
xxxii
Fig 4.11: Relation between calculated distance and real distance
xxxiii
Module DC LM2596 is available at Iot Marker VietNam Store. Using 3 module DC
LM2596 to convert from input voltage 15V to stable output voltage 12V, 9V and 5V. The
output voltage is adjusted by the resistor
xxxiv
4. CHAPTER 5: CONTROLLER SYSTEM
5.1 Specification:
The robot can follow the line as much exactly as possible
Velocity varies from 0.7 m/s to 0.9 m/s
Sampling time: 0.02s.
START
500
Fig5.1: Desired path
Sensor
Slave 1
xxxv
Fig5.2: Control block diagram
Advantages:
Easy for separate developing in different tasks (Sensor feedback processing, right motor-
encoder controlling...).
Enhance processing speed. Hence; master will work less and more effectively.
Each task can be individually handled by members at the same time.
5.3 Micro-controller
1. Slave 1
Requirements:
o Having at least 5 analog input pins
o Time for ADC is less than sampling time (0.01s)
Hence, Atmega328P in Arduino Uno is chosen:
o Prescaler = 32, frequency = 16 ×106 Hz
4 × 32
t ADC =11 6
=0.88 ×10−4 ( s)
16 × 10
t 5 ADC =0.88 ×10−4 × 5=4.4 ×10−4 ( s)
t 5 ADC <0.01 s
Frequency of encoders:
f encoder =374 × 4=1496( Hz)
Period of encoders:
1
T encoder= =6.68 ×10−4 (s)
f encoder
xxxvi
4 ×32
T Atmega= 6
=0.08× 10−4 ( s ) <T encoder
16 ×10
3. Master
Master has to receive, process then transmit datas with I 2 c standard. Each data is stored as
one byte. The total time for all these tasks has to be less than sampling time (0.01s)
Hence, Atmega328 on Arduino Uno is chosen.
CPU clock frequency 16× 106
f SCL = = =105 ( Hz )
16+2 (TWBR ) .(PrescalerValue) 16+2 ×72 ×1
Time for master to receive or transmit one byte:
18× 1
t 1 byte= =1.8 ×10−4 ( s )
f SCL
Total time for master to receive one byte and transmit two bytes:
t 3 byte=3 ×t 1 byte =5.4 ×10−4 ( s )< 0.01(s )
xxxvii
Power supply
Sensor
CONTROL SIGNAL
ELECTRIC
CONTROLSIGNAL
SIGNAL
FEEDBACK SIGNAL
xxxviii
5. CHAPTER 6: MODELLING AND SIMULATION
.1 Kinematic model
Model of robot is described in the following figure
o MR kinematic
ẋ cosφ 0
[ ] [ ][ ]
ẏ = sinφ 0
φ̇ 0 1
v
ω
xxxix
x˙c = ẋ−dsinφ φ̇
{ ẏ c = ẏ +dcosφ φ̇
φ̇c = φ̇
[][
e 2 = −sinφ cosφ 0 y r− y c
e3 0 0 1 φr−φc ][ ]
o Error kinematics is derived
ė 1 v r cos e 3 −1 e2
[ ][ ][
ė 3 ωr 0 −1
v
ė 2 = v r sin e 3 + 0 −d−e1 ⌈ ⌉
ω ]
o Choosing the lyapunov function, reference []
v=v r cos e3 + k 1 e 1
{ω=ωr + k 2 e2 v r + k 3 sin e3
.2 Input parameters
Table 6.1 The simulation input parameter:
Parameter Value Unit
Desired velocity 𝑣 0,7 𝑚/𝑠
Sampling time 0,02 𝑠
The initial value of 𝑥 −0,002 𝑚
The initial value of 𝑦 −0,001 𝑚
The initial value of 𝜑 0,04 𝑟𝑎𝑑
Wheels’ radius 𝑟 40 𝑚𝑚
The distance between two wheels 2𝑏 150 𝑚𝑚
The distance between tracking point C and midpoint 25 𝑚𝑚
M𝑑
xl
Start
[][
e 2 = −sinφ cosφ 0 y r− y c
e3 0 0 1 φr−φc ][ ]
v, ω
v=v r cos e3 + k 1 e 1
{ω=ωr + k 2 e2 v r + k 3 sin e3
ωl, ωr
ω l/ r=(v ± b ω)/r w
xc, yc, φc
x˙c = ẋ−dsinφ φ̇
x, y, φ
{ ẏ c = ẏ +dcosφ φ̇
φ̇c = φ̇
N S ĺ S end ?
End
ẋ cosφ 0
[ ] [ ][ ]
ẏ = sinφ 0
φ̇ 0 1
v
ω
xli
.3 Result of simulation
xlii
Figure 6.4: Angular velocity of mobile robot
xliii
6. CHAPTER 7: CONCLUSION AND FURTHER DEVELOPMENT
.1 Conclusion
The simulation doesn’t meet the requirments: the maximum speed can’t fully reach 0.7 m / s,
and it still roughly varies.
The reasons are:
Tranfers function given by Identification Toolbox doesn’t match with real model.
When getting and processing signals from the sensors to using “Weighted Average”
algorithm, the returned analog signals have high noise, unstable feedback signal due to poor
condition experiment.
KP, KI, KD parameters found by matlab then following by trials and errors method was not
optimized.
.2 Further development
Suggest some methods to improve the results:
+ Determine the optimized distance d between center of Mobile robot and tracking point.
+ Determine better Kp, Ki, Kd parameters using Nichole-Ziegler methods.
+ Enhance velocity of Mobile robot.
xliv
REFERENCE
[1] Nguyen Tan Tien, 2016, Mechatronics System Design through Project – A Case Study. The 8th
Vietnam Conference on Mechatronics. Can Tho, November 2016.
[2] NATHAN. (2015). Nathan's line following robot: Suckbot. Pololu Blog. Disponivel em: <
https://www.pololu.com/blog/491/nathans-line-following-robot-suckbot>
[3] BRANDON. (2015). Brandon's line following robot: The Chariot. Pololu Blog.
Disponivel em: <https://www.pololu.com/blog/487/brandons-line-following-robot-the-chariot>.
[4] JON. (2015).Jon's line following robot: Usain Volt 2.0. Pololu Blog. Disponivel em:
<https://www.pololu.com/blog/485/jons-line-following-robot-usain-volt-2.0>.
[5] ANIKI. (2014).CartisX04. Disponivel em: <http://anikinonikki.cocolog
nifty.com/blog/2014/11/cartisx04.html>.
[6] Richard T. Vannoy II, M.S.I.T., and B.S.E.E.T. (2008). Designing and Building a
Line Following. ITT.
[7] Trịnh Chất-Lê Văn Uyển. Tính toán thiết kế hệ dẫn động cơ khí, Tập 1, Tập 2. Nhà xuất bản giáo
dục Việt Nam
[8] Ninh Đức Tốn. Dung sai và lắp ghép. Nhà xuất bản giáo dục Việt Nam.
[9] Lê Khánh Điền, (2008) Vẽ kỹ thuật cơ khí. Nhà xuất bản Đại học Quốc gia Tp.Hồ Chí Minh.
xlv