0% found this document useful (0 votes)
15 views81 pages

Color Distinguish Robot Project Report

sdbxfcbv

Uploaded by

phanmquan2004
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views81 pages

Color Distinguish Robot Project Report

sdbxfcbv

Uploaded by

phanmquan2004
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

HO CHI MINH UNIVERSITY OF TECHNOLOGY

OFFICE FOR INTERNATIONAL STUDY PROGRAMS

MECHATRONICS SYSTEM DESIGN PROJECT


Project topic:

COLOR DISTINGUISH ROBOT FOR LINE FOLLOWERS


CLASS: CC02 – Semester 231

Instructor: [Link]ễn Tấn Tiến

Name Student’s ID

Lê Tiến Đạt 2052438

Nguyễn Trung Đức 2052451

Hồ Lê Khánh Dy 2052431

Phan Hoàng Duy 2052426

HCMC – 10th September 2023


ACKNOWLEDGEMENT
Throughout the making of this project, our group have gained much knowledge and
information related to our major and we have also known how to perform a project follow the
procedure of design a mechatronics system.
Our group would like to express our gratefulness to Assoc. Prof. Nguyễn Tấn Tiến for
advising and guiding our group to finish this project through this semester. The knowledge
that we have learn gives us many experiences for each of our group members so that we could
continue to improve ourself for the future.
Throughout this project, we have researched through the documents and also applied our
knowledge to finish this report. However, this report may have some shortcomings and limit.
Therefore, our group is looking forward to receive the comments and feedbacks from the
council.
Sincerely!
TABLE OF CONTENT
ACKNOWLEDGEMENT......................................................................................................2
TABLE OF CONTENT.........................................................................................................3
LIST OF FIGURES................................................................................................................5
LIST OF TABLES.................................................................................................................7
PROJECT TOPIC ANALYZE...............................................................................................8
CHAPTER 1. OVERVIEW...........................................................................................10
1. Introduction...................................................................................................................10
1.1. Definition line following robot............................................................................10
1.2. Steering control types of LFR..............................................................................10
2. Mechanical specification...............................................................................................10
2.1. MK ROBOT UGV...............................................................................................10
2.2. MP-500................................................................................................................11
2.3. Pioneer 3 –AT......................................................................................................12
3. Electronic specification.................................................................................................12
3.1. Power source........................................................................................................13
3.2. Microcontroller....................................................................................................13
3.3. Actuator...............................................................................................................14
3.4. Sensors.................................................................................................................14
4. Line tracking algorithm.................................................................................................17
4.1. Comparative algorithm:.......................................................................................17
4.2. Approximation algorithm:...................................................................................18
4.3. Configuration of line tracking sensors.................................................................19
5. Controller......................................................................................................................21
5.1. Control structure..................................................................................................21
5.2. Types of controllers:............................................................................................23
6. Design specifications.....................................................................................................25
CHAPTER 2. ANALYSING AND DESIGNING OPTION.........................................27
1. Mechanical propose solutions.......................................................................................27
2. Electric propose solutions.............................................................................................27
2.1. Micro-controller...................................................................................................27
2.2. Motors..................................................................................................................27
2.3. Sensors propose solutions....................................................................................28
3. Control propose solutions..............................................................................................29
3.1. Control structure..................................................................................................29
3.2. Controller.............................................................................................................29
4. Summary:......................................................................................................................29
4.1. Principle diagram of mechanical solution:..........................................................29
4.2. Principle diagram of electronic solution:.............................................................29
4.3. Principle diagram of control solution:.................................................................30
CHAPTER 3. MECHANICAL DESIGN......................................................................31
1. Driver wheel selection...................................................................................................31
2. Motor selection..............................................................................................................31
3. Calculate the robot’s dimension....................................................................................34
3.1. Conditions for the vehicle not to flip when steering............................................34
3.2. Conditions for the vehicle not to slide when cornering.......................................34
3.3. Analyze the robot’s forward dynamics................................................................34
4. Mounting tolerances between hole and motor shaft of the motor fixtures....................36
5. Gear calculation.............................................................................................................37
5.1. Key specification data of helical gear transmission.............................................37
5.2. Material selection.................................................................................................38
5.3. Allowable contact stress......................................................................................38
5.4. Calculating geometry parameters of gear transmission [5].................................38
5.5. Summary specification of the Spur Gears System...............................................39
6. 3D model of the mechanical design..............................................................................40
CHAPTER 4. ELECTRICAL DESIGN........................................................................41
1. Electrical block diagram................................................................................................41
2. Sensor circuit design.....................................................................................................41
2.1. Sensor selection...................................................................................................41
2.2. Resistor selection.................................................................................................42
2.3. Sensor placement.................................................................................................43
2.4. Calculating distance from sensor to the line........................................................44
2.5. Calculating distance between two sensors...........................................................45
2.6. Calculating number of sensors.............................................................................46
2.7. Sensor calibration................................................................................................46
2.8. Calculating error by weighted average method...................................................47
2.9. Sensor circuit model............................................................................................50
3. Motor driver selection...................................................................................................50
3.1. Requirement.........................................................................................................50
3.2. Comparison between drivers...............................................................................50
4. Power source design......................................................................................................51
4.1. Battery selection..................................................................................................51
4.2. Power source calculation.....................................................................................52
5. System PCB design.......................................................................................................53
CHAPTER 5. CONTROLLER DESIGN......................................................................56
1. Kinematics modeling of the robot.................................................................................56
2. Controller design...........................................................................................................59
3. Controller simulation.....................................................................................................61
4. Motor controller............................................................................................................62
CHAPTER 6. CONTROL ALGORITHM DESIGN....................................................68
1. Master control algorithm...............................................................................................68
2. Slave control algorithm.................................................................................................69
CHAPTER 7. EXPERIMENT AND EVALUATION..................................................70
1. Experiment result..........................................................................................................70
1.1. Mechanical structure of the robot........................................................................70
1.2. Electrical components..........................................................................................70
1.3. Experiment result on real physical model............................................................71
2. Limitation and improvements.......................................................................................71
2.1. Mechanical manufacturing..................................................................................71
2.2. Electrical components..........................................................................................72
2.3. Control system.....................................................................................................72
3. Conclusion and future development..............................................................................72
3.1. Conclusions..........................................................................................................72
3.2. Future development.............................................................................................72
REFERENCE.......................................................................................................................73
LIST OF FIGURES
Figure 0.1. The complete route of the line map.....................................................................9
Figure 1.1. Errors measuring scheme form CMU camera frame.........................................15
Figure 1.2. Photoresistor’s principle....................................................................................16
Figure 1.3. Infrared sensor’s principle.................................................................................16
Figure 1.4. Comparative algorithm......................................................................................18
Figure 1.5. Quadratic interpolation of approximation algorithm.........................................19
Figure 1.6. Weighted average of approximation algorithm.................................................19
Figure 1.7. Two-sensor configuration..................................................................................20
Figure 1.8. Four-sensor configuration..................................................................................20
Figure 1.9. Matrix-sensor configuration..............................................................................20
Figure 1.10. V-shape configuration......................................................................................21
Figure 1.11. The distance between line sensors...................................................................21
Figure 1.12. Structure of centralized control........................................................................22
Figure 1.13. Structure of hierarchical control......................................................................22
Figure 1.14. Recorded line following robot motions on the track.......................................24

Figure 1.16. The tracking error 𝐞𝐢....................................................................25


Figure 1.15. Define the line detection error for system modeling.......................................25

Figure 2.1. Differential drive of 2 front wheels and rear caster wheels...............................27
Figure 2.2. The errors of weighted average and quadratic interpolation method................28
Figure 2.3. System block diagram........................................................................................30
Figure 3.1. Force analysis on wheel.....................................................................................31
Figure 3.2. Robot dimensions and force analysis.................................................................34
Figure 3.3. Robot dynamics analysis...................................................................................35
Figure 3.3.4. Robot 3D model..............................................................................................40
Figure 4.1. System block diagram........................................................................................41
Figure 4.2. TCRT5000 dimensions......................................................................................41

Figure 4.4. 𝐈𝐂 and 𝐈𝐅 relationship....................................................................................43


Figure 4.3. TCRT5000 Schematic........................................................................................42

Figure 4.5. 𝐈𝐜 and 𝐕𝐂𝐄 relationship................................................................................43


Figure 4.6. TCRT5000 distance diagram.............................................................................44
Figure 4.7. Efficiency of TCRT5000’s mount types............................................................44
Figure 4.8. Difference values of sensors..............................................................................45
Figure 4.9. Three sensors in detecting area..........................................................................46
Figure 4.10. Layout of the TCRT5000 sensors....................................................................46
Figure 4.11. The linear regression equation.........................................................................49
Figure 4.12. TCRT5000 PCB...............................................................................................50
Figure 4.13. Power supply circuts........................................................................................53
Figure 4.14. Control circuts..................................................................................................54
Figure 4.15. Driver citcut.....................................................................................................54
Figure 4.16. Routing system PCB in Altium.......................................................................55
Figure 4.17. The 3D model of the main PCB in Altium......................................................55

Figure 5.2. Robot line following eror 𝒆𝟐 and 𝒆𝟑.................................................61


Figure 5.1. Kinematics model of robot.............................................................................56

Figure 5.4. The errors 𝐞𝟐 and 𝐞𝟑 with the robot’s motion in “Red package” scenario....62
Figure 5.3. The complete route in 2 senarios.......................................................................61

Figure 5.5. The errors 𝐞𝟐 and 𝐞𝟑 with the robot’s motion in “Blue package” scenario...62
Figure 5.6. The reponses of right and left motor corresponding to PWM...........................63
Figure 5.7. The step response of motors according to 50% duty cycle................................63
Figure 5.8. Step responses of right and left motors..............................................................64
Figure 5.9. Comparision between 100% duty cycle step responses of motors and the
transfer function found..............................................................................................................65
Figure 5.10. Step responses of right and left motors with PI controller in MATLAB........65
Figure 5.11. Step responses of right and left motors with PID controller through
experiments...............................................................................................................................66
Figure 5.12. Step responses of right and left motors with PID controller through
experiments in 10 seconds........................................................................................................67
Figure 6.1. The flowcharts of a. Master, b. Line following procedure, c. Controller, d. Load
handling process, e. Intersection process..................................................................................68
Figure 6.2. The flowcharts of slave (left) and the PI controller (right)................................69
Figure 7.1. Sensor PCB in reality.........................................................................................70
Figure 7.2. System PCB in reality........................................................................................71
Figure 7.3. Robot at the loading point..................................................................................71
Figure 7.4. Robot goes to the destination.............................................................................71
LIST OF TABLES
Table 1.1. MK ROBOT UGV specification.........................................................................11
Table 1.2. MP-500 Specification..........................................................................................11
Table 1.3. Pioneer 3 - AT specification...............................................................................12
Table 1.4. Battery comparison.............................................................................................13
Table 1.5. Motors comparison..............................................................................................14
Table 1.6. Color sensors comparison...................................................................................17
Table 1.7. Control structure comparison..............................................................................23
Table 1.8. Comparision of PID controller and On/Off controller........................................23
Table 3.1. Wheel’s specification..........................................................................................31
Table 3.2. Specifications of DC motor.................................................................................33
Table 3.3. Robot dimensions................................................................................................36
Table 4.1. TCRT5000 specification.....................................................................................41
Table 4.2. The maximum and minimum values of sensors..................................................47
Table 4.3. Errors of the sensors............................................................................................48
Table 4.5. Motors driver comparison...................................................................................51
Table 4.6. 18650 battery specification.................................................................................51
Table 4.7. Controlling power source calculation.................................................................52
Table 4.8. Dynamic power source calculation.....................................................................52
Table 5.1. Characteristics of the motors’ step responses.....................................................64
Table 5.2. Characteristics of the motors’ step responses with PI controller in MATLAB. .65
Table 5.3. Characteristics of the motors’ step responses with PID controller through
experiments...............................................................................................................................66
Ho Chi Minh University of Technology Mechatronics system design project

PROJECT TOPIC ANALYZE


General requirement:
Design a line-following robot that can detect the guideline on a line course and
travels along it. The robot must maintain a satisfied line-grip ability throughout that given
line course with pre-determined constraint conditions:
Minimum velocity : 𝑣𝑚𝑖𝑛 = 0.1 𝑚/𝑠
The smallest radius of curvature : 𝜌𝑚𝑖𝑛 = 500𝑚𝑚
-

Line tracking error (from the left or right edge of the line) : 𝑒𝑚𝑎𝑥 = ±3 𝑚𝑚
-

The end of path stop position error : 𝑒𝑠𝑡𝑜𝑝 = ±5 𝑚𝑚


-
-
- Line color: black

Line width: 26 𝑚𝑚
- Background color: white
-
- Type of surface: planar
Technical requirements:
- The robot is equipped with a sensor system to help the robot recognize the line on
the floor/ground surface and follow that line. Select the appropriate sensor type by
yourself.
- The robot from the “Start” position moves to the “Loading area” (marked by a path
cut line, the cross-section is 50 mm long and 26 mm wide) and stops to wait for
the load to be placed manually. The robot is capable of recognizing that the load
has been uploaded.
- At the “Loading Area”, a block of red or blue color will be placed manually on top
of the robot. The mass of the good is 2 kg. The robot is capable of recognizing that
the load has been uploaded.
- After receiving the goods, the robot must move to the "End" position corresponding
to the color of the package.
Note:
- The shape and dimensions of the load are chosen by the student.
- The color identification solution for the load is chosen by the student.
Shape of the line path:

8
Ho Chi Minh University of Technology Mechatronics system design project

Figure 0.1. The complete route of the line map

From the design requirements and the provided specifications, we can set some
conclusions:
- The load is determined to be 2 kg. Therefore, when taking an overview, we only
consider mobile robot with a low payload capacity. Due to the small payload, we should
consider 3 or 4 wheels mobile robot to simplify the structure and increase possibility for the
later manufacturing process.
- About the material of the load, our group decide to choose a lump of iron because it
is small, common and low cost. Then we use color labels to cover it.

9
Ho Chi Minh University of Technology Mechatronics system design project

CHAPTER 1. OVERVIEW
1. Introduction
1.1. Definition line following robot
Line following robots (LFR) are robots designed to follow a path. This line or path
may be as simple as a physical white line on the floor or as complex path marking
schemes, embedded lines, magnetic markers, and laser guide markers. The robot can avoid
obstacles, make sharp turns, climb bridges, detect a specific object, and carry and deposit
the object in the right position. LFR can be applied in many different fields:
- Provide parts arrangement in warehouse and production areas.
- Transfer goods between production stations.
- Distributing and supplying products, especially in trading.
- Supply and arrangement in special fields such as hospitals, supermarkets, offices
room.
1.2. Steering control types of LFR
Differential drive: This is the most common mechanism in LFR steering control
designs. In this concept, there are two independent wheel drives. Each wheel is driven at
different speeds to turn in any direction or at the same speed, allowing the robot to go
forward or backward. This steering method is the simplest because it does not require an
additional steering motor.
Steered wheel control: Common in the tricycle drive concept. The tricycle robot is
designed with a front steering wheel controlled by a motor. The two rear wheels are
attached to a common axle driven by a single motor to move forward and backward.
However, some LFRs have both steer and drive controlled by the front wheel, and the rear
wheels are used as supporting wheels to maintain stability.
Dual steering wheel type: This is a combination of differential drive and steering
wheel control. Two independent steer/drive motors are placed on diagonal corners of the
LFR and swiveling castors are placed on the other corners. The steering drive of the dual
steering wheel type can perform the 360-degree turning function and can perform the
universal lateral movement function, with high flexibility and accurate operation
flexibility..
2. Mechanical specification
2.1. MK ROBOT UGV

Diffe ren tial

1
Ho Chi Minh University of Technology Mechatronics system design project

Table 1.1. MK ROBOT UGV specification

Mechanical specifications
LxWxH 970 × 740 × 350 𝑚𝑚
Average speed 1.5 𝑚/𝑠
Maximum load 80 𝑘𝑔
Mechanical analyze:
Advantage:
- Better stability and maneuverability on road.
- Less slippage and less power consumption.
Disadvantage:
- Complexity in design.
- No zero radius turn ( cannot rotate around it vertical axis ).
2.2. MP-500

Table 1.2. MP-500 Specification

Mechanical specifications
LxWxH 823 × 592 × 358 𝑚𝑚
Average speed 1.5 𝑚/𝑠
Maximum load 80 𝑘𝑔
Mechanical analyze:
Advantage:
- Low cost and simplicity.
- Ensure to be coplanar.
- Convenient to tune the speed of each motor.
- Robot can turn with small radius.
- 2 front driving wheels are more stable when compared to 2 rear driving wheels.
Disadvantage:

1
Ho Chi Minh University of Technology Mechatronics system design project

- Uneven weight distribution ( on a triangle) when compared to 4 wheels or 6


wheels.
- Less consistent of 2 motors so that the robot is hard to go straight and easy to
overturn when turning.
- Do not ensure the distance between sensors and road surface in the rough terrain.
2.3. Pioneer 3 –AT

Table 1.3. Pioneer 3 - AT specification

Mechanical specifications
LxWxH 508 × 497 × 277 𝑚𝑚
Average speed 0.7 𝑚/𝑠
Maximum load 12 𝑘𝑔
Mechanical analyze:
Advantage:
- Well weight distribution ( on a rectangle ).
- Good for rough terrain so that ensure the distance between sensors and road
surface..
- Great traction.
Disadvantage:
- It uses skidding or slipping technique, increases wheel wear, reducing life.
- Difficult to synchronize 4 motors when going straight or turning.
- The control algorithm is complicated.
- Difficult to be coplanar.
3. Electronic specification
There are 4 main components that make the vehicle operates:
- Power: Sources that supply power to different components of the mobile robot.
- Controller: Different kinds of controllers to make control signal for other
components.
- Actuator: Devices that convert control signals and energy into mechanical
energy (physical movement).

1
Ho Chi Minh University of Technology Mechatronics system design project

- Sensor: Devices to acquire knowledge about robot’s environment.


- Others: Other electronic components: drivers, control valves,…
3.1. Power source
There are many commercially available AC and DC power sources, however, with a
focus on a portable project, battery is most suitable. The tables below give an overview on
all known batteries, they list the advantage and disadvantage of each type of battery which
is commonly used.
Table 1.4. Battery comparison

Name Lead Acid Battery Nickel Metal Hydride Li – Ion

30 − 40 60 − 120 (𝑊ℎ/𝑘𝑔) 120 − 130


(𝑊ℎ/𝑘𝑔) (𝑊ℎ/𝑘𝑔)
Power density

- Life Free - Higher energy - Low weight.


Advantage
maintenance. density than Lead - High energy densities.
- Good low and acid. - High charging
high temperature - Long life span. efficiency.
performance. - Safe. - Widely used in
- Per watt-hour electronics device.
cost is less. - Long life span.
- Widely used in
all types of
automobiles.
Disadvantage - Very heavy. - Inferior performance - Can pose a fire safety
- Disposal or in cold weather. risk if punctured or
recycling shows - Less efficient in charged improperly.
impact on charging than Lead - Cannot accept or
environment. acid. supply charge in cold
- 3–20% self- - High cost conditions.
discharge - Limited Cycle Life
rate/month. - High cost.

3.2. Microcontroller
A microcontroller is needed to process information from the sensors, control the
motors and operate the vehicle. Microcontroller families such as ESP32, PIC16, STM32,
and ATMega,… are commonly used due to their compact, easy for programming and
providing the essential functionality required for sensors and motors control.
The microcontroller should meets the following requirements:
- Have enough I/O pins for reading digital and analog values
- Have module PWM to control the motor
- Have interrupt port to read the signal from the encoders, sensors,…
- Have Communication interfaces (I2C, UART, SPI, RS232,…)
- Fast processing speed
- Power consumption
- Compact and low cost

1
Ho Chi Minh University of Technology Mechatronics system design project

3.3. Actuator
An actuator is needed to carry out commands from the microcontroller. There are
three types of actuators, namely, pneumatic, hydraulic and electric. However, pertaining to
this project, only electric actuator (motors) is considered.
DC motors are widely used in high-quality electric drive systems, with DC motor
power ranges from a few W to several MW. This is a versatile, flexible motor that can
meet the requirement of speed, torque, acceleration, and braking with heavy loads. DC
motors are often used mainly to meet the requirement of speed. The DC motor with an
Encoder attached is used to precisely control the speed, using the Pulse Width Modulation
- PWM method. Therefore, DC motors are commonly used in LFR.
A stepper motor is a type of DC motor that works in discrete steps. It is a
synchronous brushless motor where a full rotation is divided into a number of steps. The
two main components of a stepper motor are the rotor and the stator. The rotor is the
rotating shaft and the stator consists of electromagnets that form the stationary part of the
motor. When a discrete DC voltage is applied, the stepper motor rotates in a particular
angle called the step angle; thus a stepper motor is manufactured with steps per revolution.
It can be operated with or without a feedback control. The motor moves by performing
steps, by simply counting the steps, the position of the motor can be located at a given
time.
Servo motor can be any type of motor above combined with controller and feedback
system. Servo motor is designed to provide precise control of position, speed, and
acceleration in various applications. These motors are a type of rotary or linear actuator
and are commonly used in automation, robotics, and other systems where accurate and
controlled movement is essential.
Table 1.5. Motors comparison

Name DC motor Stepper motor Servo motor


- Simple to control. - Precise positioning - High accuracy
Advantage
- Low cost control. - Fast response time
- Varies in sizes, rpm, - Simple to control. - High efficiency
torque, driver, - High torque to
speed. maintain position.
- Can miss step at high - High cost
Disadvantage - Noise
- Need maintenance. loads. - Complex to setup
- Low efficiency and program
- Noise. - Require more
- Limited high-speed sophisticated power
torque. supplies and
voltage regulation

3.4. Sensors
Line following methods: Two commonly used methods for LFRs are the method of
using CMU camera and sensors.
CMU Camera: In the case of using a camera, the image obtained from the actual line
will be sent back, processed and used image processing algorithms to determine the exact

1
Ho Chi Minh University of Technology Mechatronics system design project

position and deviation angle of the vehicle relative to the line. CMU camera is a type of
camera with an integrated microprocessor to process the camera’s signal image return and
output the signal to the main microcontroller. The input of microcontroller is the error
between the camera position and the considered point on the line:

Figure 1.1. Errors measuring scheme form CMU camera frame

Where:
𝑒1: The distance from the camera to the center of the line is perpendicular to the
drive wheel axis. In the tracking controller, the error 𝑒1 is considered to be
-

approximately 0 because the point being considered on the line is always on the

𝑒2: The distance from the camera to the center of the line is parallel to the drive
same line as the camera location.
-

𝑒3: Deviation angle between the vehicle's axis and the tangent of the line at the
wheel axis.
-
considered point.
Sensors: The most common sensors for a LFR have been LDR (Light Dependent
Resistor) and IR (infrared) LED (light emitting diode).
LDR is a light dependent resistor which works by incident light on it. Its resistance
varies according to change in the intensity of light. As the light falls on the LDR then it
shows very high resistance ideally infinite and when there is not any light beam incident on
it then it shows very less resistance ideally zero. That means if a voltage apply in the one
terminal of the LDR then it gives zero voltage at another end if there is any light falls and
vice versa.

1
Ho Chi Minh University of Technology Mechatronics system design project

Figure 1.2. Photoresistor’s principle

Advantage:
- Low cost and simple to use.
- Have a wide range of resistance values and sensitivity levels.
- They do not require any external power source.
- They are compatible with many circuits and devices.
Disadvantage:
- Easily affected by the change in temperature
- Low accuracy.
- Slow response time.
- Narrow spectral response that depends on the material used and may not match the
desired wavelength range.
Infrared (IR) Sensors: Comprise of IR-transmitter (Tx) and receiver (Rx). This special
purpose LED transmits infrared rays of wave length 760 nm. White surfaces generally
reflect well, but black surfaces reflect poorly.

Figure 1.3. Infrared sensor’s principle

Advantage:
- Fast response time.
- Low power consumption.
- High accuracy.
- Easy to identify lines with high contrast.

1
Ho Chi Minh University of Technology Mechatronics system design project

Disadvantage:
- Limited range.
- Can be affected by environmental conditions such as dust, sunlight,
- Accuracy depends on surface material.
Color detection methods: To detect the color of the products, we have 2 posibilities
methods:
Color sensor: A color sensor is a type of sensor that has the feature of distinguishing
different types of colors such as green, blue or red, etc... This sensor uses a light source for
color analysis, which means it emits light through the LED light source and then absorbs
this light. Light will reflect after hitting any object or specific object. On the principle of
reflected light, the controller uses a sensor to analyze the color of a particular object or
object.
Camera: capture images from the object and image processing to give color results.
Table 1.6. Color sensors comparison

Color detection sensors Color sensor Camera

Advantage - Compact and easy to - High accuracy


install
- Low cost
- High response speed

Disadvantage - Low accuracy - Take more time to process


- High cost

4. Line tracking algorithm


Depending on the sensor output, we will have 2 different types of line tracking
algorithm: Comparative algorithm and Approximation algorithm.
4.1. Comparative algorithm:
The output signal of the sensor is analog so that through the threshold, we can devide
the signal into two logical values are 0 or 1. Based on the logic value, we can infer the
sensor position on the line or off the line so that find the position of the robot according to
pre- defined status table.

1
Ho Chi Minh University of Technology Mechatronics system design project

Figure 1.4. Comparative algorithm

The tracking-line error depends on the ability to distinguish the state of the sensors
and the distance between sensors.
Advantage:
- This algorithm is simple.
- This algorithm has high speed processing.
Disadvantage:
- Only works for pre-determined line map.
- The spacing of sensors affect the algorithm.
4.2. Approximation algorithm:
The analog signal is read from the sensor through approximation to find out the
relative position of the vehicle relative to the center of the line.
Advantage:
- Have lower error than the comparative algorithm.
Disadvantage:
- Sensors must have similar output characteristics.
- This algorithm takes more time to process.
In the approximation algorithm, there are 2 main methods:
Quadratic interpolation:

1
Ho Chi Minh University of Technology Mechatronics system design project

Figure 1.5. Quadratic interpolation of approximation algorithm

to make a quadratic interpolation, name the 3 sensors 𝑥1; 𝑥1 + 1; 𝑥1 + 2 respectively.


The method requires 3 consecutive sensors with higher analog outputs than the other

The coordinate value with the highest output of the estimated curve is considered the true
position of the line using the formulas:
𝑏 𝑦1 + 𝑦3 − 2𝑦2
𝑥 =− 𝑤ℎ𝑒𝑟𝑒 𝑎 = ; 𝑏 = 𝑦2 − 𝑦1 −
2𝑎𝑥1 − 𝑎 2𝑎 2
(1.1.1)

Weighted average:

Figure 1.6. Weighted average of approximation algorithm

below formula, note that we assign the coordinate of 𝑥𝑖 as in the figure.


This method can be thought as finding the “center of mass” of the line using the

∑ 6
0 𝑥𝑖𝑦𝑖 3(𝑦6 − 𝑦0) + 2(𝑦5 − 𝑦1) + (𝑦4 −
𝑦2)
(1.1.2)
𝑥 =− 6 = 𝑖=
∑𝑖=0𝑦𝑖 ∑𝑖=0
6
𝑦𝑖

4.3. Configuration of line tracking sensors:


Arrangement of sensors:

1
Ho Chi Minh University of Technology Mechatronics system design project

To detect a line, it is necessary to use at least two sensors. However, using two
sensors is not enough for the robot to distinguish between straight lines and curves.
Currently, there are 4 common types of sensor configuration:
Two-sensor configuration:
Line

Figure 1.7. Two-sensor configuration

This method is simple, cost-effective and low computational overhead. However, this
method has limited precision when detect junction or the need to switch between multiple
tracks.
Four-sensor configuration:
Line

Figure 1.8. Four-sensor configuration

This method has better accuracy and adaptability when compared to a two-sensor
setup. This method is suitable for the route including straight lines and simple junctions.
However, this method would be very poor at sensing a greater than 90 degree turn.
Matrix-sensor configuration:
Line

Figure 1.9. Matrix-sensor configuration

This method has high precision when compared to other methods. However, high
cost, high computational load and complexity are the biggest drawbacks of this method.

V- shape configuration:

2
Ho Chi Minh University of Technology Mechatronics system design project

Line

Figure 1.10. V-shape configuration

This method would be very good at getting an advanced look at intersections and 90
degree turns because the sensors at outer edges of the V, would give an advanced warning.
This method is suitable for path has complicated turns of an advanced track.
Distance between sensors
For the distance between sensors, it is necessary to pay attention to the distance
between the two sensors at the edge.
If the distance is too far, it will lead to inaccurate detection of when the robot
turning. On the contrary, if the distance between the two sensors is too close, it will affect
the robot's ability to detect lines, causing signal noise.

Direction of
motion

𝜃𝐶

a) Too near b) Too far


Figure 1.11. The distance between line sensors

𝑤
Formulation to calculate exactly the distance between sensors:

𝑤 < |𝑆𝑅𝑅 − 𝑆𝐿𝐿| <


𝑡𝑎𝑛𝛳
- 𝛳𝑐 is the allowable angle between horizontal line and

the direction of the vehicle

- |𝑆𝑅𝑅 − 𝑆𝐿𝐿| is the distance between 2 sensors at the edge.


when turning.

- 𝑤 is the width of the line (mm).


5. Controller
5.1. Control structure:
The circuit of a line follower robot consists of 3 main basic components, which are
sensor circuit, control circuit, motor driver. Therefore, one of the following two options
can be used to design the controller:
Centralized control:

2
Ho Chi Minh University of Technology Mechatronics system design project

Sensor

Driver Micro Driver


controller
Encoder Right Wheel
Left Wheel Motor
Encoder Motor

Figure 1.12. Structure of centralized control

The only microcontroller simultaneously receives and processes signals from


sensors, receives and processes signals from 2 encoders, executes main program, calculates
control values and transmits to two motors. Most of the actual robots and race cars often
use this control structure.
Hierarchical control:

Sensor
Slaver 1

Figure 1.13. Structure of hierarchical control


Driver
Slaver Driver
2 as a computation master for the main controller
A microcontroller used program. The
MasterperformingSlaver
remaining slavers use other microcontrollers, 3
separate tasks: receive and
process signals from the sensor, calculate the relative position of the vehicle to the line and
transmitting Left
it toWheel
the master, encoder,Right
receiving signal from theEncoder
Encoder
Wheelthe control
calculate
algorithm for theMotor
motor, make sure the motor works according to the masterMotorrequirements,
etc. Signals are exchanged between microcontrollers have many different standards such as
I2C, CAN... This structure reduces the amount of computation for the master and allow the
robot to perform multiple functions at the same time.
We have the comparison of the centralized and hierarchical control as below:

2
Ho Chi Minh University of Technology Mechatronics system design project

Table 1.7. Control structure comparison

Centralized control Hierarchical control

Number of MCUs 1 ≥2

Processing speed Slower Faster


- Easy to program and
Advantages - Low space required
developed
- Low weight
- Low cost

- Require more space


Disadvantages - Difficult and complicates
- Higher weight
to code and debug
- Require micro-controller - High cost
has high speed
processing
5.2. Types of
controllers: PID controller:
For the line detection robot, with the requirement of line tracking control and PWM

In the LFR, acoording to [16], 𝐾𝑃 is used to minimize positional error, 𝐾𝐼 is used to


pulse width control for the motor, we can use common controllers such as P, PD, PI, PID.

minimize steady-state error occurring in paths and 𝐾𝐷 is used to minimize oscillatory


behavior and overshooting.
In [17], the authors have demonstrated the effectiveness of the PID controller
compared to the On/Off controller as below:
Table 1.8. Comparision of PID controller and On/Off controller

Criteria Dynamic PID controller On/Off controller

Time to complete the route 47.6 𝑠 71.4 𝑠

Line tracking Smooth Not so smooth

Velocity 0.2 𝑚/𝑠 0.14 𝑚/𝑠

Tendency to astray from line Low High

Although the PID controller is effective, the robot speed can be up to 1.3 𝑚/𝑠 [12],
to achieve the desired behavior, it required manual trials and errors method, which is time
consuming.
Fuzzy controller:
The structure of the fuzzy controller:

2
Ho Chi Minh University of Technology Mechatronics system design project

Fuzzification: Transforms conditions with specific values (numerical variables) into


fuzzy variables (linguistic variables).
Inferencing (Ruled Based): Form the fuzzy rule in the form IF…THEN.
Defuzzification stage: converting fuzzy data into numerical data that can be sent to
control equipment.
In [18], the performance of fuzzy controller is better than the PID controller and
switching (On/Off) controller as the track of fuzzy controller in [Figure 1.8] yields in less
jerky motion, minimal left-right sway and at all control speed, it was faster than the other
two. But the process of the fuzzy controller is complicated, for example: fuzzification of
five digital inputs of digital sensors, decision making using rule definition of IF-ELSE
statement, and defuzzification to obtain the crisp value for Left and Right differential drive
motor system, which needs moderate experience or it’ll be time-comsuming to just
understand and building the suitable rule base.

Figure 1.14. Recorded line following robot motions on the track

Tracking controller:

2
Ho Chi Minh University of Technology Mechatronics system design project

Figure 1.15. Define the line detection error for system modeling

(1.4) in the sense of Lyapunov’s stability, and all tracking errors 𝑒1, 𝑒2, 𝑒3 will be
In [9], with the error dynamics (1.3), the system is stable with the tracking controller

converged to zero as 𝑡 → ∞ [Figure 1.9].

𝑒1̇ 𝑣𝑅𝑐𝑜𝑠𝑒3 −1 𝑒2
[𝑒2̇ ] = [𝑣𝑅𝑠𝑖𝑛𝑒3 ] + [ 0 𝑣
−𝑑 − 𝑒1] [ ]
𝜔
(1.1.3)

𝑒3̇ 𝜔𝑅 0 −1
𝑣 = 𝑣𝑅𝑐𝑜𝑠𝑒3 + 𝑘1𝑒1
{𝜔 = 𝑘2𝑣𝑅𝑒2 + 𝜔𝑅 + 𝑘3𝑠𝑖𝑛𝑒3 (1.1.4)

Figure 1.16. The tracking error 𝐞𝐢

6. Design specifications
To calculate the maximum speed, we will calculate based on the sampling time,
which depends on the sensor response time. Moreover, IR LED is the most optimized
sensor for

2
Ho Chi Minh University of Technology Mechatronics system design project

120 𝑚𝑠, so 𝑡𝑠 = 0.12 (𝑠)


LFR. According to experiments, the response time of the whole system is approximate

robot begins to move from straight line (2000 𝑚𝑚) to a curve (𝑅 = 500 𝑚𝑚).
For the line path of this project, the maximum error of robot position is when the

Supposedly, the robot continues to move straight along a segment 𝐴𝐶 instead of


following segment 𝐶𝐷 (tangent of circle (𝑂, 𝑅 = 500 𝑚𝑚) at 𝐷), then the maximum
error 𝑒𝑚𝑎𝑥 = 𝐷𝐶 = 3 𝑚𝑚 (line segment projected from 𝐶 to 𝐵𝐷).

C B A

D
500
500
O

𝐷𝐶 𝐷𝐶 𝐷𝐶 𝐷𝐶
= = =
𝐴𝐶 √𝑂𝐶2 − 𝐴𝑂2 √(𝑂𝐷 + 𝐷𝐶)2 − 𝐴𝑂2 √(500 +
𝐷𝐶)2 − 5002

→ 𝐴𝐶 = √5032 − 5002 ≈ 56 (𝑚𝑚)


With sampling time 𝑡𝑠 = 0.1 (𝑠), 𝐴𝐶 = 𝑣𝑚𝑎𝑥𝑡𝑠 = 56 (𝑚𝑚)
→ 𝑣𝑚𝑎𝑥 ≈ 0.5 (𝑚/𝑠)
In conclusion, we have the parameters of the robot as follows:
Allowable maximum velocity: 𝑣𝑚𝑎𝑥 = 0.5 (𝑚/𝑠)
Allowable minimum velocity: 𝑣𝑚𝑖𝑛 = 0.1 (𝑚/𝑠)
-

The smallest radius of curvature: 𝜌𝑚𝑖𝑛 = 500 (𝑚𝑚)


-

Line tracking error (from the left or right edge of the line) : 𝑒𝑚𝑎𝑥 = ±3 (𝑚𝑚)
-

The end of path stop position error: 𝑒𝑠𝑡𝑜𝑝 = ±5 (𝑚𝑚)


-
-

2
Ho Chi Minh University of Technology Mechatronics system design project

CHAPTER 2. ANALYSING AND DESIGNING OPTION


1. Mechanical propose solutions
Our group set out to design a LFR with specific criteria:
- To ensure tractive ability (carry product with a mass 2kg) and non-flip when the
robot is turning and loading.
- To be able to change direction effectively.

Line tracking ability with maximum error 𝑒𝑚𝑎𝑥 = ±3 (𝑚𝑚)


- Possibility for the later manufacturing process.

To be able to run at max velocity 𝑣𝑚𝑎𝑥 = 0.5 (𝑚/𝑠)


-
-
After analyzing, to increase possibility for the later manufacturing process, our group
decided to choose a mechanical principle of 3 wheels robot. In addition, our group choose
3 wheels with 2 front wheels and rear caster wheels because 2 front driving wheels is more
stable than 2 rear driving wheels and caster wheel has higher load capacity than ball caster
wheel (point contact). In conclusion, our group decide to choose 3 wheels robot that
contain differential drive of 2 front wheels and rear caster wheel.

Figure 2.1. Differential drive of 2 front wheels and rear caster wheels

2. Electric propose solutions


2.1. Micro-controller
Following the control structure and analyzing of microcontroller. In the case of using
1 master and 3 slaves, we can consider between the SPI or I2C communication protocols to
communicate among the microcontrollers. SPI doesn’t need feedback from slaves, allows
simplier coding, and because I2C needs the microcontrollers’ addresses while SPI doesn’t,
so SPI is chosen to communicate between 3 microcontrollers.
Analog values from line-following sensors and color sensors will be collected by one
slave that can communicate with the master by SPI interface. For the master and 3 slaves
to the motors, we choose the PIC16F887 microcontroller because of its compact size and
because it has been practiced in the Microcontroller course, making it easily accessible and
programmable. Therefore, we choose 3 PIC16F887 for the master and the slaves.
2.2. Motors
After analyzing, our group see that DC motor varies in sizes, speed, torque, driver
and has low cost so that it is suitable for our project. In conclusion, our group decide to use
DC motor with encoder to create closed-loop control.

2
Ho Chi Minh University of Technology Mechatronics system design project

2.3. Sensors propose solutions


Line tracking sensors
Type of sensors
Requirements for selecting sensors:
- Ability to quickly respond to color changes between white and black.
- The sensor signal returns quickly to help the vehicle have the ability to recognize
the lines are suddenly curving.
- Low cost and easy to find in the market.
- Low power consumption.
After analyzing, IR LED is the most optimized sensor for LFR. Therefore, our group
decided to use the IR LED sensors.
Line tracking algorithms

Figure 2.2. The errors of weighted average and quadratic interpolation method

After analyzing, as the requirement line-tracking error of this project is ±3 𝑚𝑚, so


our group has to choose high accuracy algorithm is approximation algorithm. Moreover, as
shown in the figure above, the error of Weight Average method is the smallest . Therefore,
our group decide to choose approximation algorithm ( especially Weight Average method
). However, the disadvantage of this method is the processing time, but we use hierarchical
control structure, each slave has different mission (especially receive and process signals
from the sensor) so this disadvantage is not significant.
Configuration of sensors
After analyzing, we can see that the path has straight lines and simple junctions so
that our group decide to choose Four-sensor configuration because this method can satisfy
the factor of efficiency and simplicity when manufacturing.
Line

Color detection sensors

2
Ho Chi Minh University of Technology Mechatronics system design project

After analyzing, we can see that the color of product is only blue or red, robot do not
need to detect many colors at the same time, so the color sensor can meet the requirement.
Moreover, due to the compact, low cost and high speed response, it is suitable for our
project. In conclusion, our group decide to use color sensors to detect the color of the
products.
3. Control propose solutions
3.1. Control structure
Therefore, for this project, the hierarchical controller was chosen because of its fast
response speed, ease of control, and concurrent programming.
3.2. Controller
The PID controller is chosen to control the motor speed as the speed control of the
motor is a SISO system, and for its ease of use, effectiveness and suitable for the project.

of the controller will be converged to zero as 𝑡 → ∞, the system’s stability will be check
The tracking controller is chosen for the overall MIMO control system as the errors

by Lyapunov’s standard. To reduce the complexity, the car's speed is fixed at 𝑣𝑚𝑎𝑥 and the
angular velocity (𝜔𝐺) will be controlled when the car turns a corner.
4. Summary:
4.1. Principle diagram of mechanical solution:

4.2. Principle diagram of electronic solution:

2
Ho Chi Minh University of Technology Mechatronics system design project

Data
Power Supply
Sensor

Slave 2 Master Slave 2

PWM PWM
Low - Voltage Power Source

Driver Driver

Left Wheel Motor Encoder Encoder Left Wheel


Motor

Power Source

Figure 2.3. System block diagram

4.3. Principle diagram of control solution:


The PID controller was chosen to control the motor speed, the tracking controller for
the overall control system, the car's speed is fixed at 𝒗𝒎𝒂𝒙 and the angular velocity of the
two wheels (𝝎𝑮) will be controlled when the car turns a corner.

3
Ho Chi Minh University of Technology Mechatronics system design project

CHAPTER 3. MECHANICAL DESIGN


1. Driver wheel selection

2𝜋𝑟𝑛
As:

𝑣=
60
(3.1)

𝐿𝑡𝑟𝑎𝑣𝑒𝑙 = 𝑣𝑡
Distance traveled:

2𝜋𝑟
𝑛
(3.2)

⇒ 𝐿𝑡𝑟𝑎𝑣𝑒𝑙 = 𝑡
60
Where:
Traveled distance: 𝐿𝑡𝑟𝑎𝑣𝑒𝑙
(𝑚𝑚) Wheel’s radius: 𝑟
(𝑚𝑚) Revolute per minutue: 𝑛
(𝑟𝑝𝑚) Travel time: 𝑡 (𝑠)

distance in the time 𝑡. We conclude that the larger the wheel, the more distance the robot
From the equation above we see that the wheel’s radius is proportional to travel

travels. We also want to ensure that the robot's ground clearance is high enough for the line
following sensors so that we select the wheel.
Table 3.1. Wheel’s specification

Technical Specification

Wheel’s diameter, 𝐷 (𝑚𝑚) 73

Wheel’s mass, 𝑚 (suppose) (𝑔) 500

2. Motor selection

𝑟 𝑇
𝑣
𝑃

𝑁 𝐹 𝑚𝑠𝑙

Figure 3.1. Force analysis on wheel

1
Inertia momentum of the wheel:
𝐼= (3.3)
𝑚𝑟 2

3
Ho Chi Minh University of Technology Mechatronics system design project

3
Ho Chi Minh University of Technology Mechatronics system design project

Moment equilibrium of the wheel:


𝑇 = 𝐹𝑚𝑠𝑙𝑟 + 𝐼𝛾 (3.4)

Where:
1
𝐹𝑚𝑠𝑙 = 𝜇𝑙( 𝑀
+ 𝑚)𝑔2
(3.5)

1
In order for the wheel to roll without slipping, the moment T must satisfy the condition:

𝑇 ≤ 𝐼𝛾 + 𝜇 ( 𝑀 +
𝑚) 𝑔𝑟 2
(3.6)

Where:
𝐼: Inertia momentum (𝑘𝑔𝑚2).
𝑇: Torque (𝑁𝑚)
𝑟: Wheel’s radius
𝐹𝑚𝑠𝑙: Rolling friction force
𝛾: Angular acceleration (𝑟𝑎𝑑/𝑠2)
𝑎: Acceleration (𝑚/𝑠2)
𝑀: robot’s mass (𝑘𝑔)
𝑚: Wheel’s mass
(𝑘𝑔) Known quantities:
Estimated wheel’s mass: 0.1 (𝑘𝑔)
Estimated robot’s mass (including packages): 5
(𝑘𝑔) Wheel’s radius: 75 (𝑚𝑚)
Sliding Rolling frictional coefficient: 𝜇 = 0.5
Rolling frictional coefficient: 𝜇𝑙 = 0.1 [1]
Speed required: 0.5 (𝑚/𝑠)
Acceleration required: 1 (𝑚/𝑠2)
Speed ratio of transmission system: 𝑢 = 2
Efficiency of spur gear system: 𝜂𝑔𝑒𝑎𝑟 = 0.95

𝑎
Angular acceleration:
𝛾 = = 26.7 (𝑟𝑎𝑑/𝑠2)
𝑟
(3.7)

Angular speed:

3
Ho Chi Minh University of Technology Mechatronics system design project

𝑣
𝜔 = = 13.3 (𝑟𝑎𝑑/𝑠)
𝑟
(3.8)

From the equations below we calculated:


Torque on working shaft:
𝑇 = 0.11 (𝑁𝑚) (3.9)

Limited momen:
𝑇 = 0.78 (𝑁𝑚) (3.10)

Wheel circumference:
𝐶 = 2𝜋𝑟 = 0.235 (𝑚) (3.11)

𝑣
Rotation on the working shaft:
𝑛 = × 60 = 130 (𝑟𝑝𝑚)
𝑐
(3.12)

Power on working shaft:


𝑃 = 𝑇𝜔 = 1.6 (W) (3.13)

Rotation on the motor shaft:


𝑛𝑚𝑜𝑡𝑜𝑟 = 𝑛 × 𝑢 = 260 (𝑟𝑝𝑚) (3.14)

𝑃
Power on the motor shaft:

𝑃𝑚𝑜𝑡𝑜𝑟 = = 1.68 (𝑊)


𝜂𝑔𝑒𝑎𝑟
(3.15)

For the safety coefficient is 2 [2] [3], the required power for a motor is: 𝑃𝑚𝑜𝑡𝑜𝑟 =
1.68 × 1.8 = 3 (𝑊)
From that, we select the encoder motor DC servo motor GM25-370 DC Geared Motor
with specifications:
Table 3.2. Specifications of DC motor

No Load Speed (𝑟𝑝𝑚) 250

Output (𝑊) 3.6

Torque (𝑁𝑚) 0.29

Output Shaft Diameter (𝑚𝑚) 6

Output Shaft Length (𝑚𝑚) 22

3
Ho Chi Minh University of Technology Mechatronics system design project

3. Calculate the robot’s dimension


3.1. Conditions for the vehicle not to flip when steering

𝐶 𝐹 𝑙𝑡

𝑀𝑔

h b

Figure 3.2. Robot dimensions and force analysis

With:
ℎ: Height from vehicle center of mass to ground
𝑏: Width between two wheels of robot
-

𝐹𝑙𝑡: centrifugal force


-

𝐶: Center of mass
-
-
To avoid flipping, the moment generated by gravity around the center of rotation must

𝑏 𝑚𝑣2 𝑏 𝑔𝑏𝑅 ℎ 𝑔𝑅
be greater than the moment of centrifugal force:

𝐹𝑙𝑡ℎ − 𝑃 ≤ 0 ⇒ ℎ − 𝑚𝑔 ≤ 0⇒ℎ ≤ ⇒
≤ 2 𝑅 2 2𝑣2 𝑏
(3.16)

2𝑣2
Because of the size of the load, we select the width of the base is 180 (𝑚𝑚). We
arrange the wheels outside of the base so that:
𝑏 = 160 (𝑚): Width between two wheels of the robot
𝑅 = 0.5 (𝑚): The curvature radius of the track
⇒ ℎ ≤ 0.15 (𝑚)
3.2. Conditions for the vehicle not to slide when cornering
In order for the car not to slide when cornering, the centripetal force, in this case, the

𝑀𝑣2
total frictional force acting on the vehicle is greater than the centrifugal force:

∑ 𝐹𝑚𝑠 ≥ 𝑀𝑎 ⇒ 𝜇𝑀𝑔 ≥ ⇒𝑣≤


(3.17)
𝑅
√𝜇𝑔𝑅
We have speed 𝑣 = 0.56 ≤ 1.56 (𝑚/𝑠)
3.3. Analyze the robot’s forward dynamics
We analyze the robot's dynamics based on the document [1]

3
Ho Chi Minh University of Technology Mechatronics system design project

𝐿1 𝐿2

𝑎
𝑀𝑔
C

𝑟

𝑁 𝑁 1
2
𝐹𝑚𝑠 2 𝐹𝑚𝑠 1

Figure 3.3. Robot dynamics analysis

Where:
𝑁1: Reaction force at the drive wheel
𝑁2: Reaction force at the driven wheel
𝐹𝑚𝑠1: Rolling friction on drive wheel
𝐹𝑚𝑠2: Rolling friction on driven wheel
𝐿 = 𝐿1 + 𝐿2: Distance between front and rear wheel axles
ℎ: Height from vehicle center of mass to ground
𝑟: Wheel’s radius
𝑀: robot’s mass
𝑔 = 9.8 (𝑚/𝑠2): Gravitational acceleration
𝑎: Acceleration
Force balance equation
∑ 𝐹𝑥 = 0
{ ∑ 𝐹𝑦 = 0
∑ 𝑀𝑧/𝑐 = 0
2𝐹𝑚𝑠1 + 𝐹𝑚𝑠2 =
(3.18)
𝑀𝑎
⇒{ 2𝑁1 + 𝑁2 = 𝑀𝑔
𝑁2𝐿1 − 𝐹𝑚𝑠2ℎ − 2𝐹𝑚𝑠1ℎ − 2𝑁1𝐿2 = 0

From the equation:

3
Ho Chi Minh University of Technology Mechatronics system design project

2𝐹𝑚𝑠1 + 𝐹𝑚𝑠2 = 𝑀𝑎
𝑀𝑔𝐿1 − 𝑀𝑎ℎ
𝑁1 =
𝑀𝑔𝐿2 + 2𝐿𝑀𝑎ℎ
(3.19)

{𝑁2 = 𝐿

𝑀𝑔𝐿1 − 𝑀𝑎ℎ
Conditions for the wheels to always stick to the road surface

{ 𝑁 = >0
𝑀𝑔𝐿 2𝐿 + 𝑀𝑎ℎ
1

𝑁 = >0
2

𝐿
2
𝑎
(3.20)

⇒ 𝐿1 > ℎ
𝑔
Where:
ℎ = 150 (𝑚𝑚)
𝑎 = 0.4 (𝑚/𝑠2)
𝑔 = 9.8 (𝑚/𝑠2)
⇒ 𝐿1 > 2.8 (𝑚𝑚)
We choose 𝐿1 = 160, 𝐿2 = 𝐿 − 𝐿1 = 20 (𝑚𝑚)
From the calculations we preliminarily select parameters:
Table 3.3. Robot dimensions

Length overall (𝑚𝑚) 240

Distance between front and rear wheel axles, 𝐿 (𝑚𝑚) 162

Width, 𝑏 (𝑚𝑚) 170

Height from vehicle center of mass to ground, ℎ (𝑚𝑚) 40

Wheel’s diameter, 𝑟 (𝑚𝑚) 45

4. Mounting tolerances between hole and motor shaft of the motor fixtures

commercial so its positioning axis is considered standard. With a nominal diameter ∅7. We
The motor needs to be not only fixed but also variable. The motor is a product

choose ∅7 due to page 50 book “Dung sai và lắp ghép”. [4]


𝐻7

ℎ6
For hole: We choose the basic deviation as H; The accuracy level is 7
For the shaft: We choose the basic deviation as h; The accuracy level is 6
Calculated shaflt tolerance: with 𝑒𝑖 = 0 due to table 4.3 page 27 of “Dung sai và lắp
ghép”.

3
Ho Chi Minh University of Technology Mechatronics system design project

𝑒𝑠 = 0 𝜇𝑚
{𝑒𝑖 = 𝑒𝑠 − 𝑇 = 0 − 9 = −9 𝜇𝑚 (3.21)

We have the shaft tolerance ∅ = 70


−0.
Calculated hole tolerance: with 𝐸𝐼 = 0 due to table 4.4 page 29 of “Dung sai và lắp
ghép”

𝐸𝐼 = 0 𝜇𝑚
{𝐸𝑆 = 𝐸𝐼 + 𝑇 = 0 + 15 = 15 𝜇𝑚 (3.22)

We have the hole tolerance ∅ = 7+0.015


0
ɸ7H7

∅8. We choose ∅8 due to page 50 book “Dung sai và lắp ghép”. [4]
The gear shaft needs to be not only fixed but also variable. With a nominal diameter
𝐻7

ℎ6
For hole: We choose the basic deviation as H; The accuracy level is 7
For the shaft: We choose the basic deviation as h; The accuracy level is 6
Calculated shaflt tolerance: with 𝑒𝑖 = 0 due to table 4.3 page 27 of “Dung sai và lắp
ghép”

𝑒𝑠 = 0 𝜇𝑚
{𝑒𝑖 = 𝑒𝑠 − 𝑇 = 0 − 9 = −9 𝜇𝑚 (3.23)

We have the shaft tolerance ∅ = 80


−0.
Calculated hole tolerance: with 𝐸𝐼 = 0 due to table 4.4 page 29 of “Dung sai và lắp
ghép”

𝐸𝐼 = 13 𝜇𝑚
{𝐸𝑆 = 𝐸𝐼 + 𝑇 = 13 + 22 = 35 𝜇𝑚 (3.24)

We have the hole tolerance ∅ = 8+0.035


+0.
ɸ8

5. Gear calculation
5.1. Key specification data of helical gear transmission

Unit Value

3
Ho Chi Minh University of Technology Mechatronics system design project

Power, 𝑃1 𝑘𝑊 0.0033

Torque, 𝑇 𝑁.
𝑚𝑚
290

Rotational speed of driving gear, 𝑛1 𝑟𝑝𝑚 330

Speed ratio, 𝑢 5/3

Module, 𝑚 0.5

5.2. Material selection


From the table 6.1 [5] we can determine the material of both gears, describing below:

Driving Driven
gear gear

Material Steel 45 Steel 45

Ultimate stress of material, 𝜎𝑏, MPa 600

Yield stress of material 𝜎𝑐ℎ, MPa 340

Hardness of gear, HB 250 250

5.3. Allowable contact stress


𝑆𝐻 = 1.1 : Safety factor considering contact stress (Based on the material of gear is
Steel 45)
𝐾𝐻𝐿 = 1 : longevity coefficient [5]
𝜎0 = 570 : Fatigue limit for contact stress base on the table 6.2
𝐻
[5] Allowable contact stress on driving and driven gear is
𝜎 0
𝐾𝐻𝐿
[𝜎 ] = = 518.18 (𝑀𝑃𝑎)
𝑚
𝐻𝑙𝑖

𝑆𝐻
𝐻
(3.25)

5.4. Calculating geometry parameters of gear transmission [5]


Center distance of external gear transmission:

3
𝑇1𝐾𝐻𝛽
𝑎𝑤 = 𝐾𝑎(𝑢 + 1) √
(3.26)

]2𝑢𝜓 [𝜎
𝐻 𝑏𝑎

Based on Table 6.5; Table 6.6 and Table 6.7 “Tính toán thiết kế hệ dẫn động cơ khí”,
we select:
𝐾𝑎 = 49.5 (𝑀𝑃𝑎1/3); 𝜓𝑏𝑎 = 0.3; 𝐾𝐻𝛽 = 1.07 ⇒ 𝑎𝑤 ≈ 19.8(𝑚𝑚)

3
Ho Chi Minh University of Technology Mechatronics system design project

Number of teeth of drive gear:


2𝑎𝑤
𝑍1 =
𝑚(𝑢 +
1)
(3.27)

⇒ 𝑍1 ≈ 1

Select 𝑍1 = 30
Number of teeth of driven gear:

𝑍2 = 𝑢𝑍1 = 50 (3.28)

Recalculate center distance of external gear transmission:


𝑚(𝑍1 + 𝑍2)
𝑎𝑤 = = 20 (𝑚𝑚)
2
(3.29)

Pitch diameter:
Drive gear:

𝑑1 = 𝑚𝑍1 = 15 (3.30)

Driven gear:

𝑑2 = 𝑚𝑍2 = 25 (3.31)

Addendum diameter:
Drive gear:

𝑑𝑎1 = 𝑑1 + 2𝑚 = 16 (𝑚𝑚) (3.32)

Driven gear:

𝑑𝑎2 = 𝑑2 + 2𝑚 = 26 (𝑚𝑚) (3.33)

Dedendum diameter
Drive gear:

𝑑𝑓1 = 𝑑1 − 2.5𝑚 = 13.75 (𝑚𝑚) (3.34)

Driven gear:

𝑑𝑓2 = 𝑑2 − 2.5𝑚 = 23.75 (𝑚𝑚) (3.35)

5.5. Summary specification of the Spur Gears System

Value
Specification
Driving spur gear Drived spur gear

4
Ho Chi Minh University of Technology Mechatronics system design project

Center distance 𝑎, 𝑚𝑚 20

Module 𝑚𝑛, 𝑚𝑚 0.5

Ratio transmission, 𝑢 5/3

Number of teeth 30 50

Pitch diameter 𝑑, 𝑚𝑚 15 25

𝑑𝑎, 𝑚𝑚
Addendum diameter 16 26

Dedendum diameter 𝑑𝑓,


𝑚𝑚
13.75 23.75

Angle pressure 𝛼, 𝑑𝑒𝑔𝑟𝑒𝑒 20

6. 3D model of the mechanical design

Figure 3.3.4. Robot 3D model

4
Ho Chi Minh University of Technology Mechatronics system design project

CHAPTER 4. ELECTRICAL DESIGN


1. Electrical block diagram
Data
Power Supply
Sensor

Slave 2 Master Slave 2

PWM PWM
Low - Voltage Power Source

Driver Driver

Left Wheel Motor Encoder Encoder Left Wheel


Motor

Power Source

Figure 4.1. System block diagram

2. Sensor circuit design


2.1. Sensor selection

Figure 4.2. TCRT5000 dimensions

Table 4.1. TCRT5000 specification

Parameters Value

0.2 − 15
𝑚𝑚
Distance range

Dimensions 10.2 mm × 5.8 mm × 7 mm

Operating range 0.2 mm − 15 mm

4
Ho Chi Minh University of Technology Mechatronics system design project

Transmit angle 16°

Receive angle 30°

IC−max 100 mA

IF−max 60 mA

2.2. Resistor selection

Figure 4.3. TCRT5000 Schematic

According to the datasheet from the manufacturer we have:


𝑉𝐹 = 𝑉𝑑𝑖𝑜𝑑𝑒 = 1.25 (𝑉)
The resistor 𝑅_1 is calculated by:
𝑉𝐶𝐶 − 𝑉𝐹 5 − 1.25
𝑅1 = = = 187.5 (𝛺)
𝐼𝐹 0.02
(4.1)

We choose 𝑅1 = 220 (𝛺).


Recalculate the forward current:
𝑉𝐶𝐶 − 𝑉𝐹 5 − 1.25
𝐼𝐹 = = = 17 (𝑚𝐴) ≤ 60 (𝑚𝐴)
𝑅1 220
(4.2)

4
Ho Chi Minh University of Technology Mechatronics system design project

Figure 4.4. 𝐈𝐂 and 𝐈𝐅 relationship

Figure 4.5. 𝐈𝐜 and 𝐕𝐂𝐄 relationship

With 𝐼𝐹 = 17 (𝑚𝐴), based on figure above, 𝐼𝐹 = 1.7 (𝑚𝐴).


𝑉𝐶𝐸 is the voltage between 𝐶, 𝐸, based on figure below, with 𝐼𝐶 = 1.2 (𝑚𝐴),
𝐼𝐹 = 17 (𝑚𝐴), 𝑉𝐶𝐸 ≈ 0.6 (𝑉).
𝑉𝑐𝑐 − 𝑉𝐶𝐸
𝑅2 = ≈ 4200(𝛺)
𝐼𝐶
(4.3)

We choose 𝑅2 = 4700(𝛺).
2.3. Sensor placement

4
Ho Chi Minh University of Technology Mechatronics system design project

Figure 4.6. TCRT5000 distance diagram

Figure 4.7. Efficiency of TCRT5000’s mount types

As the figure above, Position 1 causes 𝑋𝑑 shorter than Position 2. When move from
white to black surface, detection of sensor depends on 𝑋𝑑, smaller 𝑋𝑑 makes sensor has
better resolution. Therefore, we choose to place sensor perpendicular to the line like
position 1.
2.4. Calculating distance from sensor to the line
In the height range from 9 ÷ 12 (𝑚𝑚), we see that at the height of 12 𝑚𝑚, the

Therefore, the height between the ground to the sensors is 12 𝑚𝑚.


difference between the white background and black background ADC values is the largest.

4
Ho Chi Minh University of Technology Mechatronics system design project

Figure 4.8. Difference values of sensors

2.5. Calculating distance between two sensors


Minimum distance between two sensors:

𝑙𝑚𝑖𝑛 = 𝑅 + 𝑟 = (ℎ + 0,7) × 𝑡𝑎𝑛150 + 𝑡𝑎𝑛80 ≈ 5 (𝑚𝑚)


𝑙 = 𝑙𝑚𝑖𝑛 + 𝑑 = 5 + 3.5 = 8.5 (𝑚𝑚)
(4.4)

According to the datasheet, the length of each sensor is 𝐿 = 10.2 (𝑚𝑚) > 𝑙 =
8.5 (𝑚𝑚), so we choose the minimum distance between the two sensors as 𝑑𝑚𝑖𝑛 = 𝐿 =
10.2 (𝑚𝑚). Required line for robot to track in this project has the width 26 (𝑚𝑚), there
are two situations:
Two sensors have recognized area in line

Three sensors have recognized area in line

4
Ho Chi Minh University of Technology Mechatronics system design project

Figure 4.9. Three sensors in detecting area

We should choose 𝑑 between two sensors satisfying 𝑓1 = 26 − 𝑑 and 𝑓2 = 2𝑑 − 26


both reaching minimum value. Because 𝑓1, 𝑓2 are falling and raising monotonic function
respectively, 𝑓1 = 𝑓2 is accepted to solve the above target. Solving this first order

→ 𝑑 ≈ 15 (𝑚𝑚).
equation

2.6. Calculating number of sensors


To be able to use the Approximation algorithm, we need at least 3 sensors to be able
to determine the line center. Assuming it happens that the center of the line coincides with
the center of interpolation from the sensor, we need 2 more sensors at the left and right
ends to be able to determine whether the vehicle is deviating to the left or right. Thus, with
5 sensors we can completely determine the center of the line and the direction of deviation
of the vehicle.

Figure 4.10. Layout of the TCRT5000 sensors

2.7. Sensor calibration

4
Ho Chi Minh University of Technology Mechatronics system design project

From the following data we take the max and min value for the calibration.
Table 4.2. The maximum and minimum values of sensors

𝑥𝑖𝑚𝑎𝑥 𝑥𝑖𝑚𝑖𝑛
Value
Sensor

1 883 53

2 859 42

3 877 44

4 837 42

5 894 56

𝑦 = 47 +
Applying the calibration formula, we have the equations for each sensor:
823
(𝑥
Sensor 1: − 53)
1 830 1

𝑦 = 47 + − 42)
(𝑥
823
Sensor 2:
2 817 2

= 47 + − 44)
823
𝑦 (𝑥
Sensor 3:

3 833
− 42)
3

𝑦 = 47 +
823

(𝑥
Sensor 4:
4 795 4

𝑦 = 47 + − 56)
(𝑥
823
Sensor 5:
5 838 5

2.8. Calculating error by weighted average method


Assuming the coordinates of the 5 sensors are 𝑥1, 𝑥2, 𝑥3, 𝑥4, 𝑥5 with
corresponding analog values 𝑦1, 𝑦2, 𝑦3, 𝑦4, 𝑦5, the position of the vehicle relative to the
centerline can be calculated using the following formula:
∑5 𝑥𝑖𝑦𝑖 2(𝑦5 − 𝑦1) + (𝑦4 − 𝑦2)
𝑋 = 𝐿 ( 𝑖=1
)=
15 ( )
∑5 𝑦 𝑖 𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5
(4.5)
𝑐𝑏
𝑖=1

their analog values, where 𝐿𝑐𝑏 is likely a constant factor (15 in this case). The result, 𝑋,
This formula represents the weighted average of the sensor coordinates based on

gives the position of the vehicle relative to the centerline.


Conducting an experiment of reading sensor signals with a 2 𝑚𝑚 interval, ranging
from −30 𝑚𝑚 to 30 𝑚𝑚 relative to the centerline, the following table of results is

4
Ho Chi Minh University of Technology Mechatronics system design project

obtained:

4
Ho Chi Minh University of Technology Mechatronics system design project

Table 4.3. Errors of the sensors

Actual Distance (mm) Weighted average (mm) Error (mm)

-30 -28.41 1.59

-28 -26.71 1.29

-26 -25.13 0.87

-24 -21.31 2.69

-22 -19.61 2.39

-20 -18.01 1.99

-18 -15.96 2.04

-16 -14.10 1.9

-14 -11.44 2.56

-12 -10.06 1.94

-10 -9.45 0.55

-8 -6.79 1.21

-6 -4.93 1.07

-4 -3.83 0.17

-2 -1.46 0.54

0 -0.48 0.48

2 1.61 0.39

4 4.21 0.21

6 6.23 0.23

8 7.44 0.56

10 7.99 2.01

12 9.20 2.8

5
Ho Chi Minh University of Technology Mechatronics system design project

14 12.25 1.75

16 15.41 0.59

18 17.55 0.45

20 18.78 1.22

22 20.52 1.48

24 23.33 0.67

26 24.12 1.88

28 26.73 1.27

30 28.04 1.96

we have an approximate linear equation with a form of 𝑦 = 𝑎𝑥 + 𝑏, with a and b being


Based on the actual distance data by weighted average method and the real distances,

the values found with the slope and intercept, from which we get the approximate linear
equation:
𝑦 = 1.077𝑥 − 0.199
With:
𝑦: The approxiamte distance
𝑥: Calculated weighted average distance
-
-

Figure 4.11. The linear regression equation

From [Table 4.3], we have the maximum error 𝑒𝑚𝑎𝑥 = 2.8 𝑚𝑚

5
Ho Chi Minh University of Technology Mechatronics system design project

2.9. Sensor circuit model

Figure 4.12. TCRT5000 PCB

3. Motor driver selection

3.1. Requirement

of DC GA – 25 Encoder Motor has chosen in previous chapter: ( 𝑉𝑚𝑎𝑥 =


- The minimum output voltage and current need to be larger than the maximum twos

12𝑉, 𝐼𝑚𝑎𝑥 = 750𝑚𝐴).


- Motor – Driver combination is linearity in operating range.
- Consistently stable.
3.2. Comparison between drivers

There are two most common driver using for robotics and mechatronics small and
medium projects, especially for education and competitions: L298N and TB6612FNG.
We take some important specifications of these two drivers from datasheet.

5
Ho Chi Minh University of Technology Mechatronics system design project

Table 4.4. Motors driver comparison

Features L298N TB6612FNG

Maximum supply voltage 46𝑉 15𝑉

4.5 – 46𝑉 2.5 –


13.5𝑉
Motor voltage

Maximum output current 3𝐴 3.2𝐴

4.5 – 7𝑉 −0.2𝑉 –
6𝑉
Logic supply voltage

Continuous current 2𝐴 1.2𝐴

Power dissipation 25𝑊 1.36𝑊

−25°𝐶 – −20°𝐶 –
130°𝐶 85°𝐶
Operating temperature

Switching frequency 40𝑘𝐻𝑧 100𝑘𝐻𝑧

PWM Channel 2 2

Driver type 𝑇𝑟𝑎𝑛𝑠𝑖𝑠𝑡𝑜𝑟 𝑀𝑂𝑆𝐹𝐸𝑇

𝐶𝐶/𝐶𝐶𝑊/𝑆ℎ𝑜𝑟𝑡
𝐶𝐶/𝐶𝐶𝑊/ 𝑏𝑟𝑎𝑘𝑒
𝑆𝑡𝑜𝑝 /𝑆𝑡𝑜𝑝
Mode

/𝐿𝑜𝑤 – 𝑐𝑢𝑟𝑟𝑒𝑛𝑡
𝑠𝑡𝑎𝑛𝑑𝑏𝑦
30,000𝑉𝑁𝐷 115,000𝑉
𝑁𝐷
Price

4. Power source design

4.1. Battery selection

After analysis and comparing, team intend to choose Li – Ion types. Although it is
heavy and risk more than Li – Po, its high power and charge are huge advantages and with
the holder we can fix on the robot surely instead of Li – Po. Moreover, Li – Ion is likely to
much cheaper than Li – Po one and easy to re – charge. Our group decide to use 18650 Li –
Ion Rechargeable Battery to supply electrical source for this project.
Table 4.5. 18650 battery specification

Parameter Value

Dimension 18 × 65𝑚𝑚

Regulate voltage 3.7𝑉 𝐷𝐶


5
Ho Chi Minh University of Technology Mechatronics system design project

Full charge voltage 4.2𝑉 𝐷𝐶

5
Ho Chi Minh University of Technology Mechatronics system design project

Output current 12.5𝐴

2500𝑚𝐴ℎ ×
5𝐶
Capacity

4.2. Power source calculation


- Controlling power source
Table 4.6. Controlling power source calculation

Max current
Device Quantity Supply voltage Power
consumption

PIC16F877A 4 250𝑚𝐴 5𝑉 5𝑊

TCRT5000 5 60𝑚𝐴 5𝑉 1.5𝑊

TCS3200 1 15𝑀𝑎 5𝑣 0.075𝑊

Encoder 2 100𝑀𝑎 3.3𝑉 0.66𝑊

Total 2.735𝑊

Using safety coefficient 𝑘 = 1.3, the minimum energy for control source is:

67
𝑄𝑚𝑖𝑛 = 1.3 × 𝑊 × 𝑡𝑚𝑎𝑥 = 1.3 × 2.735 × ≈ 66.17
(4.6)
(𝑚𝑊ℎ) 3600

Therefore, the minimum capacity of battery is:


𝑄𝑚𝑖𝑛 66.17 𝑉𝐶𝐶 − 𝑉𝐹 5 − 1.25
𝑚𝐴ℎ𝑚𝑖𝑛 = = = 13.2 (𝑚𝐴ℎ)𝐼𝐹 = =
𝑉 5 𝑅1 220
= 17 (𝑚𝐴) ≤ 60 (𝑚𝐴)
(4.7)

- Dynamic power source


Table 4.7. Dynamic power source calculation

Max current Supply Power


Device Quantity

2 750𝑚 12 18𝑊
consumption voltage

𝐴 𝑉
DC – GA25

1 2.2𝑚 5𝑉 0.89𝑊
𝐴
TB6612FNG

Using safety coefficient 𝑘 = 1.3, the minimum energy for control source is:
67
(12𝑉): 𝑄𝑚𝑖𝑛 = 1.3 × 𝑊 × 𝑡𝑚𝑖𝑛 = 1.3 × 18 × = 436
(𝑚𝑊ℎ) 3600 (4.8)

5
Ho Chi Minh University of Technology Mechatronics system design project

67
(5𝑉): 𝑄𝑚𝑖𝑛 = 1.3 × 𝑊 × 𝑡𝑚𝑖𝑛 = 1.3 × 0.89 × ≈ 21.5
(𝑚𝑊ℎ) 3600

5
Ho Chi Minh University of Technology Mechatronics system design project

𝑄𝑚𝑖𝑛 436
Therefore, the minimum capacity of battery is:

(12𝑉): 𝑚𝐴ℎ𝑚𝑖𝑛 = = = 36.3


(𝑚𝐴ℎ) 𝑉 12
𝑄𝑚𝑖𝑛 21.5
(4.9)

(5𝑉): 𝑚𝐴ℎ𝑚𝑖𝑛 = = = 4.3 (𝑚𝐴ℎ)


𝑉 5
5. System PCB design

Figure 4.13. Power supply circuts

5
Ho Chi Minh University of Technology Mechatronics system design project

Figure 4.14. Control circuts

Figure 4.15. Driver citcut

5
Ho Chi Minh University of Technology Mechatronics system design project

Figure 4.16. Routing system PCB in Altium

Figure 4.17. The 3D model of the main PCB in Altium

PCB’s dimensions: 109 × 120𝑚𝑚

5
Ho Chi Minh University of Technology Mechatronics system design project

CHAPTER 5. CONTROLLER DESIGN


1. Kinematics modeling of the robot
From the group design objectives, the robot only moves in the given map with a
constant speed and working in the ideal environment. Hence, dynamics analyses of the
system is unnecessary because the working condition is unchanged: Constant load, plain
map, …
From the principle diagram of the robot, the kinematics model can be made as below:
In which:
𝐴𝑀 = 𝑑 (𝑚): The length from the driving shaft to the tracking point.
𝜔 (𝑟𝑎𝑑/𝑠): Rotation velocity of the robot.
-

𝑅 (𝑚): Radius of the driven wheels.


-
-
- A, M: Centers of driving shaft, and tracking point respectively.
To execute the line following, an error model of the system must be made to analyses
and design the controller. Model in the picture below define the error for the system. We
define the errors as follow:
𝐸: is the reference point in the line that the robot needed to follow.
𝑒1: is the error from the reference point E to line following point M in the horizontal
-
-

𝑒2: is the error from the reference point E to line following point M in the vertical
direction.
-

𝑒3: is the angular error from AM axis to the line-tracking vector.


direction.
-

𝑒3 𝜃𝐸
θ
E
𝑒2

𝑒1
YM YA 𝑣
AM

O XA XM X

Figure 5.1. Kinematics model of robot


At point A, the velocity of the vehicle

𝑣 = ω𝑑 × 𝑅 (5.1)

Kinematics equation at A:

6
Ho Chi Minh University of Technology Mechatronics system design project

𝑋̇𝐴 = 𝑣𝑐𝑜𝑠θ
𝑌𝐴̇ = 𝑣𝑠𝑖𝑛θ
(5.2)

Position of point M in Oxy coordinate:

𝑋𝑀 = 𝑋𝐴 + 𝑑𝑐𝑜𝑠θ
𝑌𝑀 = 𝑌𝐴 + 𝑑𝑠𝑖𝑛θ
(5.3)

Take derivative of equation (3.3) respect to time:

𝑋̇𝑀 = 𝑋̇𝐴 − 𝜃̇ × 𝑑 × 𝑠𝑖𝑛θ


𝑌𝑀̇ = 𝑌𝐴̇ + 𝜃̇ × 𝑑 × 𝑐𝑜𝑠θ
(5.4)

Substitute equation (3.2) into (3.4):

𝑋̇𝑀 = 𝑣𝑐𝑜𝑠θ − 𝜃̇ × 𝑑 × 𝑠𝑖𝑛θ


𝑌𝑀̇ = 𝑣𝑠𝑖𝑛θ + 𝜃̇ × 𝑑 × 𝑐𝑜𝑠θ
(5.5)

Combine (3.3) (3.5), we get the equations of point M:


𝑋̇𝑀 = 𝑣𝑐𝑜𝑠θ − 𝜃̇ × 𝑑 × 𝑠𝑖𝑛θ
{ 𝑌𝑀 = 𝑣𝑠𝑖𝑛θ + 𝜃̇ × 𝑑 × 𝑐𝑜𝑠θ
θṀ = θ̇ = 𝜔
𝑋̇𝐸 = 𝑣𝐸𝑐𝑜𝑠𝜃𝐸
At point E, denote: { = 𝑣𝐸𝑠𝑖𝑛𝜃𝐸
𝑌𝐸 𝜃𝐸̇ = 𝜔𝐸
In which 𝑣𝐸 is the desired velocity of the vehicle.
From the error model derive the error equation:

𝑒 𝑥 = 𝑋𝐸 − 𝑋𝑀
𝑒𝑦 = 𝑌𝐸 − 𝑌𝑀 (5.6)

𝑒 𝜃 = 𝜃𝐸 − 𝜃

Take the derivative of (3.6)

𝑒̇𝑥 = 𝑋̇𝐸 − 𝑋̇𝑀


𝑒̇𝑦 = 𝑌𝐸̇ − 𝑌𝑀̇ (5.7)

𝑒̇𝜃 = 𝜃̇𝐸 − 𝜃̇

Substitute (3.5) into (3.7):

6
Ho Chi Minh University of Technology Mechatronics system design project

𝑒̇𝑥 = 𝑋̇𝐸 − 𝑣𝑐𝑜𝑠θ + 𝜃̇ × 𝑑1


× 𝑠𝑖𝑛θ
𝑒̇𝑦 = 𝑌𝐸̇ − 𝑣𝑠𝑖𝑛θ − 𝜃̇ × 𝑑1 ×
(5.8)

𝑐𝑜𝑠θ
𝑒̇𝜃 = 𝜃̇𝐸 − 𝜃̇

The errors of the system:

𝑒1 = 𝑒𝑥𝑐𝑜𝑠𝜃 + 𝑒𝑦𝑠𝑖𝑛𝜃
𝑒2 = −𝑒𝑥𝑠𝑖𝑛𝜃 + 𝑒𝑦𝑐𝑜𝑠𝜃
𝑒3 = 𝑒𝜃

𝑒1 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0 𝑒𝑥 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0 𝑋𝐸 −


or

𝑋𝑀 [𝑒2] = [−𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0] [𝑒𝑦] = [−𝑠𝑖𝑛𝜃


𝑐𝑜𝑠𝜃 0] [ 𝑌𝐸 − 𝑌𝑀 ]
𝑒3 0 0 1 𝑒𝜃 0 0 1 𝜃𝐸 − 𝜃
(5.9)

Take the derivative of (3.9) respect to time:


̇
𝑒̇1 = 𝑒̇𝑥𝑐𝑜𝑠𝜃 − 𝑒𝑥𝜃𝑠𝑖𝑛𝜃 + 𝑒̇𝑦𝑠𝑖𝑛𝜃
̇
+ 𝑒𝑦𝜃𝑐𝑜𝑠𝜃
𝑒̇2 = −𝑒̇𝑥𝑠𝑖𝑛𝜃 − 𝑒𝑥𝜃̇𝑐𝑜𝑠𝜃 + 𝑒̇𝑦𝑐𝑜𝑠𝜃 −
(5.10)

𝑒𝑦𝜃̇𝑠𝑖𝑛𝜃
𝑒̇3 = 𝑒𝜃̇

Substitute (3.8) into (3.10):

𝑒̇1 = [𝑋̇𝐸 − 𝑣𝑐𝑜𝑠θ + 𝜃̇ × 𝑑1 × 𝑠𝑖𝑛θ]𝑐𝑜𝑠𝜃 − 𝑒𝑥𝜃̇𝑠𝑖𝑛𝜃 +


[𝑌𝐸̇ − 𝑣𝑠𝑖𝑛θ
− 𝜃 × 𝑑1 × 𝑐𝑜𝑠θ]𝑠𝑖𝑛𝜃 + 𝑒𝑦𝜃̇𝑐𝑜𝑠𝜃
̇

𝑒̇2 = −[𝑋̇𝐸 − 𝑣𝑐𝑜𝑠θ + 𝜃̇ × 𝑑1 × 𝑠𝑖𝑛θ]𝑠𝑖𝑛𝜃 − 𝑒𝑥𝜃̇𝑐𝑜𝑠𝜃 +


(5.11)

[𝑌𝐸̇ − 𝑣𝑠𝑖𝑛θ
− 𝜃̇ × 𝑑1 × 𝑐𝑜𝑠θ]𝑐𝑜𝑠𝜃 − 𝑒𝑦𝜃̇𝑠𝑖𝑛𝜃
𝑒̇3 = 𝑒𝜃̇

As θ̇ = 𝜔 , we have:

𝑒̇1 = [𝑋̇𝐸 − 𝑣𝑐𝑜𝑠θ + 𝜔 × 𝑑 × 𝑠𝑖𝑛θ]𝑐𝑜𝑠𝜃 − 𝑒𝑥𝜔𝑠𝑖𝑛𝜃 +


[𝑌𝐸̇ − 𝑣𝑠𝑖𝑛θ
− 𝜔 × 𝑑1 × 𝑐𝑜𝑠θ]𝑠𝑖𝑛𝜃 + 𝑒𝑦𝜔𝑐𝑜𝑠𝜃
𝑒̇2 = −[𝑋̇𝐸 − 𝑣𝑐𝑜𝑠θ + 𝜔 × 𝑑 × 𝑠𝑖𝑛θ]𝑠𝑖𝑛𝜃
(5.12)

6
Ho Chi Minh University of Technology Mechatronics system design project

− 𝑒𝑥𝜔𝑐𝑜𝑠𝜃
+ [𝑌𝐸̇ − 𝑣𝑠𝑖𝑛θ − 𝜔 × 𝑑1 × 𝑐𝑜𝑠θ]𝑐𝑜𝑠𝜃
− 𝑒𝑦𝜔𝑠𝑖𝑛𝜃
𝑒̇3 = 𝑒𝜃̇

After some calculations, 𝑒̇1 and 𝑒̇2 and 𝑒̇3 becomes:

6
Ho Chi Minh University of Technology Mechatronics system design project

𝑒̇1 = [𝑣𝐸𝑐𝑜𝑠𝜃𝐸 − 𝑣𝑐𝑜𝑠θ + 𝜔𝑑𝑠𝑖𝑛θ]𝑐𝑜𝑠𝜃 + [𝑣𝐸𝑠𝑖𝑛𝜃𝐸 − 𝑣𝑠𝑖𝑛θ −


𝜔𝑑𝑜𝑠θ]𝑠𝑖𝑛𝜃 + 𝜔𝑒2
𝑒̇2 = −[𝑣𝐸𝑐𝑜𝑠𝜃𝐸 − 𝑣𝑐𝑜𝑠θ + 𝜔𝑑𝑠𝑖𝑛θ]𝑠𝑖𝑛𝜃 + [𝑣𝐸𝑠𝑖𝑛𝜃𝐸 − 𝑣𝑠𝑖𝑛θ −
𝜔𝑑𝑐𝑜𝑠θ]𝑐𝑜𝑠𝜃 − 𝜔𝑒1
𝑒̇3 = 𝜔𝐸 − 𝜔

𝑒̇1 = 𝑣𝐸𝑐𝑜𝑠𝜃𝐸𝑐𝑜𝑠𝜃 − 𝑣𝑐𝑜𝑠2(𝜃) + 𝜔𝑑𝑠𝑖𝑛θ𝑐𝑜𝑠𝜃 + 𝑣𝐸𝑠𝑖𝑛𝜃𝐸𝑠𝑖𝑛𝜃 −


𝑣𝑠𝑖𝑛2(𝜃)
− 𝜔𝑑𝑠𝑖𝑛θ𝑐𝑜𝑠𝜃 +
𝜔𝑒2
𝑒̇2 = −𝑣𝐸𝑐𝑜𝑠𝜃𝐸𝑠𝑖𝑛𝜃 + 𝑣𝑐𝑜𝑠𝜃𝑠𝑖𝑛𝜃 − 𝜔𝑑 sin2 𝜃 + 𝑣𝐸𝑠𝑖𝑛𝜃𝐸𝑐𝑜𝑠𝜃 −
𝑣𝑐𝑜𝑠𝜃𝑠𝑖𝑛𝜃
−𝜔𝑑 𝑐𝑜𝑠2 𝜃
− 𝜔𝑒1
𝑒̇3 = 𝜔𝐸 − 𝜔
𝑒̇1 = 𝑣𝐸𝑐𝑜𝑠𝜃𝐸𝑐𝑜𝑠𝜃 − 𝑣 + 𝑣𝑒𝑠𝑖𝑛𝜃𝐸𝑠𝑖𝑛𝜃
+ 𝜔𝑒2
(5.13)

𝑒̇2 = −𝑣𝐸𝑐𝑜𝑠𝜃𝐸𝑠𝑖𝑛𝜃 − 𝜔𝑑1


+ 𝑣𝑒𝑠𝑖𝑛𝜃𝐸𝑐𝑜𝑠𝜃 − 𝜔𝑒1
𝑒̇3 = 𝜔𝐸 − 𝜔

Recall 𝑒3 = 𝜃𝐸 − 𝜃, therefore:
cos 𝑒3 = cos(𝜃𝐸 − 𝜃) = 𝑐𝑜𝑠𝜃𝐸𝑐𝑜𝑠𝜃 + 𝑠𝑖𝑛𝜃𝐸𝑠𝑖𝑛𝜃
{ 𝑠𝑖𝑛𝑒3 = sin(𝜃𝐸 − 𝜃) = 𝑠𝑖𝑛𝜃𝐸𝑐𝑜𝑠𝜃 − 𝑐𝑜𝑠𝜃𝐸𝑠𝑖𝑛𝜃
The above equations then become:

𝑒̇1 = 𝑣𝐸𝑐𝑜𝑠𝑒3 − 𝑣 + 𝜔𝑒2


𝑒̇2 = 𝑣𝐸𝑠𝑖𝑛𝑒3 − 𝜔(𝑑1 + 𝑒1)
𝑒̇3 = 𝜔𝐸 − 𝜔
(5.14)
Or
𝑒̇1 𝑣𝐸𝑐𝑜𝑠𝑒3 −1 𝑒2
[𝑒̇2] = [𝑣𝐸𝑠𝑖𝑛𝑒3 ] + [ 0 −(𝑑1 𝑣
+ 𝑒1)] [ ] 𝜔
𝑒̇ 𝜔𝐸 0 −1
3

𝑒1
In conclusions:
𝑐𝑜𝑠𝜃𝐶 𝑠𝑖𝑛𝜃𝐶 𝑒 𝑐𝑜𝑠𝜃𝐶 𝑠𝑖𝑛𝜃𝐶 𝑋𝐸 − 𝑋𝐶
0 0
[𝑒2] = [−𝑠𝑖𝑛𝜃𝐶 𝑐𝑜𝑠𝜃𝐶 0] [𝑒𝑦] = [−𝑠𝑖𝑛𝜃𝐶 𝑐𝑜𝑠𝜃𝐶 0] [ 𝑌𝐸
𝑥

− 𝑌𝐶 ]

𝑒3 0 0 𝑒 0 0 𝜃 − 𝜃𝐶
1 𝜃 1 𝐸

6
Ho Chi Minh University of Technology Mechatronics system design project

𝑒̇1 𝑣𝐸𝑐𝑜𝑠 −1 𝑒2
𝑒 𝑣
[𝑒̇2] = [𝑣𝐸𝑠𝑖𝑛𝑒3 ] + [ 0 −(𝑑1 + 𝑒1)] [ ]
3

{ 𝜔
𝜔𝐸 0 −1
𝑒3
2. Controller design

The kinematic feedback controller will be based on (5.14). Here we will design the
𝒗
𝒖 = [ ]. Then we prove the stability through a chosen Lyapunov function.
controller based on Lyapunov direct method. First we propose the controller for the input


6
Ho Chi Minh University of Technology Mechatronics system design project

Propose a controller for input:

𝑣 = 𝑣𝐸𝑐𝑜𝑠𝑒3 + 𝑘1𝑒1
{𝜔 = 𝑘2𝑣𝑒𝑒2 + 𝜔𝐸 + 𝑘3𝑠𝑖𝑛𝑒3 (5.15)

Proving the stability of the controller, choose the considered positive Lyapunov
function:
1 1 − 𝑐𝑜𝑠𝑒3
𝑉 = (𝑒2 + 𝑒 2 ) +
2 1 𝑘2
2
(5.16)

𝑠𝑖𝑛𝑒3
The derivative of the function:

𝑉̇ = 𝑒 (𝑣 𝑐𝑜𝑠𝑒 − 𝑣) + (𝑘 𝑣 𝑒 + 𝜔 −
𝜔)
(5.17)

𝑘2
1 𝐸 3 2 𝐸 2 𝐸

From 3.15 and 3.17:


𝑘3
𝑉̇ = −𝑘 𝑒2 − sin2 𝑒
𝑘2
1 1 3
(5.18)

Hence, the controller (3.15) leads to achieve the time derivative 𝑉 is negative as
long as 𝑘1, 𝑘2, 𝑘3 > 0. That means the system (3.14) is stable with the controller (3.15)
in the sense of Lyapunov’s stability, and all tracking errors will be converged to zero as 𝑡
→ ∞. And, when starting with 𝑣0 ≈ 𝑣𝐸 , the error 𝑒1 can be set to be zero (or small
enough to be ignored).
Preliminarily choose 𝑘1 = 10 ; 𝑘2 = 100 ; 𝑘3 = 10
After the robot’s required speed 𝑣𝐸 , the robot’s required angular speed 𝜔𝐸 are
founded, with 𝐿 is the distance between two wheels, the speed of the left and right motors,
𝑣𝐿 and 𝑣𝑅, respectively can be found by:
2𝑣𝐸 − 𝜔𝐸𝐿
𝑣𝐿 =
(5.19)
2
2𝑣𝐸 + 𝜔𝐸𝐿
𝑣𝑅 =
(5.20)
2
In order for the vehicle to follow the line, the first job is to determine the vehicle's
position relative to the line. We set the coordinate system as shown in [Figure 5.2 a], in

From there we have the error 𝑒1 which is eliminated so we do not need to consider it.
which A is the midpoint between the two wheels, M is the midpoint of the sensor array.

Besides, the only type of error we can measure in the reality using line sensor is 𝑒2, while
𝑒3 can only approximated by equation [5.21].

𝑒2
− 𝑒′
(5.21)

𝑒 = arctan (2
)3
𝑑𝑆

6
Ho Chi Minh University of Technology Mechatronics system design project

a. The 𝒆𝟐 coordinate system b. The 𝒆𝟑 coordinate system

Figure 5.2. Robot line following eror 𝒆𝟐 and 𝒆𝟑

have both 𝑒2 and 𝑒2′ , but with only one array, we can find the 𝑒′ by
2 storing the 𝑒2 of the
In equation [5.17], the line tracking error suppose to be a 2-array sensor so that we

previous reading as 𝑒′ .
2
3. Controller simulation

Figure 5.3. The complete route in 2 senarios

In this tracking controller, when starting with 𝑣0 ≈ 𝑣𝑅 , the error 𝑒1 can be set to be
zero (or small enough to be ignored) resulting of the simulation is shown below.

𝑘1 = 3; 𝑘2 = 205; 𝑘3 = 3 , the robot’s motion with the tracking errors 𝑒2 and 𝑒3 are
After simulated the reference route in 2 scenarios (package “Red” or “Blue”), with

simulated as [Figure 4.2] and [Figure 4.3] with 𝑒2 = [−3.95,6.4] and 𝑒3 =


[−8.04,4.985] in both “Red package” and “Blue package” scenarios.

6
Ho Chi Minh University of Technology Mechatronics system design project

Figure 5.4. The errors 𝐞𝟐 and 𝐞𝟑 with the robot’s motion in “Red package” scenario

Figure 5.5. The errors 𝐞𝟐 and 𝐞𝟑 with the robot’s motion in “Blue package” scenario

As we are tracking the center of the line and the line is 26𝑚𝑚 width with tolerance of
±3𝑚𝑚 . For that reason, the allowable 𝑒2 is in the range of −16𝑚𝑚 to 16𝑚𝑚 . The
simulation shows that the controller surfer the requirement and a physical prototype will be
made. Moreover, further tuning will be applied to achieve the best performance.
4. Motor controller

The chosen motor is the JGA25-370 DC geared motor with encoder, with main shaft
rotation speed is 8500 rpm and output shaft is 250 rpm. Then, the maximum rotation speed
of the motor is 141.67 rev/s.
Since there are 11 ticks per cycle on the encoder, the motor’s maximum frequency is:
𝑓𝑚 = 141.67 ÷ 11 ≈ 13 (𝐻𝑧)
Applying Nyquist theorem for data sampling:
𝑓𝑠 ≥ 2𝑓𝑚
→ 𝑓𝑠 ≥ 26 𝐻𝑧
Choose sampling rate 𝑓𝑠 = 65(𝐻𝑧) → 𝛿𝑡 ≈ 0.015 (𝑠)

6
Ho Chi Minh University of Technology Mechatronics system design project

Then:
𝑁 × 𝛿𝑡 = 𝑚 × 𝑇𝑚
→ 𝑁 × 0.015 = 𝑚 × 0.077 (𝑚: 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑖𝑛𝑡𝑒𝑔𝑒𝑟)
We choose 𝑁 = 77; 𝑚 = 15.
To further observe the linearity and the dead band between the input (%𝑃𝑊𝑀)
and the output revolution of the motor’s shaft (𝑟𝑝𝑚), the 𝑃𝑊𝑀 signal is fed into the
motor, start with 0 and increment 1 every 0.5s. After that, we read the 𝑟𝑝𝑚 signal from
the encoder.

(a) Left motor (b) Right motor

Figure 5.6. The reponses of right and left motor corresponding to PWM

according to the PWM and the range between 𝟎 − 𝟓% is the motor deadband.
From [Figure 5.5], it can be seen that the speed of the motor is a linear function

To find the motor transfer function, the output signal is the revolution of the output

motors, which is recorded for 5 seconds.


shaft (rpm), input is PWM. In this section, a single pulse is used to examine the response of

Figure 5.7. The step response of motors according to 50% duty cycle

6
Ho Chi Minh University of Technology Mechatronics system design project

Applying the above data to MATLAB System Identification Toolbox (SIT), we obtain
the following transfer function of the motor:
24.48
𝐺𝑟𝑖𝑔ℎ𝑡(𝑠) =
𝑠 + 25.56
(5.21)

23.68
𝐺𝑙𝑒𝑓𝑡(𝑠) =
𝑠 + 24.72
(5.22)

Figure 5.8. Step responses of right and left motors

Table 5.1. Characteristics of the motors’ step responses

Characteristics Motor Right motor Left motor

Rise Time 1.22 𝑠 1.24 𝑠

SettlingTime 2.18 𝑠 2.21 𝑠

Overshoot 0% 0%

Peak 0.976 0.955

Verification of the transfer function


Using the command ‘compare’ of MATLAB, we can compare the new found
transfer functions with another dataset that recorded the motors’ step responses according
to 100% duty cycle. As we can observe from [Figure 5.8], the transfer functions found by
MATLAB toolbox can fiitted around 70% to other values of the motors.

7
Ho Chi Minh University of Technology Mechatronics system design project

Figure 5.9. Comparision between 100% duty cycle step responses of motors
and the transfer function found

PID controller
Due to experiments, it’s proved that the Derivative term of PID controller causing
the motor to jiggling, therefore, we only used PI controller. Using MATLAB’s PID tuner
app and SIMULINK, the PI parameters of the transfer functions are found:

Figure 5.10. Step responses of right and left motors with PI controller in MATLAB

Table 5.2. Characteristics of the motors’ step responses with PI controller in


MATLAB

Characteristic Motor Right motor Left motor

7
Ho Chi Minh University of Technology Mechatronics system design project

𝐾𝑃 0.106 0.112

𝐾𝐼 4.06 5.2

SettlingTime 0.1 𝑠 0.103 𝑠

Overshoot 0% 0%

Peak 1 1

Steady state error 0% 0%

After doing some experiments, we found the PID parameters through trials and
errors with the results in [Table 5.3].

Figure 5.11. Step responses of right and left motors with PID controller through
experiments

Table 5.3. Characteristics of the motors’ step responses with PID controller
through experiments

Characteristic Motor Right motor Left motor

𝐾 1.05 1.05
𝑃

𝐾 0.03 0.03
𝐼

SettlingTime 0.09 𝑠 0.09 𝑠

Steady state error 6.67 % 6.67 %

up to ±14.4% , these are due to the speed calculation makes that the speed is
In [Figure 5.10], the step responses show that there are times when the error can be

[128.34,139.04,149.73,160.43,171.12] with the corresponding encoder pulses


per sampling time ranges from 12 to 16.

7
Ho Chi Minh University of Technology Mechatronics system design project

Figure 5.12. Step responses of right and left motors with PID controller through
experiments in 10 seconds

7
Ho Chi Minh University of Technology Mechatronics system design project

CHAPTER 6. CONTROL ALGORITHM DESIGN


1. Master control algorithm

b. c. d.

a. e.

Figure 6.1. The flowcharts of a. Master, b. Line following procedure, c. Controller, d.


Load handling process, e. Intersection process

7
Ho Chi Minh University of Technology Mechatronics system design project

2. Slave control algorithm

Figure 6.2. The flowcharts of slave (left) and the PI controller (right)

7
Ho Chi Minh University of Technology Mechatronics system design project

CHAPTER 7. EXPERIMENT AND EVALUATION


1. Experiment result
1.1. Mechanical structure of the robot
According to the design of the robot, our group have manufactured some unique
components such as the shaft to ensure that two rotating shafts of the motors are
concentric. Below is some picture of the robot.
1.2. Electrical components
Line sensor can effectively detect the back line on the white background and the
shield helps the sensor to be insusceptible to environment light noise. The overall PCB also
works accordingly, all the voltage regulator can stably maintain the appropriate voltage
level, and there is not sight of heat exposure during operation.

Figure 7.1. Sensor PCB in reality

7
Ho Chi Minh University of Technology Mechatronics system design project

Figure 7.2. System PCB in reality

1.3. Experiment result on real physical model

Figure 7.3. Robot at the loading point

Figure 7.4. Robot goes to the destination

Robot can follow the line properly in a variety of environment light conditions with
small line error even at quite high speed. The robot also has successfully detect the color of
the load and carry to the right end point.
2. Limitation and improvements
2.1. Mechanical manufacturing

7
Ho Chi Minh University of Technology Mechatronics system design project

Limitations: The design is too complex for assembling the components together as it
takes times to assemble and separate which makes difficulty for components replacements.
2.2. Electrical components
Limitations:
- From the beginning, we design four buck converters on our circuit and it leads to
the malfunction in our PCB so we have to replace it with another one.
- The coil on the new PCB sometimes heated up and released smoke which can
damage our system.
Improvements:
- We should check the PCB design carefully first before manufacturing.
- We should try to have a appropriate wiring for our PCB so that we can ensure all
the essential wires and power source wires are connect precisely.
2.3. Control system
Limitations:
- Our system sometimes lost the control so it cannot detect the line properly.
- Sometimes the color sensor value is incorrect and the robot will carry the load to
the wrong destination.
Improvements:
- We should have a shield for the color sensor for better performance of the system.
3. Conclusion and future development
3.1. Conclusions
After this line follower and obstacle avoidance robot project, our group has completed
the following objectives
- Researches about the current researches and model of line following and obstacle
avoidance robot in the reality.
- Know-how to prepare and plan for a mechatronics project.
- Designed, manufactured and conduct experiment on the robot which has
successfully not only follow the line, but also detect and avoid the obstacle at
arbitrary positions on the line path.
- Complete all the documents and required drawings in time.
3.2. Future development
- Expand the capability to carry and transport load for the robot to be utilized in
warehouses.
- Improve the line following controller using Fuzzy-PID adaptive control to improve
the line error.

7
Ho Chi Minh University of Technology Mechatronics system design project

REFERENCE
[1] Reza N. Jazar (2017) - Vehicle Dynamics: Theory and Applications, Springer
International Pulishing.
[2]LD-60 Autonomous Mobile Robot,
[Link]
series_mobile_robot_datasheet_en.pdf
[3] Electric AGV - AWRM-PO700 - automationware - omnidirectional
([Link])
[4] Pioneer 3-AT, Adept Mobile Robot, available:
[Link]
[5] ez-Wheel, SWD Started kit for AGV&AMR, Instruction manual.
[6] Battery options for mobile robots, available:
[Link]
[7] Nguyễn Tấn Tiến, Trần Thanh Tùng, Kim Sang Bong (2016), Giảng dạy thiết kế
hệ thống cơ điện tử qua đồ án, Hội nghị toàn quốc lần thứ 8 về Cơ Điện tử.
[8] Different types of motors used in robotics, available:
[Link] robotics#:~:text=DC%20motors
%20are%20commonly%20used,need%20for%20high%20i nitial%20torque.
[9] Lam, H. D., Le, T. D. H., Phan, T. T., & Nguyen, T. T. (2014, November).
Smooth tracking controller for AGV through junction using CMU camera. In The 7th
Vietnam Conference on Mechatronics (pp. 597-601).
[10] An Intelligent Line-Following Robot Project for Introductory Robot Courses,
2010.
[11] M. S. Islam, Design and Fabrication of Line Follower Robot, Asian Journal of
Applied Science and Engineering, Volume 2, No 2, 2013.
[12] Juing-Huei Su, An intelligent line-following robot project for introductory robot
courses, World Transactions on Engineering and Technology Education, Vol.8, No.4,
2010.
[13] Difference Between Phototransistor and Photoresistor (LDR),
available: [Link]
phototransistor- [Link]
[14] ROBOT PLATFORM,[Link]:
[Link]
[Link].
[15] IQS Directory, 2023. Available:
[Link]
guided- [Link]#:~:text=Three%20types%20of%20AGVs%20are,to%20be
%20recharged%2 0or%20repaired.

7
Ho Chi Minh University of Technology Mechatronics system design project

[16] Oguten, S., & Kabas, B. (2021). PID Controller Optimization for Low-cost Line
Follower Robots. arXiv preprint arXiv:2111.04149.
[17] Engin, M., & Engin, D. (2012, September). Path planning of line follower
robot. In 2012 5th European DSP Education and Research Conference (EDERC) (pp. 1-5).
IEEE.
[18] Ismail, A. H., Abdul Zaman, A. M., & Terashima, K. (2016). Fuzzy logic
approach for line following mobile robot using an array of digital sensors. IJAIEM,
5(7), 108-115.
[19] Azzabi, A., & Nouri, K. (2021). Design of a robust tracking controller for
a nonholonomic mobile robot based on sliding mode with adaptive gain. International
journal of advanced robotic systems, 18(1), 1729881420987082.
[20] R. [Link], in Vehicle Dynamics - Theory and Application.
[21] T. C. –. L. V. Uyển, “Thiết kế hệ thống dẫn động cơ khí tập 2”.
[22] N. Đ. Tốn, “Dung sai và lắp ghép”.
[23] Control tutorial for MATLAB & SIMULINK, DC Motor Speed: System
Modeling, available at: [Link]
example=MotorSpeed&section=SystemM odeling
[24] Curio Res (2021). How to design and implement a digital low-pass filter on an
Arduino. Available at:
[Link]
[25] R. [Link], in Vehicle Dynamics - Theory and Application.
[26] A. M. &. B. A. Joseph [Link], "Mobile Robot Inspirational to
Implementation," p. 221.
[27] F. [Link], “Electric Motors and Control Systems,” pp. 117 - 118.

8
Ho Chi Minh University of
Weeks
Works Number of days 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
I. Overview 84
Introduction and reasearch related issues 21
Research on available models 21
Select parameters and approach 21
Adjust an overview 84
II. Design
1. Mechanics 42
Calculate and select of motor 14
Design of frame 14
Draw 3D drawing and adjust parameters 21
Draw 2D drawing 21
Adjust parameters of 2D drawing 35
2. Electrics 49
Build a schematic diagram of electrical system 1
Select components of electrical system 14
Design driver 21
Select and test sensors 21
Read data of sensors 21
Adjust parameters 35
3. Control 49
Model the kinematic for mobile robot 7
Model the kinematic for the system 7
Determine transfer function of motor, driver 7
Design PID for motors 21
Design state feedback controller 21
Model sensors, kinematic system 28
Adjust parameters 28
4. Simulation 35
Programming 21

Mechatronics system design


Define simulation requirements 21
Specify specific parameters 21
Simulation 21
Evaluate data 21
Propose adjustments ( if possible ) 14
III. Complete 14
Complete reports and drawings 14
IV. Project defense 7

All members
Phan Hoàng Duy
Hồ Lê Khánh Dy
Nguyễn Trung Đức
Lê Tiến Đạt
7

You might also like