You are on page 1of 46

TRƯỜNG ĐẠI HỌC BÁCH KHOA

TP. HỒ CHÍ MINH


KHOA CƠ KHÍ

MECHATRONICS SYSTEM DESIGN


MOBILE ROBOT
Instructor: Prof. Nguyễn Tấn Tiến
Name: Lê Nam Kha 1511452
Nguyễn Đặng Hữu Trọng 1513700
Đặng Quốc Hùng 1511337
Trần Thanh Khoa 1511606
Lê Phú Khương 1511630

HCMC, June 12th năm 2018


CATEGORY
FIGURE CATEGORY........................................................................................................................................I
TABLE CATEGORY.........................................................................................................................................v
DESIGN GOALS.............................................................................................................................................1
1. CHAPTER 1: GENERAL...........................................................................................................................2
1.1. Mechanical construction............................................................................................................2
1.2. Sensor..........................................................................................................................................6
1.3. Control........................................................................................................................................8
2. CHAPTER 2: DESIGN OPTIONS............................................................................................................11
2.1 Mechanical structure................................................................................................................11
2.2 Sensor........................................................................................................................................11
2.3 Controller..................................................................................................................................11
3. CHAPTER 3: MECHANICAL DESIGN.....................................................................................................12
3.1 Wheels.......................................................................................................................................12
3.3.1 Active wheels.........................................................................................................................12
3.3.2 Passive wheels.......................................................................................................................12
3.2 Calculation to choose motors...................................................................................................12
3.3 Car designing..................................................................................................................................13
3.3.1 Height....................................................................................................................................14
3.3.2 Basic dimension of car..........................................................................................................15
4. CHAPTER 4: ELECTRICAL DESIGN........................................................................................................16
4.1 Motor, Driver:..........................................................................................................................16
4.1.1 Choosing motor.....................................................................................................................16
4.1.2 Driver.....................................................................................................................................16
4.1.3 Determining transfer function for motor and driver.........................................................17
4.2 PID control design for motor and driver................................................................................19
4.3 Sensor........................................................................................................................................20
4.3.1 Sensor module.......................................................................................................................20
4.3.2 Arranging in horizontal direction.......................................................................................21
4.3.3 Distance from sensor to ground...........................................................................................21
4.3.4 Checking distance between 2 sensors..................................................................................22

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

Figure 0.1: Race - track__________________________________________________________1


Figure 1.1: Cenkk Robot__2
Figure 1.2: Cenkk robot’s principal diagram__________________________________________2
Figure 1.3: Swarm2 robot_2
Figure 1.4: Swarm2 robot’s principal diagram:_______________________________________3
Figure 1.5: Pinto robot___3
Figure 1.6: Pinto robot’s principal diagram__________________________________________3
Figure 1.7: Pika robot ____4
Figure 1.8: Pika robot ‘s principal diagram__________________________________________4
Figure 1.9: Swbolt robot_4
Figure 1.10: Swbolt robot’s principal diagram________________________________________4
Figure 1.11: Suckbot robot___5
Figure 1.12: Suckbot robot’s principal diagram_______________________________________5
Figure 1.13: Sunfounder Robot___8
Figure 1.14: Sunfounder Robot’s principal diagram____________________________________5
Figure 1.15: OV9655__6
Figure 1.16: CMUcam5 Figure 1.17: RPI cam________________________________________6
Figure 1.18: LDR TSOP38238____6
Figure 1.19: TCRT5000 Reflectance Sensor Array (IR LED)_____________________________6
Figure 1.20: QTR-1RC____6
Figure 1.21: QTR-3RC___________________________________________________________6
Figure 1.22: QTR-8RC__________________________________________________________6
Figure 1.23: Sensor Array 6 Led, 5 Led, 4 Lede_______________________________________7
Figure 1.24: Straight line_______________________________________________________ _7
Figure 1.25: Matrix________________________________________7
Figure 1.26: Profile:∨,∧,∩,…______________________________________________________7
Figure 1.27: Comparative algorithm________________________________________________7
Figure 1.28: Approximation algorithm_______________________________________________7
Figure 1.29: Focus control________________________________________________________8
Figure 1.30: Various-level control__________________________________________________8
Figure 1.31: Example of Lyapunov controller_________________________________________8
Figure 1.32: Race-track_________________________________________________________10
Figure 2.1: Chosen principal diagram______________________________________________11
Figure 2.2: IR Sensor TCRT5000__________________________________________________11
Figure 3.1: V1 Wheel___________________________________________________________12
Figure 3.2: Ball transfer_________________________________________________________12
Figure 3.3: Moment equation_____________________________________________________12
Figure 3.4: DC servo motor GA25V1_______________________________________________13
Figure 3.5: Diagram for detemining height of center of gravity__________________________14

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

Table 1.1: Parameters of Cenkk robot_______________________________________________2


Table 1.2: Parameters of Swarm 2 Robot_____________________________________________3
Table 1.3: Parameters of Pinto Robot_______________________________________________3
Table 1.4: Prameters of Pika Robot_________________________________________________4
Table 1.5: Parameters of Bolt Robot________________________________________________4
Table 1.6: Parameters of Sukbot Robot______________________________________________5
Table 1.7: Parameters of Sunfounder Robot__________________________________________5
Table 1.8: Simple fuzzy controller__________________________________________________9
Table 2.1: Comparison of 3 types of sensor__________________________________________11
Table 4.1: Motor parameters_____________________________________________________17
Table 4.2: Experiment with driver L298 V2__________________________________________20
Table 4.3: Power supply_________________________________________________________26
Table 4.2: Experiment with driver L298 V2__________________________________________16
Table 4.2: Experiment with driver L298 V2__________________________________________16
Table 4.2: Motor and driver characteristic__________________________________________22
Table 4.2: Technique parameter of module single IR sensor_____________________________25
Table 4.3: Power supply_________________________________________________________26
Table 6.1: The simulation input parameter__________________________________________31
Table 6.2: Simulation result______________________________________________________34

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:

Table 1.1: Parameters of Cenkk Robot


L ×W × H v max v avg m ϕ mainwheel ϕ caster wheel Sensor
sensor
distance
42 ×19 Popolu
1.6 m/s 3/8 ’ ’
mm QTR-8A

 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)

Figure 1.15: QTR-3RC Figure 1.16: QTR-1RC

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.18: Sensor Array 6 Led, 5 Led, 4 Led


 Sensor arrangement:

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

Figure 1.22: Comparative algorithm


 Determine On/Off status of sensors then find out position of line follower robot from an
available value table. The feature depends on the ability to distinguish status of sensors, but
processing rate is higher because it only processes the on/off status of collected data.
 Signal is processed by approximation 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

Left Wheel Left Wheel Right Wheel


Encoder
Motor Motor Motor

Figure 1.24: Focus control


 In the decentralized control method, more than one MCU will be used in the system. In
addition to the MCU master that do the overall calculations, In some robots there’re also an
additional Slave MCU that processes encoder signals or a slave MCU to process the signal
from the sensor (RobotALF). Also, robots that use camera to detect line usually has an image
processing MCU, which then transfers the data to the master MCU. This structure reduces the
amount of computation for the master and allows the robot to perform multiple tasks
simultaneously. Decentralized structure has more complex hardware specifications, so

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

Slave 2 Master Slave 3

Driver Driver

Left Wheel Left Wheel Right Wheel


Encoder
Motor Motor Motor

Figure 1.25: Various-level control


 To the motors - SISO system, PID controller is used in most of nowadays applications.
 To the line following robot – MIMO system, 2 input ( pwm1, pwm2) & 3 output ( x G, y G, 𝜙), 2
controllers often used:
o Fuzzy controller.
o Non-linear controller Lyapunov.
 Each of them has its advantages & disadvantages, depending on the way we process the sensor
signal.
 Control aim is to minimum the racing time, there are 2 ways to do:
o Find the control law for vG & ω G to minimum the racing time.
o Fix vG =v max, Find the control law for ω G to make robot follow the line.
 Example of the simple fuzzy controller
Table 1.8: Simple fuzzy controller
Left led Middle led Right led Robot postion Control law

0 1 0 Right direction v=v r ꞷ=0


v=v r
0 0 1 Left deviation ꞷ=−d ꞷ

xiv
v=v r
1 0 0 Right deviation ꞷ=+ d ꞷ

Other Unknown v=0 ꞷ=0

 Value 𝛿𝜔 is depended on robot parameters ( v r ,b , …), determined in simulation & edit in


experiment.
 Example of Lyapunov controller

Figure 1.26: Example of Lyapunov controller


o System modelling
ė 1 v R cos e3 −1 e2

[ ][ ][
ė 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

2.1 Mechanical structure


 Robot has 3 wheels (2 front driving
wheels and 1 rear caster ball )
 Properties:
o Easy to be coplanar
o 2 front driving wheels are better for
turning.

Figure 3.28: Chosen mechanical diagram


2.2 Sensor
Table 3.9: Comparison of 3 types of sensor
Characteristics LDR IR LED Camera

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 )

Fig 4.32: Moment equation


m R2 M
 Condition for wheel not to slide: τ ≤
2 (
γ +μ
2 )
+m gR
 Power each motor supplies: P=τω

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

 Required motor parameters:


Maximum omega 238,73 rpm
Required moment 0,026 Nm
Anti-sliding moment 0,204 Nm
Power of each motor 5,75 W

 With safe coefficient, power of each motor should be: ≥ 11.5 W


 Following that parameters, choose DC servo motor GA25V1

 Calculating velocity again: v=320. .0,04=1,340 m/ s (Satisfying with chosen velocity)
60

Fig 4.33: DC servo motor GA25V1


3.3 Car designing

xx
3.2.1 Height

T

𝐹ሬ
ሬሬ
Ԧ
𝑙𝑡
𝑃ሬ
Ԧ

𝐹ሬ
ሬሬ

𝑚𝑠

Ԧ
C
𝑏/2

Fig 3.5: Diagram for detemining height of center of gravity


While:

 T : center of gravity. F lt: centrifugal force.


 F ms: friction. P: gravity force.
 C : center of spinning. h : height of T.
 To avoid flipping:

Pb
F ¿ h− ≤0
2
m v2 b
→ h−mg ≤ 0
R 2
gbr
→h≤
2 v2

While:

Gravity accelebration g=9,81 m/ s2

Width of car b=0,18 m

Radius of curvature of tracking line R=0,5 m

Maximum velocity v=1(m/s)

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 Motor, Driver:


4.1.1 Choosing motor
 Based on preceding choice: DC servo - GA25 V1

Fig 3.1: GA25V1 Motor

4.1.2 Driver
 Voltage characteristics - The velocity through the driver must be linear. Driver L298N is
chosen

Fig 3.2: L298N

 Specification of the driver:


o Main circuit: L298 - Dual Full Bridge Driver
o Input voltage: 5 ~ 30VDC
o Maximum power: 25W 1 bridge
o The maximum current for each H-bridge is 2A
o Voltage logic: Low -0.3V ~ 1.5V, High: 2.3V ~ Vss

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

Fig 3.4: Motor responding graph

 Motor and Driver Modeling:


o Find transfer function of motor and driver block.

PWM Driver+ DC
(duty cycle) motor

o Use System Identification Toolbox Matlab.

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 % .

Vref Error VOUT


PWM Driver+ DC
™ PID
(duty cycle) motor
+
-

 Use PID tuner in Matlab determine PID coefficients:


o K P=9.6191
o K I =185.99
o K D=0
The result of adding PID controller:

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

Fig 3.7: Module BFD-1000


Table 3.2: Technique parameter of module single IR sensor
Parameters Value Units
Working range 0−20 Mm
Emitter wavelength 950 nanomet
Dimension mm
Emit angle 16 degree
Detect angle 30 degree

xxvii
Typical output current 1 mA
Forward current 60 mA
Reverse voltage 5 V

4.3.2 Arranging in horizontal direction


 There are 2 ways to place the sensor: vertical and horizontal.
 When the ground under sensor is completely white, analog value returned to the
microcontroller is A1. And when the ground under sensor is completely black, analog value
is A2.
 To determine which position is more suitable, pick a sensor and let it move horizontally at
above the line from the white color to the black color and then read the analog returned to
controller. It takes a distance X d for the analog value to change from A1 to A2.
 According to the datasheet of TCRT5000, horizontal position (position 1) has the value of
X d smaller than vertical position (position 2); hence, horizontal position is better.

Fig 3.8: Vertical and horizontal position of sensor


4.3.3 Distance from sensor to ground
 Distance from the sensor to the ground (d 1 ¿should be chosen so that the returned analog
value between white ground and black line is distinctive.
 To determine h1, vertically elevate a sensor and read the returned analog values depending
on height over a white ground

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

 Specify Parameter of this sensor array:


 R1=100 Ω, R2=900 Ω
 Distance between two sensors: d=13 mm
 Use the following equation to find the calibrated analog value y jo
y max − y min
y jo = y min + ( x −x )
x max,i −x min,i ij min, i

 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 )

x2 247 2502 y jo =200+1.247 ( x j ,2 −248 )

x3 249 2949 y jo =200+1.290 ( x j ,3−245 )

x4 255 2612 y jo =200+1.236 ( x j , 4−241 )

x5 258 2490 y jo =200+1.332 ( x j ,5−237 )

 Choose the desired value: y min =200 , y max =3000


.3.6 Algorithm
 Use the “Weighted Average” algorithm

 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

 d is the distance between 2 sensors on the sensor array (mm)

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

Calculated distance (mm) 30


28.8
25 24.1
20 20.2
16.3
15

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

 Using Gradient Descent method to find the least square line:


 X= 0.8156*Y-0.009

Fig 4.14: Linear regression for training data.


.4. Power supply
Table 4.3: Power supply
Devices Current (A) Number Total
DC motor 1.1 2 2.2
ARDUINO UNO 0.15 3 0.45
ARDUINO NANO 0.15 1 0.15
SENSOR 0.2 5 1
Mạch chuyển áp 1.1 3 3.3
Driver LM298 1 2 2
 Consumption: 9.1 Ampe
 Continuing working time: 1 hour
 Hence:
o 18650 Panasonic 3.7V 3400mAh 5A battery is chosen
o 4 cells is used in serial circuit
 Module DC LM2596 is a voltage regulator circuit generates a output voltage that is less
than input voltage and always maintain this output voltage even though the input voltage
increases/ decreases.

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

Fig 4.15: Module DC LM2596.

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

5.2 Decentralized control system:


 Using decentrallizing control system

Sensor

Slave 1

Slave 2 Master Slave 3

Left Driver Right Driver

Left Motor Left Encoder Right Encoder Right Motor

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

2. Slave 2 and Slave 3


 Requirements:
o Have at least one external interrupt.
o Have at least one PWM output pin.
 Angular velocity of motors:
v 1× 2 rad
ω= =
r 0.080
=25
s ( )
=3,979(rev /s)

 Frequency of encoders:
f encoder =374 × 4=1496( Hz)

 Period of encoders:
1
T encoder= =6.68 ×10−4 (s)
f encoder

 Hence, Atmega328P in Arduino Nano is chosen:

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

12V supply 9V supply 5V supply

Sensor

Left Motor Right Motor

Left Encoder Right Encoder

CONTROL SIGNAL
ELECTRIC
CONTROLSIGNAL
SIGNAL
FEEDBACK SIGNAL

Fig5.3: Block diagram of controller system

xxxviii
5. CHAPTER 6: MODELLING AND SIMULATION

.1 Kinematic model
 Model of robot is described in the following figure

Figure 6.34:Kinematic model of robot


Convention
- C:the tracking point
- M : the midpoint of [đường nối tâm] 2 bánh xe
- R f :is the trajectory point of M (reach from sensors). [điểm cẩn tới??]
- d: distance from M wheels to C
- r: wheel radius
- b: the distance from C to 1 wheels
- ρ: the radius curvature of Rf.
- R: the instant curvature of the robot.
- v , ω: velocity and angular velocity of the robot.
- v L,ω L: velocity and angular velocity of the left wheel
- v R, ω R : velocity and angular velocity of the right wheel
T
- q=[ x y θ ] is the coordinate vector of M.
T
- q r= [ x r y r θ r ] is the coordinate vector of desired point.
T
- q C =[ x C y C θ C ] is the coordinate vector of the tracking point C.

o MR kinematic

ẋ cosφ 0

[ ] [ ][ ]
ẏ = sinφ 0
φ̇ 0 1
v
ω

o Kinematic equation of tracking point C

xxxix
x˙c = ẋ−dsinφ φ̇

{ ẏ c = ẏ +dcosφ φ̇
φ̇c = φ̇

o Define tracking error


e1 cosφ sinφ 0 x r−x 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

 Fix v=v max → e 1=0


 Assume angle deflection is small, e 3 ≈ 0

.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

Input values at the initial step i=1


Initial value

e1, e2, e3 e1 cosφ sinφ 0 x r−x c

[][
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

Figure 6.2: Simulation of mobile robot

Figure 6.3: Velocity of mobile robot

xlii
Figure 6.4: Angular velocity of mobile robot

Figure 6.5: Error 2 of mobile robot


The most important error to observed is e 2
Table 6. 2 The simulation results:
Parameter Value Unit
Average error 1,6710 𝑚𝑚
Maximum error 9,7132 𝑚𝑚

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

You might also like