HOCHIMINH CITY NATIONAL UNIVERSITY
UNIVERSITY OF TECHNOLOGY
MECHANICAL FALCUTY - DEPARTMENT OF MECHATRONICS
MECHATRONIC PROJECT
LINE FOLLOWING ROBOT
STUDENT:
INSTRUCTOR:
HOCHIMINH CITY, 2018
ACKNOWLEDGEMENT
Prima facie, I am grateful to the God for the good health and wellbeing that were necessary to complete this book.
I wish to express my sicere thanks to Dr. Võ Tường Quan, for providing me with all the necessary knowledge for the research and continuous encouragement. I am extremly thankful and indebted to him for sharing expertise, and sincere and valuable guidance and encouragement extended to me.
I take this opportunity to express gratitude to all of the Department faculty members for their help and support. I also thank my parents for the unceasin encouragement, support and attention. I am also grateful to my partner who supported me throught this venture.
Thank you all!
Table of content
ACKNOWLEDGEMENT.. i
TABLE OF TABLE.. iv
TABLE OF FIGURE.. v
CHAPTER 1: LINE FOLLOWING ROBOT OVERVIEW... 1
- ROBOT TECHNICAL REQUIREMENT.. 1
- LINE FOLLOWING ROBOT.. 2
a) DEFINITION.. 2
b) STRUCTURE.. 2
c) POPULAR MODEL.. 3
CHAPTER 2: DESIGN METHODOLOGY.. 9
- MECHANICAL DESIGN.. 9
a) CHARACTERISTIC AND REQUIREMENT:9
b) WHEEL:10
- CONTROLLER SELECTION.. 11
- SENSOR SELECTION.. 12
- PROCESSING METHOD SELECTION.. 12
- DESIGN METHOD:13
CHAPTER 3: MECHANICAL DESIGN.. 14
- WHEEL.. 14
- MOTION TRANSMISSION SYSTEM DESIGN.. 15
- FRAME DESIGN.. 16
- ROBOT CENTER OF GRAVITY.. 16
- DISTANCE FROM SENSOR TO DRIVE WHEEL AXIS. 17
- DESIGN.. 18
CHAPTER 4: ELECTRONIC SYSTEM... 20
- OVERVIEW DIAGRAM... 20
- SOURCE.. 20
CHAPTER 5: MODELLING.. 22
- MOTOR MODELING.. 22
- PID CONTROLLER DESIGN FOR MOTOR.. 24
- Left motor:24
- Right motor:25
- ROBOT KINEMATIC.. 25
- CONTROLLER DESIGN.. 27
- Sensor TCRT5000. 28
- Choosing distance from sensor to plane:29
- Choosing the number of sensor. 30
CHAPTER 6: DESIGNING AND SIMULATION.. 32
- Control algorithm.. 32
- Simulation. 36
CHAPTER 7: EXPERIMENT RESULT AND CONCLUSION.. 39
- Experiment result39
- Conclusion. 40
REFERENCES. 41
TABLE OF TABLE
Table 1. 1: Active and passive IR sensor comparison. 2
Table 1. 2: Advantages and disadvantages of models. 8
Table 2. 1: Method comparison. 9
Table 2. 2: Controller comparison. 11
Table 2. 3: Sensor comparison. 12
Table 2. 4: Choosing input signal12
Table 2. 5: Choosing signal method. 13
Table 3. 1: 25GA 370 motor. 16
Table 4. 1: Electronic device list20
Table 5. 1: Relationship of RPM and speed of left motor. 22
Table 5. 2: Relationship of RPM and speed of right motor. 23
Table 5. 3: Sensor response to distance. 31
Table 5. 4: Response of sensors after Calibration. 31
Table 6. 1: Model specification. 36
TABLE OF FIGURE
Fig 1. 1: Assignment map. 1
Fig 1. 2: Simple line following robot by PlaywithRobots [2]. 3
Fig 1. 3: Sample Bi-color path [3]. 4
Fig 1. 4: Bi-color path following robot by Mehtap KÖSE ULUKÖK [4]. 4
Fig 1. 5: Line following robot with Arduino by Mati_DIY [4]. 5
Fig 1. 6: Line following robot by Pantech Solution [5]. 5
Fig 1. 7: Line Follower Robot using PIC Microcontroller [6]. 6
Fig 1. 8: Fuzzy line following NXT Robot [7]. 6
Fig 3. 1: Robot wheel14
Fig 3. 2: Diagraph of force act on robot wheel15
Fig 3. 3: Diagraph of motor when turning. 17
Fig 3. 4: Diagram of robot when turn. 17
Fig 3. 5: Robot schematic diagram.. 18
Fig 3. 6: Frame design on Solidwork. 19
Fig 3. 7: Frame dissemble. 19
Fig 3. 8: Full 3D design on Solidwork. 19
Fig 4. 1: Overview diagram.. 20
Fig 5. 1: Chart of RPM and speed of left motor. 22
Fig 5. 2: Chart of response by time of driver – left motor block. 22
Fig 5. 3: Chart of RPM and speed of right motor. 23
Fig 5. 4: Chart of response by time of driver – right motor block. 24
Fig 5. 5: Robot frame in 2 dimensions. 25
Fig 5. 6: Distance of sensor experiment29
Fig 5. 7: Distribution of signal value by distance. 29
Fig 5. 8: Experiment to measure response of sensors. 30
Fig 5. 9: Function of sensors error depend on distance. 32
Fig 6. 1: Primary diagram.. 34
Fig 6. 2: Minor diagram.. 35
Fig 6. 3: Simulation position of robot on matlab. 36
Fig 6. 4: Simulate error 2 on Matlab. 37
Fig 6. 5: Simulate velocity of 2 wheels on Matlab. 37
Fig 7. 1: Experimental39
Fig 7. 2: Error feedback on G – A – C section. 39
Fig 7. 3: Error feedback on D – E – F – G section. 40
CHAPTER 1: LINE FOLLOWING ROBOT OVERVIEW
I. ROBOT TECHNICAL REQUIREMENT
- Minimal speed: 0.2m/s
- Carry 2kg rectangular load with maximum dimension (length x width x height): 200mm x 100mm x 300mm.
- Number of wheels: optional
- Robot equipped with sensor system to recognize and follow line. Chose suitable sensor.
Binding conditions:
- Wheel diameter: d < 200mm
- Robot maximum dimension (length x width x height): 300mm x 220mm x 300mm.
- Line color: black
- Background color: white
- Line width: 26mm
- Terrain: even surface
Line model:
- Robot follow sequel written on model:
Fig 1. 1: Assignment map
II. LINE FOLLOWING ROBOT
a) DEFINITION
Line following robot is autonomous robot operating itself to detect and follow the desired path. The path is designed randomly with various material, it could be visible by using white or color tapes, and invisible by using magnetic field. However base on the reasonable cost, in this case we just consider visible path. The controller help robot sensing and keeping in track with the path and eliminate the wrong move by the feedback system.
b) STRUCTURE
i. Sensor
The most common type of sensor using for line detector is Infrared Ray sensor, divided into active and passive type.
Table 1. 1: Active and passive IR sensor comparison
Active IR(Infrared) Sensor |
Passive IR(Infrared) Sensor |
These sensors are self-illuminating type. |
These sensors are not self-illuminating type. |
They can directly measure range and velocity of targets. |
They have problems in measurement of these two parameters. |
They can function effectively in day, dark and with cold target type. |
They cannot function dark as well as with cold target. |
These are intercepted and located easily by enemy detection system. |
These are not easily intercepted and located by enemy sensors. |
They are small and light EM sensor. |
They are small and light EM sensor. |
They are cheap. |
They are cheap. |
Detection as well as measurements of targets are inferior to the radars. |
Detection as well as measurements of targets are inferior to the radars. |
Infrared released is collected by receiver. The brighter the surface is, the more infrared could be received. However, the working distance is closed, must be 2 – 10 mm.
ii. Controller and processor
The controller and processor will collect the data from IR sensors, together with formulas, then generate signal to driver to keep the movement under-control.
However, in some model, the controller may be not necessary, relay, in this case, takes responsibility to processing.
iii. Driver
The Robot commonly uses motor for its movement. Therefore, driver is needed to receive the signal from controller then convert it into pulse and voltage to actuator.
The most common type of driver is L298 (Bridge circuit).
iv. Actuator
There are many ways to build an actuator for robot, such as, wheel or tank system. Wheel with gearbox is the most common movement system because of reasonable price and easy control. Gearbox will help to maintain the constant speed even when robot go in slope (critical angle slope is not concerned
Common DC motor 12V is enough torque for small robot.
v. Body structure
The appearance of line following robot, thought, is various, 2 main driving motor and 1 multi-direction wheel is considered as the most famous. As this design is easy to build and control.
The material of case is usually acrylic sheet, PE foam, or light wood. They are popular for being hard enough and light as well as not hard to get in desired form
c) POPULAR MODEL
i. Simple line following robot by Playwithrobot
Fig 1. 2: Simple line following robot by PlaywithRobots [2]
This must be the simplest robot, since two transistor are used as processor instead of micro-controller. If the left IR sensor get the signal of line, transistor let the current go to right wheel and so on.
Because of too simplest, this design is easy to get stuck in error and moves out of path. Moreover, it cannot perform more complicated movement such as map solving.
ii.
Bi-color path following robot by Mehtap KÖSE ULUKÖK
Fig 1. 3: Sample Bi-color path [3]
Fig 1. 4: Bi-color path following robot by Mehtap KÖSE ULUKÖK [4]
For the model of KÖSE ULUKÖK, he introduce 4 algorithms to control the line following robot by using binary signal and 2 of them could make the robot keep in track even when color being changed. About one of the successful code, it includes 2 condition for each direction movement, for example, all 3 sensors were checked, the “turn left direction” was made whether ((Left or Center) and (Right or Left)) sensor was on.
In general, this model is quite simple to generate and operate but disadvantages still appear when it has only one constant setting speed.
iii. Line following robot with Arduino by Mati_DIY
0 |
Fig 1. 5: Line following robot with Arduino by Mati_DIY [4]
This model won the 1st price for being the fastest line following robot in National contest
Its key for getting the high speed is reducing the mass as much as possible. The suitable motor, besides it, also the vital point, and in this case, Pololu metal gearbox motor is chosen.
The PD (proportional and derivative) controller is used for optimizing the movement correction and push up the response.
So in conclusion, PD controller is the most important for line following robot. Integral controller is not used for this kind of robot thus integration is summing all historic error.
In my opinion, PID controller must be the most efficient and cutting-edge method to control this type of robot
iv. Line following robot by Pantech Solution
Fig 1. 6: Line following robot by Pantech Solution [5]
For this device, input signal from IR sensor is sent to Arduino which decides what change (if any) needs to be made to the robots speed and direction. Convert the results of any decisions made into something that can be sent to motor speed control and/or steering.
The differences are their way of processing signal, by setting the reference and comparing with each IR sensor signal. The comparison helps to modified speed and acceleration more easily
v. Line Follower Robot using PIC Microcontroller
Fig 1. 7: Line Follower Robot using PIC Microcontroller [6]
In this project, instead of using Arduino, PIC16F877a is used for its advantages. PIC is better than Arduino in the speed of processing and endurance. 2 IR sensor are used to simplify the model and information processing, but, vibration is considerable.
vi. Fuzzy Line Following NXT Robot
Fig 1. 8: Fuzzy line following NXT Robot [7]
The idea behind the new version is, not only to distinguish between black and white, but to consider various degrees of grey. If the sensor is exactly on the boundary, it will see a colour that is between black and white. The more the sensor gets on the line, the blacker the perceived colour is. On the other hand, the more the sensor gets on the white surface, the whiter the perceived colour is. This is called Fuzzy Logic as we do not consider absolute states (Boolean Logic, here "Black and White") but different degrees of those states (Whiter, Blacker).
Now we are not limited anymore to turn only left and right, but can turn more right (blacker colour) or more left (whiter colour). In this way, if exactly on the colour boundary, the robot runs straight ahead.
To produce the motor commands as described in the schema, the following calculations have to be done:
- A_Power=(Sensor_Value-Black_Value)*Speed_Factor
- B_Power=(White_Value-Sensor_Value)*Speed_Factor
vii. Personal remarks for these model
Table 1. 2: Advantages and disadvantages of models
Name of model |
Advantages |
Disadvantages |
Simple line following robot by Playwithrobot |
Simple idea to control Not need coding and MCU Cheap |
Fluctuate alot Not handle complicated cases like intersection |
Bi-color path following robot by Mehtap KÖSE ULUKÖK |
Innovation of simple line following robot Still work when changing the map and line color |
Only 1 constant speed Cannot deal with critical curve |
Line following robot with Arduino by Mati_DIY |
Up-to-date method Error elimination quickly and correctly Smooth movement |
Complicated PID coefficient choosing Different design needs different coefficient Calculation requirement |
Line following robot by Pantech Solution |
Smooth movement Can adapt with many type of path Modified speed easily by changing the reference speed
|
Difference reference speed give difference movement Cannot follow the path well when speed too high
|
Line Follower Robot using PIC Microcontroller |
Quick response PIC processes signal faster than Arduino Endurance Simple model Quite small compare to the other |
Vibration is considerable Coding more complicated compare to Arduino
|
Fuzzy Line Following NXT Robot |
Cutting-edge method Not depend on the environment light condition by using active IR sensor More accuracy by using Fuzzy method |
Expensive for that model More power for sensor Cannot deal with unclear path Vibration still happens |
CHAPTER 2: DESIGN METHODOLOGY
I. MECHANICAL DESIGN
a) CHARACTERISTIC AND REQUIREMENT:
- Move in even surface.
- Carry 2kg load.
- Follow continuous line with junction and 90 degree turn.
- Minimum speed: 20cm/s
Table 2. 1: Method comparison
Method |
Description |
Strength |
Weakness |
Differential drive with free wheel in the front |
Two coaxial drive rolling wheels with one free support wheer in the front.
[8] |
-Three wheels always coplanar and contact with ground. -Simple mechanical design, cheap -Maneuverable |
-Small external force can lead robot away from the line. -Heavy load under hard turn can cause flip |
Differential drive with free wheel in the back |
Two coaxial drive rolling wheels with one free support wheer in the back. [9] |
-Three wheels always coplanar and contact with ground. -Simple mechanical design, cheap -External force is hard to push away the line. -Maneuverable |
-Heavy load under hard turn can cause flip -Unable to respond fast enough under high velocity. |
Tricycle |
Three wheels and odometers on the two rear wheels .Steering and power are provided through the front wheel [10] |
-Three wheels always coplanar and contact with ground. -Simple mechanical design |
-Unmaneuverable. Need a large turn curvature. -Heavy load under hard turn can cause flip
|
Omnidireccional |
Use 3 or more omni wheel. Each combination of direction and velocity of wheels can lead to independent movement of robot [11] |
-Very maneuverable. Can move in all direction and curve |
-Complex mechanical design -Expensive -Complex control |
Conclusion: choosing differential drive with free wheel in the front because of its advantages over of Simple mechanical design, cheap but still remain enough maneuverable ability |
b) WHEEL:
a. Drive wheel:
Requirement:
- Good friction coefficient
- Diameter smaller than 200mm
- Roll in even surface.
- Bear 2kg load.
Design methodology: 3d printed wheel with smooth tire and 42mm in diameter.
a. Driven wheel:
Requirement:
- Small
- Good guiding ability
- Roll in even surface.
- Fast respond in sharp turn
- Bear 2kg load.
Design methodology: Metal caster wheel
II. CONTROLLER SELECTION
Table 2. 2: Controller comparison
Method |
Description |
Strength |
Weakness |
No controller |
The model will use no controller, another method like transistor is required |
- Easy to operate - Cheapest
|
- Cannot solve complicated cases or cases that require fast responding. - Unreliable |
Micro-control unit |
MCU is a device using clock pulse to process electric signal and mathematical calculation |
- Can process complex equation - Require small space |
- Discrete time system - Require complex algorithm to operate without bug |
Conclusion: kit STM32F103C8T6 with ARM 32bit core is chosen for it high processing frequency ( 76Mhz ), provide ADC for reading sensor value, pwm pin for motor control, communication port for transferring data to other MCU and computer |
III. SENSOR SELECTION
Table 2. 3: Sensor comparison
Method |
Description |
Strength |
Weakness |
Passive IR sensor |
This sensor using passive infrared light from surround environment to work, signal then will be amplified |
-Easy to operate -Do not need infrared generator -Far distance |
-Disturbance a lot -Only can sense infrared line
|
Active IR sensor |
This sensor have on board infrared LED to shine surround environment, then the reflection of infrared light will be used like passive IR sensor |
-Sense any type of colored line -High efficiency -Both analog and digital signal |
-Close working distance (2-5cm)
|
Conclusion: For study project, active IR sensor is consider to be the best since the affect of noise and disturbance from surround environment is smaller than passive IR sensor. In practice, line have high contrast of black and white, so the active IR sensor work best in this case. |
IV. PROCESSING METHOD SELECTION
Choosing input signal
Table 2. 4: Choosing input signal
Method |
Description |
Strength |
Weakness |
Digital |
The input signal is 0 or 1 |
-Easy to processing -Eliminate error |
-Not clear boundary -Not enough information |
Analog |
For IR sensor, range of input signal from 0 to 1024 |
-Vast boundary -Numerous data |
-Disturbance -Information needed to processing carefully |
Conclusion: choosing analog signal because of its advantages of having vast boundary of data |
Table 2. 5: Choosing signal method
Method |
Description |
Strength |
Weakness |
Simple comparison method |
Comparison of signal from left and right decide one wheel stop and other go with reference speed |
-Simplest method -Easy coding -Constant speed |
-Cannot solve complicated problem -Vibration |
Reference speed |
Using sum of reference speed and input signal with suitable coeficient |
-Keep moving when meeting gap -Reduce vibration |
-Cannot handle critical curve -Suitable speed need |
PID method |
Using PID coeficient to process the signal data by considering the respond’s error, add up error and the change in error.
|
-Smooth movement -Solve most of situation with suitable coefficient -Speed can be modified easily |
-Calculation requirement -Knowledge of PID controller -Difficulty in choosing coefficient and reference speed |
Conclusion: Choosing PID method because of plenty of time and productive movement. However, calculation need to consider carefully and checked by experiment. |
V. DESIGN METHOD:
Chosen design method:
- Principle diagram: 3 wheels robot with 2 drive wheels and 1 driven wheel on the front.
- Sensor: include 4 active infrared sensors.
- Motor: DC motor with encoder.
- Control structure: centralized control.
- Control method: PID controller for each wheel.
CHAPTER 3: MECHANICAL DESIGN
Base on overview chapter and option selection chapter, this chapter represent the design of motion transmission system and frame
Desired target :
- Velocity : ~ 0,3m/s
- Acceleration: 1m/s2
- Robot will move on leveled terrain
I. WHEEL
1) Drive wheel:
- Design and 3d print drive wheel to be able to archive desired velocity and dimension.
- Technical aspect:
- Diameter: 42mm
- Width: 15mm
- Rod diameter: 4mm
- Material : PLA plastic
Fig 3. 1: Robot wheel
2) DRIVEN WHEEL:
- Driven wheel chose carter wheel to prevent shopping-cart symptom
Ball caster wheel need to be strong enough to bear 2kg load.
Chose metal ball caster wheel with parameter:
- Fixed hole: 4mm
- Center Distance to Fixed holes: 40mm
- Ball body height: 20mm
- Ball protruding height: 4mm
- Maximum load: 5KG
- Ball diameter: 15mm
- Weight: 37g
II. MOTION TRANSMISSION SYSTEM DESIGN
3) Design and chose driving motor and wheel:
Since robot move on leveled terrain, there is not any sudden load or incline. Motor must have enough power to overcome linear inertial of the robot body and load, moment of inertial of wheel and static friction.
Fig 3. 2: Diagraph of force act on robot wheel
Moment of inertial of wheel:
(3.1)
Momentum equilibrium at the center of wheel:
With condition of rolling without sliding:
(3.2)
- Since gravity transfer evenly through two wheel
- Robot’s weight ( include load ): M = 3kg
- Wheel’s weight: 0,025kg
- Friction coefficient ( rubber and paper ): µ = 0,7
- Wheel radius: R = 21mm
- Acceleration: a = 1m/s2
- Gravity acceleration: g = 9,81m/s2
Required moment, from equation (3.2):
= 0,219 Nm
Factor of safety = 1,2:
Power: P = 1,2.0,219. =12,5 W
Required motor speed:
- v : velocity of robot
- s : diameter of wheel
ðW = 30/12,566 = 2,387 rps = 143,24 rpm
Chose motor:
25GA 370 motor is chosen with characteristic:
Table 3. 1: 25GA 370 motor
Rated voltage |
6~18VDC |
|
Rated power |
13,2W |
|
Speed |
200 rpm |
|
No load current |
50mA |
|
Load current |
600mA |
|
Stall current |
1,2A |
|
Dimension |
Diameter |
25mm |
Length |
52mm |
III. FRAME DESIGN
1. ROBOT CENTER OF GRAVITY
At turning point, robot can be flipped when center of gravity is too high. To prevent this, moment of gravity at outer wheel contact point must be larger than moment of centrifugal force.
Fig 3. 3: Diagraph of motor when turning
(3.3)
Robot’s center of gravity distance from ground h < 4,6m
2. DISTANCE FROM SENSOR TO DRIVE WHEEL AXIS
Fig 3. 4: Diagram of robot when turn
Base on geometric relation we can calculate:
(3.4)
With:
- Line following error estimated: e < 20mm
- Curve radius: r = 500mm
- Distance from sensor to drive axis: d
(3.5)
Chose d = 120mm.
3. DESIGN
Fig 3. 5: Robot schematic diagram
Approximate dimension of robot is show in Fig 3.5:
- Total length of robot:
- Distance between drive wheel and sensor:
- Distance between drive wheel and driven wheel:
- Diameter of wheel:
- Distance between center of gravity of load with ground:
- Material: PLA plastic is chosen base on characteristic:
- Strong enough to withstand load and impact.
o Elastic Modulus: 3,5 GPa
o Shear Modulus: 2,4 GPa
o Tensile Strength: 50 MPa
- Easy to manufacture using 3d printer
- Inexpensive
- Structure:
- Frame consist of upper frame and lower frame connected by M3 bolt
- Upper frame has a thickness of 8mm since it holds and transfer load to 3 wheel. Lower frame has a thickness of 2mm since it only act as a mount plate for internal component
Fig 3. 6: Frame design on Solidwork
Fig 3. 7: Frame dissemble
- Mechanical fully designed on Solidwork:
Fig 3. 8: Full 3D design on Solidwork
CHAPTER 4: ELECTRONIC SYSTEM
In this chapter, based on previous choice in chapter 2, we will chose driver and source circuit.
Table 4. 1: Electronic device list
Device |
Number |
Current |
Voltage |
Total |
Motor |
2 |
600mA |
12V |
1,2A – 12V |
Sensor |
4 |
40mA |
5V |
160mA – 5V |
Driver |
1 |
5mA |
5V |
5mA – 5V |
Stm32f103c |
1 |
80mA |
3,3V |
80mA – 3,3V |
Total |
1,2A – 12V 165mA – 5V 80mA – 3,3V |
I. OVERVIEW DIAGRAM
Fig 4. 1: Overview diagram
II. SOURCE
Requirement: supply enough current and voltage in operation.
Battery: 18650 rechargeable battery
- Rated voltage: 3,7V
- Peak voltage: 4,2V
- Supply current: 2A
- Number: 4, wired in serial
Voltage regulator:
- 5V regulator: using LM2596 regulator.
Input voltage |
Output voltage |
Current |
8V – 40V |
4,7V – 5,2V |
Max 3A |
- 3,3V regulator: using ASM1117 regulator.
Input voltage |
Output voltage |
Current |
5V – 7V |
3,1V – 3,5V |
Max 800mA |
Driver:
- Requirement:
- Peak current larger than peak current of motor ( 1,2A )
- Can handle PWM frequency of MCU
- L298 is chosen with characteristic:
- 2 dual H-bridge
- Supply voltage: 5V – 36V
- Logic voltage: 5V – 7V
- Peak current: 2A for each bridge.
CHAPTER 5: MODELLING
I. MOTOR MODELING
Test driver L298 and left motor:
Table 5. 1: Relationship of RPM and speed of left motor
PWM |
20% |
30% |
40% |
50% |
60% |
70% |
80% |
90% |
100% |
RPM |
41,35 |
58,58 |
84,26 |
103,06 |
130,07 |
151,68 |
163,92 |
184,07 |
202,24 |
Fig 5. 1: Chart of RPM and speed of left motor
Base on table 5.1 and figure 5.1, we can conclude that relationship between PWM and speed is linear.
Chose controlling range between 10% - 100% PWM.
Base on respond of motor – driver block with time, Transfer function of them is approximated by considering that system is first order system. Using system identification toolbox in MATLAB:
Fig 5. 2: Chart of response by time of driver – left motor block
(tsample = 0,01(s), PWM = 100%, period: 2,5s)
with fh < 42Hz, take fs = 100Hz
chose
Respond time of block: 0,25s
Transfer function of driver – left motor block is :
(5.1)
Doing the same with driver – right motor block:
Table 5. 2: Relationship of RPM and speed of right motor
PWM |
20% |
30% |
40% |
50% |
60% |
70% |
80% |
90% |
100% |
RPM |
34,861 |
51,86 |
78,36 |
97,07 |
122,42 |
143,69 |
163,61 |
178,72 |
198,92 |
Fig 5. 3: Chart of RPM and speed of right motor
Base on table 5.2 and figure 5.2, we can conclude that relationship between PWM and speed is linear.
Chose controlling range between 10% - 100% PWM.
Base on respond of motor – driver block with time, transfer function of them is approximated by considering that system is first order system. Using system identification toolbox in MATLAB:
Fig 5. 4: Chart of response by time of driver – right motor block
(tsample = 0,01(s),PWM = 100%, period: 2,5s)
with fh < 42Hz, take fs = 100Hz
chose
Respond time of block: 0,3s
Transfer function of driver – left motor block is :
(5.2)
II. PID CONTROLLER DESIGN FOR MOTOR
1. Left motor:
Controller criteria:
- Settling time: Ts < 0,2s
- Steady state error: ess < 5%
- Overshoot: M < 10%
Base on modeled PID controller on MATLAB, combine with tuning pid gain in practice. PID gain that is used is:
Kp = 0,35; Ki = 0,006; Kd = 0,024
Respond characteristic:
- Settling time: Ts = 0,12s
- Steady state error: ess = 7%
- Overshoot: M = 6%
2. Right motor:
Controller criteria:
- Settling time: Ts < 0,2s
- Steady state error: ess < 5%
- Overshoot: M < 10%
Base on modeled PID controller on MATLAB, combine with tuning pid gain in practice. PID gain that is used is:
Kp = 0,36; Ki = 0,006; Kd = 0,02
Respond characteristic:
- Settling time: Ts = 0,12s
- Steady state error: ess = 7%
- Overshoot: M = 6%
III. ROBOT KINEMATIC
To control the position of robot in 2 dimension (since our robot only move on plane ground, not go up or down any latitude) we need to develop kinematic of robot.
C |
D |
E2 |
E1
|
G |
E3 |
Fig 5. 5: Robot frame in 2 dimensions
Note:
D: midpoint between drive wheels
G: tracking point
C: reference point of robot
Kinematic equation at D:
With:
Robot velocity:
(5.3)
Robot angular:
(5.4)
With:
- : right wheel and left wheel angular velocity, accordingly
- : wheel diameter
- : distance between 2 wheels
Kinematic equation at tracking point C:
(5.5)
With d is the width between center of line connect 2 driving wheel to point C
Kinematic of reference point G:
(5.6)
With is desired velocity of robot
Controller is designed for point C to follow tracking point G, Error of system is calculated by:
(5.7)
Or
So
(5.8)
IV. CONTROLLER DESIGN
Chose Lyapunov equation:
(5.9)
With k2 > 0
The rate of change of V :
Let:
From that:
With , because of control characteristic, and have the same sign.
We have
That mean system will be stable and error will converge to 0 when t => infinity
In practice: error e1 is unmeasurable and considered to be d, e2 can be measured directly from set of sensor, e3 can be calculated through equation:
However, when experimenting with the robot, the appearance of e3 under above equation make the robot unstable and direct calculate e3 using two set of sensor is imposible.
So we neglect e1 and e3, new Lyapunov equation will be:
Chose , so that
New controller is now a proportional controller with gain kp
V. Sensor TCRT5000
- Package type: leaded
- Detector type: phototransistor
- Dimensions (L x W x H in mm): 10,2 x 5,8 x 7
- Peak operating distance: 2,5 mm
- Operating range within > 20 % relative collector
current: 0,2 mm to 15 mm
- Typical output current under test: IC = 1 mA
- Daylight blocking filter
- Emitter wavelength: 950 nm
- Lead (Pb)-free soldering released
- Compliant to RoHS directive 2002/95/EC and in accordance to WEEE 2002/96/EC
Purpose:
- Find number of sensor
- Find distance from sensor to plane
- Response of sensor depending on angle
1. Choosing distance from sensor to plane:
Set up simple experience to measure the dependence of signal to distance:
Fig 5. 6: Distance of sensor experiment
By changing distance between sensor and plane from 3mm to 20mm we get data of signal:
Fig 5. 7: Distribution of signal value by distance
Due to graph, the space between sensors and the line should in range of 7 to 15mm, if less than this range, the value of blackline is not large enough for comparison, and the distance larger than 15mm may take the sensors out of their working environment.
So we choose the distance is 7mm for minimize the effect of noise on signal
2. Choosing the number of sensor
Assume that for t = 0,001, the car can move
(5.10)
The distance between 2 sensors should larger than 26mm so it can prevent disturbance
Critical angle we can assume it to be 10o
(5.11)
With L is the distance between 2 end-sensors, w = 26mm (line width)
Choose L = 80mm
With distance between sensors is 25mm
ðWe need 4 sensor
ðThe distance between sensors is 27mm
Response of sensors by distance
Fig 5. 8: Experiment to measure response of sensors
By setting the experiment, we can observe the response of sensor group by changing the distance with the center of 2 wheels.
Using the equation of error:
(5.12)
Table 5. 3: Sensor response to distance
distance |
sensor1 |
sensor2 |
sensor3 |
sensor4 |
Coefficient |
Error |
-16 |
57 |
63 |
67 |
746 |
2 |
-1382 |
-12 |
52 |
60 |
70 |
497 |
2 |
-900 |
-8 |
51 |
62 |
593 |
74 |
2 |
-577 |
-4 |
54 |
55 |
510 |
57 |
2 |
-461 |
0 |
51 |
59 |
59 |
55 |
2 |
-8 |
4 |
51 |
557 |
52 |
54 |
2 |
499 |
8 |
53 |
638 |
54 |
56 |
2 |
578 |
12 |
570 |
55 |
54 |
57 |
2 |
1027 |
16 |
498 |
54 |
54 |
57 |
2 |
882 |
However, the data of each sensor is not in the same range. Therefore we need to calibrate to get the same range of all sensor.
By using the formula:
(5.13)
After calibration, we get the map response
Table 5. 4: Response of sensors after Calibration
distance |
sensor1 |
sensor2 |
sensor3 |
sensor4 |
Coefficient |
Error |
-16 |
1,156069 |
1,541096 |
2,772643 |
100 |
2 |
-198,919 |
-12 |
0,192678 |
1,027397 |
3,327172 |
64,01734 |
2 |
-129,949 |
-8 |
0 |
1,369863 |
100 |
2,890173 |
2 |
-104,41 |
-4 |
0,578035 |
0,171233 |
84,65804 |
0,433526 |
2 |
-84,1978 |
0 |
0 |
0,856164 |
1,2939 |
0,144509 |
2 |
-0,72675 |
4 |
0 |
86,13014 |
0 |
0 |
2 |
86,13014 |
8 |
0,385356 |
100 |
0,369686 |
0,289017 |
2 |
99,82299 |
12 |
100 |
0,171233 |
0,369686 |
0,433526 |
2 |
198,9345 |
16 |
86,12717 |
0 |
0,369686 |
0,433526 |
2 |
171,0176 |
We get the equation for sensors depend on the distance:
(5.14)
Fig 5. 9: Function of sensors error depend on distance
CHAPTER 6: DESIGNING AND SIMULATION
I. Control algorithm
Base on the given map, we get 3 states of robot:
- Follow the line
- Go straight through intersection
- Turn left at the intersection
- Case 1: Robot follow the line base on PID method
Applying for AB – BC; CD – DE; EF – FC; CG – GA
Velocity of 2 wheels are different and defined by PID formula
PID = (Kp*error) + (Ki*I) + (Kd*D)
left_speed = int_speed + PID;
right_speed = int_speed – PID
- Case 2: Robot go straight through intersection
Applying for BC – CD; FC – FG; AC – CE
By keep both velocities of 2 wheels be the same, the robot can go through intersection before get out of the node
- Case 3: Robot turn left at the intersection
Applying for GA – AC
Keep the velocity of right wheel maintain and reduce the left one to 0
After get over the intersection, the velocities are again calculated by PID method
Fig 6. 1: Primary diagram
Fig 6. 2: Minor diagram
II. Simulation
We applied these initial parameters to simulate the process of the robot:
Table 6. 1: Model specification
Parameters |
Value |
Unit |
Radius of active wheel |
42 |
mm |
Radius of curvature |
500 |
mm |
Distance between the center's sensor and to the middle of 2 wheels |
128 |
mm |
Distance between 2 wheels |
178 |
mm |
Reference velocity |
0,3 |
mm |
Sampling time reference |
0,001 |
s |
Note: The value error 2 depend on the parameter [k1 k2 k3] which is choose. This simulation is run with [k1 k2 k3] is [0 2 0].
Fig 6. 3: Simulation position of robot on matlab
Note: The red line is reference line; the blue line is position of the robot.
Fig 6. 4: Simulate error 2 on Matlab
Fig 6. 5: Simulate velocity of 2 wheels on Matlab
Note: The red line is right wheel; the blue line is left wheel.
In ABC segment, the highest value of error 2 is located at B because robot change direction suddenly. As we can see, at the other 3 corners, there are the same situations as position B.
At the end of process, there is a dramatic increase in the value of error 2 when the robot turns back to A point end go straight ahead to the finish point. The reason for this problem is the GAC corner, which is nearly right angle, the robot drifts too fast. However, the number of error 2 gradually stabilize in the last straight segment
CHAPTER 7: EXPERIMENT RESULT AND CONCLUSION
I. Experiment result
Base on the error data collect from robot,
Fig 7. 1: Experimental
On G – A – C section:
Fig 7. 2: Error feedback on G – A – C section
Through the curve G – A, the value of sensor slightly fluctuates, but still remain around 0,
At the intersection A, due to algorithm, the robot still follows the given map.
On D – E – F – C – G section:
Fig 7. 3: Error feedback on D – E – F – G section
II. Conclusion
The robot can response and follow the given map at 0,3m/s robustly
Robot work best around 0,3m/s with small fluctuation, error 2 is biggest at intersection
At 0,4m/s robot fluctuate a lot and unable to make 90 degree turn,
At 0,5m/s robot unable to follow line at curve.
Our conclusion is that the controller is only a proportional gain, not suitable for high speed controlling with high demain.
ð Simulation and practice are far different since controller that work for simulation is not applicable and controller parameter that is tuned in practice don’t work in simulation.
REFERENCES
[1] (2017, March 20), Motor Driver Module-L298N. Retrieved from: “http://wiki.sunfounder.cc/index.php?title=Motor_Driver_Module-L298N”
[2] (2012, May 14), Simple Line Follower robot. Retrieved from: “http://playwithrobots.com/simple-line-follower-robot/”
[3] ULUKÖK, K. M., (2016, May 19 – 22), SIMPLE AND EFFICIENT BI - COLOR PATH FOLLOWING ROBOT CONTROL ALGORITHM TEACHING IN ELECTRICAL ENGINEERING EDUCATION, The Eurasia Proceedings of Educational & Social Sciences (EPESS)
[4] Mati_DIY, Line Follower Robot With Arduino - Very Fast and Very Simple, Retrieved from: “https://www.instructables.com/id/Line-Follower-Robot-With-Arduino-Really-Fast-and-R/”
[5] Line follower Robot. Retrieved from: “https://www.pantechsolutions.net/robotics-projects/line-follower-robot”
[6] Aswinth, R., (2017, October 22), Line Follower Robot using PIC Microcontroller. Retrieved from: “https://circuitdigest.com/microcontroller-projects/line-follower-robot-using-pic16f877a”
[7] Stefan, B., Fuzzy Line Following NXT Robot. Retrieved from: “http://stefans-robots.net/en/fuzzy-line-follwing-nxt-robot.php”
[8] PROGRAMMING - DIFFERENTIAL DRIVE. Retrieved from: "https://www.societyofrobots.com/programming_differentialdrive.shtml"
[9] Wheel Control Theory, Retrieved from: “http://www.robotplatform.com/knowledge/Classification_of_Robots/wheel_control_theory.html”
[10] Wang, C.; Liu, X.; Yang, X.; Hu, F.; Jiang, A.; Yang, C. Trajectory Tracking of an Omni-Directional Wheeled Mobile Robot Using a Model Predictive Control Strategy. Appl. Sci. 2018, 8, 231.
[11] https://hshop.vn