0% found this document useful (0 votes)
16 views

Line Follower Robo Lab

Uploaded by

suhaspjs492003
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)
16 views

Line Follower Robo Lab

Uploaded by

suhaspjs492003
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
You are on page 1/ 28

ROBOTICS AND INDUSTRIAL AUTOMATION LAB

LINE FOLLOWER ROBOT USING ARDUINO

Internship Report

Submitted by

Suhas P J 1MJ22CS182

K N Nithin Shetty 1MJ22CS084

Hemanth J N 1MJ22AS011

Rkesh Reddy 1MJ22EC053

Under the guidance of

Prof. L. David William Raj

Prof Ustab Banerjee

Prof MR.Subhradip Mukherjee

Department of ECE

MVJ College of Engineering

In Partial fulfillment for the award of degree

of

Bachelor of Engineering
In
Artificial Intelligence and Machine Learning & Information Science
2023-24
ACKNOWLEDGEMENT

We are indebted to our guide, Prof. L. David William Raj, Assistant


Professor, Department of Electronics and Communication Engineering for
his whole hearted support, suggestion and invaluable advice throughout the
Internship and also for the help in the preparation of this report. We would
also like to extend our gratitude to Prof. L. David William Raj, Assistant
Professor, Department of Electronics and Communication Engineering for
his /her guidance in carrying out the internship.

Our sincere thanks to Dr. Sajithra Varun S, Assistant Professor and Head of
Electronics and Communication Engineering, MVJCE for her support and
encouragement.

We express sincere gratitude to our beloved Principal, Dr. V. Suresh Babu


for his appreciation towards the internship.

We are thankful to our Vice-Principal Dr. M. Brindha, for her


encouragement and support throughout the semester.

We thank all the technical and non-technical staff of Electronics and


Communication Engineering department, MVJCE for their help.
ABSTRACT

The project describes the techniques for analyzing, designing, controlling


and improving the material supply delivery within hospitals. Due to increasing
demands for patient supervision, the jobs like supply of food, medicines etc., has
become a time consuming process. So, a microcontroller based line following
robot carrying medicine can be designed for providing the medicine to the patient
whenever they need it. A line follower robot is an electronic system that can
detect and follow a line drawn on the floor.

The robot uses IR sensors to sense the line, an array of 2 IR LEDs and
sensors, facing the ground have been used in this setup. An IR sensor can be
fitted near the patient's bed to which connection has been made with the robot
too. The switch for it can be activated by the supply person in the microcontroller
itself. If the switch is pressed then a flag bit is set in the microcontroller, from
which the robot follows the line and reaches near the patient and provide the
medicine to the patient. A proximity sensor can be attached with the robot so that
it detects any obstack present in their way and can alarm.

The ability to get someone around the clock is the best thing that this system
can do. This helps and simplifies the job of material supply and also reduces the
manual routine work done by the hospital staff. This technology focuses on the
delivery of safe, timely, efficient, effective, patient-centred health care. It can be
used industrial automated equipment carriers, small household applications, tour
guides in museums and other similar applications, etc.
Capturing the line position with optical sensors mounted at the front end
of the robot. Most are using several numbers of photo-reflectors, and
some leading contestants using an image sensor for image processing.
Therefore, the line sensing process requires high resolution and high
robustness.

2.
Steering the robot to track the line with any steering mechanism. This is
just a servo operation; actually, any phase compensation will be required
to stabilize tracking motion by applying digital PID filter or any other servo
algorithm.

3.
Controlling the speed according to the lane condition. The speed is
limited during passing a curve due to the friction of the tire and the floor.
Better mechanisms, therefore, can improve the power of manoeuvre. The
speed of the robot, hence, can be increased. Consequently, the robot's
performance can be increased, too.

Sign
Working of a Line Follower Robot
As stated earlier, line follower robot (LFR) follows a line, and in order to follow
a line, robot must detect the line first. Now the question is how to implement the
line sensing mechanism in a LFR. We all know that the reflection of light on the
white surface is maximum and minimum on the black surface because the black
surface absorbs maximum amount of light. So, we are going to use this property
of light to detect the line. To detect light, either LDR (light-dependent resistor) or
an IR sensor can be used. For this project, we are going with the IR sensor
because of its higher accuracy. To detect the line, we place two IR sensors one on
the left and other on the right side of the robot as marked in the diagram below.
We then place the robot on the line such that the line lies in the middle of both
sensors. We have covered a detailed Arduino IR sensor tutorial which you can
check to learn more about the working of IR sensors with Arduino Uno.

Infrared sensors consist of two elements, a transmitter and a receiver. The


transmitter is basically an IR LED, which produces the signal and the IR receiver
is a photodiode, which senses the signal produced by the transmitter. The IR
sensors emits the infrared light on an object, the light hitting the black part gets
absorbed thus giving a low output but the light hitting the white part reflects back
to the transmitter which is then detected by the infrared receiver, thereby giving
an analog output. Using the stated principle, we control the movement of the
robot by driving the wheels attached to the motors, the motors are controlled by a
microcontroller.

How does a Line Follower Robot Navigates?


A typical line follower robot has two sets of motors, let's call them left motor and
right motor. Both motors rotate on the basis of the signal received from the left
and the right sensors respectively. The robot needs to perform 4 sets of motion
which includes moving forward, turning left, turning right and coming to a halt.
The description about the cases are given below.

Moving Forward:
In this case, when both the sensors are on a white surface and the line is between
the two sensors, the robot should move forward, i.e., both the motors should
rotate such that the robot moves in forward direction (actually both the motors
should rotate in the opposite direction due to the placement of motors in our
setup. But for the sake of simplicity, we will call the motors rotating forward.)

Turning LEFT:
In this case, the left sensor is on top of the dark line, whereas the right sensor is
on the white part, hence the left sensor detects the black line and gives a signal,
to the microcontroller. Since, signal comes from the left sensor, the robot should
turn to the left direction. Therefore, the left motor rotates backwards and the right
motor rotates in forward direction. Thus, the robot turns towards left side.

Turning RIGHT:

This case is similar to the left case, but in this situation only the right sensor
detects the line which means that the robot should turn in the right direction. To
turn the robot towards the right direction, the left motor rotates forward and the
right motor rotates backwards and as a result, the robot turns towards the right
direction.

Stopping:
In this case, both the sensors are on top of the line and they can detect the black
line simultaneously, the microcontroller is fed to consider this situation as a
process for halt. Hence, both the motors are stopped, which causes the robot to
stop moving.

Why We Require a Motor Driver?

The reason to use a motor driver here is because the output signal of an Arduino
is not sufficient to drive the motor, furthermore, we need to rotate the motors in
both directions, therefore we use a motor driver to drive the motor as required
and also the motor driver is able to supply sufficient current to drive the motor.
Here, we are using a L293D motor driver which is a dual h bridge motor driver
and is sufficient for our 2 motors.

Components Required for Making Arduino Line Follower Robot

1. Arduino Uno - 1Nos

2. L293D motor driver- 1Nos

3. IR sensor module -2 Nos

4. 7.4 or 9V battery -1 Nos

5. BO motor - 2 Nos

6. Motor wheel - 2 Nos


7. Castor wheel - 1 Nos

8. Hobby robot chassis - 1 Nos

9. Wires

10. Screw

Circuit Diagram and Assembling the Arduino based Line Follower Robot
The circuit consists of mainly four parts: Two IR sensors, one motor drive, two
motors, one Arduino, a battery and few connecting wires. The sensor senses the
IR light reflected from the surface and feeds the output to the onboard op-amp
comparator. When the sensor is situated over the white background, the light
emitted by the sensor is reflected by the white ground and is received by the
receiver. But when the sensor is above the black background, the light from the
source doesn’t reflect to it. The sensor senses the intensity of reflected light to
give an output. The sensor’s output is fed to the microcontroller, which gives
commands to the motor driver to drive the motor accordingly. In our project, the
Arduino Uno is programmed to make the robot move forward, turn right or turn
left and stop according to the input coming from the sensor. The output of the
Arduino is fed to the motor driver.

As stated earlier, line follower robot (LFR) follows a line, and in order to follow
a line, robot must detect the line first. Now the question is how to implement the
line sensing mechanism in a LFR. We all know that the reflection of light on the
white surface is maximum and minimum on the black surface because the black
surface absorbs maximum amount of light. So, we are going to use this property
of light to detect the line. To detect light, either LDR (light-dependent resistor) or
an IR sensor can be used. For this project, we are going with the IR sensor
because of its higher accuracy. To detect the line, we place two IR sensors one on
the left and other on the right side of the robot as marked in the diagram below.
We then place the robot on the line such that the line lies in the middle of both
sensors. We have covered a detailed Arduino IR sensor tutorial which you can
check to learn more about the working of IR sensors with Arduino Uno.

Infrared sensors consist of two elements, a transmitter and a receiver. The


transmitter is basically an IR LED, which produces the signal and the IR receiver
is a photodiode, which senses the signal produced by the transmitter. The IR
sensors emits the infrared light on an object, the light hitting the black part gets
absorbed thus giving a low output but the light hitting the white part reflects back
to the transmitter which is then detected by the infrared receiver, thereby giving
an analog output. Using the stated principle, we control the movement of the
robot by driving the wheels attached to the motors, the motors are controlled by a
microcontroller.

Why We Require a Motor Driver?

The reason to use a motor driver here is because the output signal of an Arduino
is not sufficient to drive the motor, furthermore, we need to rotate the motors in
both directions, therefore we use a motor driver to drive the motor as required
and also the motor driver is able to supply sufficient current to drive the motor.
Here, we are using a L293D motor driver which is a dual h bridge motor driver
and is sufficient for our 2 motors.

The L293D has 16 pins, the pinout of L293D is shown in the below diagram.

Connection of motor driver pins are as follows:

Pin number 1 and 9 are the enable pins, we connect these two pins to a 5v input
to enable the motor.

Pin number 1A, 2A, 3A, and 4A are the control pins.

For eg. The motor will turn to the right if the pin 1A goes low and 2A goes high,
and the motor will turn to the left if 1A goes low and 2A high. So, we connect
these pins to the output pins of the decoder.

Pins 1Y, 2Y, 3Y, and 4Y are the motor connection pins.

Note: Vcc2 is the motor driving voltage pin, and only used if you are using a
high voltage motor.

Pin connection of Arduino Uno with the Motor driver are as follows:

Here, we are using a 7.4 li-ion battery to power the whole circuit. You can use
any battery type from 6-12 volt. To move the robot, we need to use motors with
low RPM but torque high enough to carry the weight of the robot. So, I chose
two 60 RPM 6V Battery Operated, geared motors for this robot.
Here, we are using a 7.4 li-ion battery to power the whole circuit. You can use
any battery type from 6-12 volt. To move the robot, we need to use motors with
low RPM but torque high enough to carry the weight of the robot. So, I chose
two 60 RPM 6V Battery Operated, geared motors for this robot.

Here, we are using a 7.4 li-ion battery to power the whole circuit. You can use
any battery type from 6-12 volt. To move the robot, we need to use motors with
low RPM but torque high enough to carry the weight of the robot. So, I chose
two 60 RPM 6V Battery Operated, geared motors for this robot. Here, we are
using a 7.4 li-ion battery to power the whole circuit. You can use any battery type
from 6-12 volt. To move the robot, we need to use motors with low RPM but
torque high enough to carry the weight of the robot. So, I chose two 60 RPM 6V
Battery Operated, geared motors for this robot. To make this robot, first we need
a robot body; here I am using a homemade chassis. You can either use a
readymade chassis or build one yourself.

Now, place the BO motors to the chassis with the help of some hot glue as shown
in the image below.

Next step is to place the motor driver on chassis and connect the motor wires to
the output of the motor driver.

Next, bend the IR LED and sensor as shown in the image.


Then place the sensors on the downside of the robot, adjust the sensors according
to the track width and robot width. Remember that one sensor is for left side
detection and another is for the right side detection.

Now place the Arduino uno using glue and connect the sensor output pins to
digital pin 2 and 4 of the Arduino.

Connect the VCC pins to 5volt and the ground pins to ground.
Now, connect the enable pins of the motor driver to pin 5 and 8 of Arduino and
connect the motor driver input pins to pin number 6, 7, 9 and 10 of Arduino
respectively.

Finally, connect the battery with the circuit and place the battery on chassis.
Here, I have connected everything with jumper wires. To make a permanent
setup, you can directly solder everything together.

To make this robot, first we need a robot body; here I am using a homemade
chassis. You can either use a readymade chassis or build one yourself.

Now, place the BO motors to the chassis with the help of some hot glue as shown
in the image below.

Next step is to place the motor driver on chassis and connect the motor wires to
the output of the motor driver.

Next, bend the IR LED and sensor as shown in the image.

Then place the sensors on the downside of the robot, adjust the sensors according
to the track width and robot width. Remember that one sensor is for left side
detection and another is for the right side detection.
Now place the Arduino uno using glue and connect the sensor output pins to
digital pin 2 and 4 of the Arduino.

Connect the VCC pins to 5volt and the ground pins to ground.

Now, connect the enable pins of the motor driver to pin 5 and 8 of Arduino and
connect the motor driver input pins to pin number `6, 7, 9 and 10 of Arduino
respectively.
Finally, connect the battery with the circuit and place the battery on chassis.
Here, I have connected everything with jumper wires. To make a permanent
setup, you can directly solder everything together.

Arduino Line Follower Robot Code


The programming part of line follower robot is very simple and we require only
basic Arduino functions. The complete program for this project can be found at
the bottom of this page. The explanation of this program is as follows:

First step is to defined every Arduino pin that we are using. I started with
motoring the driver pins and sensor pins. Here, I have commented on each line of
code for your easy understanding.

#define enA 5 //Enable1 L293 Pin enA


#define in1 6 //Motor1 L293 Pin in1
#define in2 7 //Motor1 L293 Pin in1
#define in3 9 //Motor2 L293Pin in1
#define in4 10 //Motor2 L293 Pin in1
#define enB 8 //Enable2 L298 Pin enB
#define R_S 4 // Right sensor
#define L_S 2 // Left sensor

In the loop section, declare the pin modes of each pin. Here, we need to read the
output of IR sensors, hence I have defined those pins as an input. The motor
needs to be driven by the Arduino, thus defining the motor driver pins as output.
Finally, I pulled enable pin to high.

pinMode(R_S, INPUT);
pinMode(L_S, INPUT);
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(enB, OUTPUT);
digitalWrite(enA, HIGH);
digitalWrite(enB, HIGH);

In the loop section, we first read the values of IR sensors and then using ‘if
condition’ control the movement of motor as per our requirements. The four
movement conditions are explained below.

Moving forward:

if((digitalRead(R_S) == 0)&&(digitalRead(L_S) == 0))


{forward();}

In this case, if Right Sensor and Left Sensor are on top of white colour then the
robot should move in the forward direction, so we call the forward function.

(Note : here 0 means output of IR sensor is high as the sensor is on white surface)

Turning towards Right Side:

if((digitalRead(R_S) == 1)&&(digitalRead(L_S) == 0))


{turnRight();}

if Right Sensor is detecting Black and Left Sensor is not detecting any black line,
then it will call the Right function, initiating the protocol for making right turn by
calling turnRight function.

Turning towards Left side:


if((digitalRead(R_S) == 0)&&(digitalRead(L_S) == 1))
{turnLeft();}

if Right Sensor is over white and the Left Sensor is detecting Black then it will
call turnLeft function. It will initiate the steps for turning the robot in left
direction.

Stopping the Robot:

if((digitalRead(R_S) == 1)&&(digitalRead(L_S) == 1))


{Stop();}

If the Right Sensor and Left Sensor are on the Black color then it will call the
Stop function. In this case, the robot will come to a complete halt.

We have defined the 4 functions of the robot as Forward, turnLeft, turnRight and
Stop. The code to perform these functions are given below:

Forward function:

void forward(){
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
}

This means we are pulling to high the input 1 and 4 of the motor driver, as a
result, both motors will move forward same as this I made other functions

Turnright function:

void turnRight(){
digitalWrite(in1, LOW); //Right Motor forword Pin
digitalWrite(in2, HIGH); //Right Motor backword Pin
digitalWrite(in3, LOW); //Left Motor backword Pin
digitalWrite(in4, HIGH); //Left Motor forword Pin
}

TurnLeft function:

void turnLeft(){
digitalWrite(in1, HIGH); //Right Motor forword Pin
digitalWrite(in2, LOW); //Right Motor backword Pin
digitalWrite(in3, HIGH); //Left Motor backword Pin
digitalWrite(in4, LOW); //Left Motor forword Pin
}

Stop function:

void Stop(){
digitalWrite(in1, LOW); //Right Motor forword Pin
digitalWrite(in2, LOW); //Right Motor backword Pin
digitalWrite(in3, LOW); //Left Motor backword Pin
digitalWrite(in4, LOW); //Left Motor forward Pin

So, that’s all about coding. Now we need to upload the code to the Arduino and
to do so, connect your Arduino with the computer using USB cable and upload
this code using the Arduino IDE.

Testing and Calibration


We have assembled the robot and uploaded the code, so now its time to see it in
action and if it is unable to follow the line then we’ll have to calibrate the robot.
For that first place robot on a black surface ( both sensors should be on top of
the black surface) then adjust the variable resistor of IR Module until the output
led of IR module become off. Next, place the robot on a white surface and check
whether the led is turning on, if not, then just adjust the variable resistor. Repeat
the process once again to be sure that the output LED is operating as per the
requirement.

Now, since we have calibrated the robot, all we need to do is place the robot on
top of the black line and see it in action.

The complete making of the line follower robot can be found in the video linked
at the bottom of this page. If you have any questions leave them in the comment
section.

Code

// Arduino Line Follower Robot Code

#define enA 5//Enable1 L293 Pin enA


#define in1 6 //Motor1 L293 Pin in1
#define in2 7 //Motor1 L293 Pin in1
#define in3 9 //Motor2 L293 Pin in1
#define in4 10 //Motor2 L293 Pin in1
#define enB 8 //Enable2 L293 Pin enB
#define R_S 4//ir sensor Right
#define L_S 2 //ir sensor Left
void setup(){
pinMode(R_S, INPUT);
pinMode(L_S, INPUT);
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(enB, OUTPUT);
digitalWrite(enA, HIGH);
digitalWrite(enB, HIGH);
delay(1000);
}
void loop(){
if((digitalRead(R_S) == 0)&&(digitalRead(L_S) == 0))
{forward();} //if Right Sensor and Left Sensor are at
White color then it will call forword function
if((digitalRead(R_S) == 1)&&(digitalRead(L_S) == 0))
{turnRight();} //if Right Sensor is Black and Left Sensor
is White then it will call turn Right function
if((digitalRead(R_S) == 0)&&(digitalRead(L_S) == 1))
{turnLeft();} //if Right Sensor is White and Left Sensor
is Black then it will call turn Left function
if((digitalRead(R_S) == 1)&&(digitalRead(L_S) == 1))
Working principle:
The line fallowing robot is one of the self-operating robots. That detects
and fallows a line drawn on the area. The line is indicated by white line on
a block surface or block line on a white surface. This system must be
sense by the line. This application is depends upon the sensors. Here we
are using two sensors for path detection purpose. That is proximity
sensor and IR sensor. The proximity sensor used for path detection and
IR sensor used for obstacle detection. These sensors mounted at front
end of the robot. The microcontroller is an intelligent device the whole
circuit is controlled by the microcontroller.

There are two types of line controlled robotic vehicles


Mobile based line controlled robotic vehicle
 RF based line controlled robotic vehicle
Applications of line follower robot:
Industrial Applications: These robots can be used as automated

equipment carriers in industries replacing traditional conveyer
belts.
 Automobile applications: These robots can also be used
as automatic cars running on roads with embedded magnets.
 Domestic applications: These can also be used at homes for
domestic purposes like floor cleaning etc.
 Guidance applications: These can be used in public places like
shopping malls, museums etc to provide path guidance.
Advantages:

 Robot movement is automatic


 It is used for long distance applications
 Simplicity of building
 Fit and forget system
 Used in home, industrial automations etc.
Hardware Required:
o 12V, 1A DC Adapter-1 piece
o Analog IR Sensor-3 piece
o AVR Microcontroller Board-1 piece
o DC Motor Driver-1 piece
o AVR USB Programmer-1 piece
o 1 to 1 Connector-15 piece
o 10 to 10 FRC Female Connector-2 piece
o Robot-1 piece

Software Required:
o BASCOM-AVR Integrated Development Environment (IDE)
o AVRDUDE-GUI
o WinAVR-2010
o USBasp Driver
Block Diagram:

Algorithm:
1. R=rightmost sensor which reads 0, L=leftmost sensor which reads 0.
If no sensor on right (or Left) is 0 than L (or R) equals to 0.
2. If all sensor read 1 then go to step 3,

Else,

If L<R Move Right

If L>R Move Left

If L=R Move Forward

3. Move anticlockwise if line was last seen on Left, Move clockwise if


line was last seen on Right. Repeat step 3 till line is found.

Key Features of Line Follower Robot using Arduino:

1. Intelligent Line Tracking: Equipped with high-precision infrared sensors,


our Line Follower Robot can detect and track lines on various surfaces
with exceptional accuracy. It uses this information to autonomously
maneuver along paths, making it ideal for educational purposes,
competitions, and practical applications.
2. Arduino Compatibility: The robot is built around the Arduino platform, a
widely used open-source electronics prototyping platform. This enables
users to leverage the vast Arduino ecosystem, programming libraries, and
community support to customize and enhance the robot’s functionality
according to their specific requirements.
3. Programmable Behavior: The robot’s behavior can be easily
programmed using the Arduino programming language, providing users
with full control over its actions. Whether you want the robot to follow a
predefined path, perform complex maneuvers, or respond to
environmental cues, you can unleash your creativity and bring your ideas
to life.
4. Expandability and Customization: The Line Follower Robot features an
expandable design that allows for easy integration of additional sensors
and modules. This flexibility opens up countless possibilities for
extending its functionality, such as adding obstacle detection, wireless
communication, or even integrating it with external devices for enhanced
automation.
5. Educational Tool: Our Line Follower Robot serves as an excellent
educational tool for students, hobbyists, and enthusiasts interested in
robotics, electronics, and programming. By building and experimenting
with the robot, users can learn key concepts in robotics, sensor
technology, automation, and logical reasoning in an engaging and hands-
on manner.
6. Durable Construction: Crafted from high-quality materials, the robot
boasts a sturdy and durable construction that ensures its longevity.
Comes with a 3mm acrylic red board which is stronger than the ones
available it the market. It can withstand the rigors of frequent use and is
built to deliver reliable performance, allowing users to focus on
exploring and experimenting without worrying about equipment failure.
7. Easy Assembly: The Line Follower Robot arrives as a DIY kit with all
the necessary components and detailed instructions for easy assembly.
No prior experience in robotics or electronics is required, making it
accessible to beginners while still offering advanced capabilities for more
experienced users.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy