Professional Documents
Culture Documents
STUDENT REPORT
Supervisor
Assoc.Prof Le My Ha
Submitted by
Le Tran Vu Hoang
Nguyen Quoc Vinh
La Gia Bao
Hoang Duong
Trinh Nguyen Anh Hao
Abstract ii
List of Tables iv
Assignment of work v
1 Overview 1
1.1 Introducing of line following robot . . . . . . . . . . . . . 1
1.2 Objective of Study . . . . . . . . . . . . . . . . . . . . . 2
1.3 General operating principles . . . . . . . . . . . . . . . . 2
1.4 Application of line following robot . . . . . . . . . . . . . 2
3 Results 18
3.1 Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1
3.2 Running results and review . . . . . . . . . . . . . . . . . 19
3.2.1 Running results . . . . . . . . . . . . . . . . . . . 19
3.2.2 Review . . . . . . . . . . . . . . . . . . . . . . . 19
4 Discussion 20
4.1 Advantage . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2 Disadvantage . . . . . . . . . . . . . . . . . . . . . . . . 20
4.3 Future work . . . . . . . . . . . . . . . . . . . . . . . . 20
5 Reference 21
i
Abstract
In this project, we develop the line following robot. Module L298N is chosen as the main
controller.Arduino uno R3 is the brain which control the robot.We use Closed Loop control
and PID control for this project.Dynamic PID control algorithm has been proposed to improve
the navigation reliability of the wheeled mobile robot which uses differential drive locomotion
system. The experimental results show that the dynamic PID algorithm can be performed
ii
List of Figures
2.4 Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.5 Motor V1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 Wheel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
iii
List of Tables
iv
Assignment of work
v
Chapter 1
Overview
nology and mechatronics. These fields come together into systems that automate and, more-
over, automate the entire manufacturing process. Automation companies play an increasingly
important and essential role to meet economic development goals, especially in today’s fast-
moving work process. It asks a highly qualified human resource to operate. In the world
today, there are many types of robots: Large-scale such as: Machine arms in production lines,
automatic production systems. In addition are robots capable of moving, doing dangerous
jobs to replace humans, robots to help the elderly, sales robots ... etc. In this project I do the
line of detection robots, compared to the above robots. Just a small, simple robot, but this
is the foundation for me to make air conditioners, more useful in the process of learning and
doing of me after this. A line follower robot is basically a robot designed to follow a line or
path already pre determined by the user. This line or path may be as simple as a physical black
straight line on the floor or complex line: circle, the round number eight,zigzag... In order to
detect these lines, we use sensor system, it can be individual sensors connected together or
expansive vision systems with many sensors .The choice of these schemes is the key to decide
1
1.2 Objective of Study
We looked up reference on the internet. And they did complete this project better than us. We
• The robot must also be capable of following a line even if it has breaks.
• The robot must be insensitive to environmental factors such as lighting and noise.
The robot moves in a predetermined trajectory thanks to a guide, the two-wheel system is
driven by two DC electric motors through a control circuit and a power circuit. Often the
guides will have a different color from the background color of the moving trajectory. In
order for the robot to move on the right orbit, it is necessary to have a sensor, which is re-
sponsible for distinguishing the guide line and the background color of the moving trajectory.
In order for the robot to move in the right trajectory, it is necessary to have a sensor, which
is responsible for distinguishing the guide line and the background color, bringing the corre-
sponding electrical signal to the control circuit. The control circuit is responsible for receiving
feedback from the sensor, thereby controlling the speed and direction of rotation of two DC
electric motors so that the car always sticks and moves according to the guide.[1]
From the industrial point of view, line following robot has been implemented in semi to fully
autonomous plants. In this environment, these robots functions as materials carrier to deliver
products from one manufacturing point to another where rail, conveyor and gantry solutions
2
are not possible. Apart from line following capabilities, these robots should also have the ca-
pability to navigate junctions and decide on which junction to turn and which junction ignore.
This would require the robot to have 90 degree turn and also junction counting capabilities.
To add on to the complexity of the problem, sensor positioning also plays a role in optimizing
the robots performance for the tasks mentioned earlier. Line-following robots with pick- and-
placement capabilities are commonly used in manufacturing plants. These move on a speci-
fied path to pick the components from specified locations and place them on desired locations.
The control principle is still inertia, but the robot path is detected
3
Chapter 2
In this project, we had a lot of ideas such as buying frame or designing a new frame. Then
we decided to make a new frame. We used Solidworks to do that. The first, we thought about
using screw to connect electronic appliances but it took a lot of time. So we decided use glue
to connect them. Because it’s very convenient and simple. We have referenced but we used
module L298N and Arduino Uno R3 so we can’t stack it. We designed a long frame to put
on electronic appliances. During the process, we had a problem. We forgot about position of
the sensor. To repair it, we used Solidworks to design two plates mica. And then, we used
glue to connect sensor with frame. Because we used a long frame so two wheels were not
4
2.1.2 Select electronic appliances
Arduino
Nowadays, we have many Arduino such as Arduino Mega R3, Arduino nano V3, Arduino
Leonardo,. . . but in this project we choose Arduino Uno R3.Uno is a great option. It has
Microcontrollers ATmega328
Operating volt-age 5v
Operating frequency 16 MHz
Consumption stream 30mA
Recommended input voltage 7-12V - DC
Input voltage limit 6-20V - DC
Digital I/O pin number 14 (6 pins PWM)
Analog pin number 6 (10bit resolution)
Maximum current per I/O pin 30mA
Maximum out-put current (5V) 500mA
Maximum out-put current (3.3V) 50mA
Flash memory 32KB (ATmega328) with 0,5kb used by the bootloader
SRAM 2KB (ATmega328)
EEPROM 1KB (ATmega328)
5
Module L298N
Module L298N can control 2 DC motors or 1 stepper motor. Because we used two wheels so
we need 4 holes located at 4 corners and L298N provided it for us. It is very convenient for
us. And we know there is an anti-heat heatsink for the IC, helping the IC to control the peak
current of 2A The L298N IC is attached to the on-board diodes to help protect the micropro-
cessor against the induced currents from starting or turning off the engine. It is very useful
6
Sensor
We decided used 5 sensors. We began with TCRT5000 but it is difficult because one TCRT5000
has one sensor. Then we used The 5-leds bar line detector. It is very convenient. It is designed
to detect black and white lines. On the sensor bar there are 5 infrared sensors pointing to the
7
Motor
We discussed between motor V1 and motor GA25 12V620RPM. Motor GA25 12V620RPM
make from metal so it is better than motor V1 but it is more expensive than motor V1. We
reference on the internet and motor V1 is not bad. It is very suitable for this project. So we
Wheel
In this project, we used 2 types: wheel V1 and multi-purpose wheel. Because our design
needs from 3 wheels to 4 wheels to balance so we used 3 wheels. If we used 4 wheels V1, it
8
These are two picture which we used Solidworks to draw model wheel
Battery
According assistant Mr. Cuong, Li – po battery ( lithium polymer battery ) is very good. They
are light weight and have improved safety. It can refresh so we just buy one time. We used 2
Voltage 3.7V
Capacity 500mAh
Size 50 x 30 x 3.5mm
9
2.1.3 Cost estimation
We reference on the internet and then we assembled electronic appliances completely. This is
10
2.2 Software design
2.2.1 A algorithm idea
When the vehicle is operating, the sensor will collect information and convert it into an elec-
trical signal to the microcontroller. The received value will be compared with the preset value.
Based on the value of the sensor sent, determine the relative deviation between the orbit of the
robot and the desired trajectory, then compare that deviation into levels. Based on the devia-
tion levels, adjust the speed of the left and right wheels to return the robot to the fund religion.
Specifically, to turn left the robot’s right wheel speed is one value faster than the left one
correspond to the deviation levels (need to test many times), and vice versa. This method is
simple, but the robot runs unstable, sometimes very fast, sometimes slowly, Stability is highly
dependent on the robot’s motor and mechanical construction. To overcome this drawback, by
11
2.2.2 Working principle of Sensor
One sensor head will emit infrared rays. If there are no obstacles, the infrared will continue.
The other end is the receiver that won’t get anything, it will return -1. In the case of an
obstacle, the infrared rays are reflected back, the receiver will obtain and return the value
0. In the case of a dark surface, the infrared rays will absorb all the returned infrared rays.
If line is centered in front of robot, line following robot goes forward. When the center sensor
is high and the remaining sensor is low the center sensor is will always be on the line and as
If line is right of center, the robot turns right. When the right sensor is high, the remaining
sensor is low and the center sensor is will always be on the line and as line is black in color.
12
If line is left of center, beside of the robot, it turns left. When the left sensor is high and the
remaining sensor is low the center sensor is will always be on the line and as line is black in
color.
2.2.4 Code
float previous_error = 0;
#define In1 7
#define In2 8
#define In3 9
#define In4 10
#define ENA 6
13
#define ENB 11
void dung();
void chay_thang();
void setup()
Serial.begin(9600);
void loop()
read_sensor_values();
14
calculate_pid();
motor_control();
void read_sensor_values()
{ sensor[1] = digitalRead(A0);
sensor[2] = digitalRead(A1);
sensor[3] = digitalRead(A2);
sensor[4] = digitalRead(A3);
sensor[5] = digitalRead(A4);
error = -4;
error = -3;
&& (sensor[4] == 1)
error = -2;
15
&& (sensor[4] == 1) && (sensor[5] == 0))
error = -1;
error = 0;
error = 2;
error = 3;
error = 4;
void calculate_pid()
P = error;
previous_error = error;
16
}
void motor_control()
digitalWrite(In1, LOW);
digitalWrite(In2, HIGH);
digitalWrite(In3, LOW);
digitalWrite(In4, HIGH);
analogWrite(ENA, PID_phai);
analogWrite(ENB, PID_trai);
17
Chapter 3
Results
3.1 Robot
Although there are many controversies and disagreements, we did completely this project.
Robot completed on schedule. Rugged and safe hardware during heavy travel. The circuit
inspection part still had errors, but was promptly corrected. During the project, we had 2 trou-
bles. Firstly,when finished assembling the parts together and loading the code. The car was
on, but the wheels were not working. Secondly, Vehicle was not stable, has much fluctuation.
But we fixed it. The idea of making a hybrid robot car was inspired by the team from F1
racing. And we did it complete. Many groups in class buy frame in the store but we designed
18
3.2 Running results and review
3.2.1 Running results
We used black electrical tape to test the robot.The result is that divine into two parts.Before
using the PID control, the car moved unstable and sometimes ran out of the line. When
we tested on the circle road, the car can’t follow line.Then we tested on the straight road,
it ran but it didn’t run straightly. After using PID control the robot runs on the black road,
runs according to the required algorithm, completes the task well. Demonstrates the fully
automatic ability of the robot tracing model. It runs better than before. It can run straightly
on the straight road. If we didn’t use PID control, the car still follow line but it is very slow.
3.2.2 Review
Complicated circuit design, assembly, and repair process takes a lot of time. We had many
troubles. Many times, we didn’t know we wrong until the car didn’t operate. And we didn’t
know why we wrong? And thanks to tutor Mr. Cuong, we fixed it. We used PID control for
the code. Adjusting PID parameters still takes a long time due to manual change of numbers
(test many times). We tried to understand nature of PID control but we couldn’t understand.
So we don’t reach desired values. Because of reason so the car is not perfect. And our design
is not beautiful. Our code is not good.The car ran badly on the circle road.
19
Chapter 4
Discussion
4.1 Advantage
We learned a lot of things when we did completely this project. We knew how to use Solid-
works to simulate electronic appliances, use LaTeX to write report, use program Arduino IDE
to code and skill teamwork. About the car, we know how to assemble it. We know about write
basic code Arduino. My frame of car is different many groups.The car has followed the line.
This is the first time, we have had a model which we did by hand. And special, we know how
to real teamwork.
4.2 Disadvantage
Our design is not really beautiful. The car is still unstable, still slightly shaking. The speed of
the car is not fast. During the assembly process, there are still many errors leading to many
changes compared to the intended. Teamwork still has many problems, leading to poor work.
In the future, we will make frame better than it. We will improve code to make the robot
smarter, follow line better, more stable and run fast. We will try to add more function when
the robot is stability. Following line is very important. We can develop it to make highly
application robots. And we will improve skills about code and teamwork.
20
Chapter 5
Reference
Bibliography
[1] Chu Quang Thao - Trinh Tai Tuan - Phan Cao Khanh, Report about line following robot
with PID control, in: Institute of Military Technology, 4, Slideshare- Education, 2015
[2] Bac Tho Ho, Instruction about line following robot with PID, Part
fbclid=IwAR2CsVMciYk6WYGPg-7myLxzFQSRB5O2CKpT0_
uyMbeVEWqj92b856suEDE&v=l3uJ-5UvjE4&feature=youtu.be
[3] Sujeet Kumar Jha - Saurab Dulal - Manish Karn - Ahmed Raja Khan, Report line fol-
[4] ANUSHA, How to make Arduino line followe robot, in: Elec-
arduino-line-follower-robot/
[5] Do Choi STEM, 32 Xe do line - Khoa hcc Xe robot lap trinh arduino, in: Youtube,
31/12/2019, https://www.youtube.com/watch?v=hcpMSw-y81g&t=194s
[6] Khin Khin Saw - Lae Yin Mon, Design and Construction of Line Following Robot us-
ing Arduino, in: International Journal of Trend in Scientific Research and Development
[7] https://icdayroi.com/
21