Sie sind auf Seite 1von 19

Obstacle Detecting Line Follower Robot

Group No: 08
Group Name: Gear It Forward
Group Members
Student Name: Zarin Tasnim
Student ID:
Student Name: Noshin Tasnim
Student ID:
Student Name: Fatema-E-Jannat
Student ID:
Student Name: Nahian Fairuz
Student ID:
Student Name: Sadia Nazneen
Student ID:

Submitted to: Mr.Hasib Md. Abid Bin Farid, Assistant Professor, AUST.

Our robot is an autonomous Obstacle detecting line follower robot in the age of modern growth of
computer and hardware. It is a vehicle which follows the line and detects the obstacle. Then it
transmits the distance of obstacle from robot in the LCD screen.

The autonomous robot for path finding and obstacle evasion is able to follow a control strip is
sketched on the surface where it is placed. The presented robot captures line position with IR
Sensors, while these sensors are escalated at the front of our robot. The main intension of the robot
is to aware the owner about the obstacle in LCD screen. Here we made the sensor with IR
transmitter and IR Receiver Diode.

Equipments List:

Serial No

Magician Chassis
Gear motor
Arduino Cable
Battery Holder
Motor Driver IC
Ultrasonic Sensor
LCD Screen
Male Connector
Connecting Wires

Male to Male
Male to Female

As required


Fig: LCD screen and RF Receiver with arduino

Fig: Transmitter, Ultrasonic sensor and IR sensor with arduino

Fig: : Motor Driver Circuit with arduino

Working Principal:
1. Arduino board:
There are many classifications of arduino. It is microcontroller. The Arduino board is the brain of the
robot, as it will be running the software that will control all the other parts. The programming is
done in this part. We used two Arduinos in our project. It is connected using male to male jumper.

2. Motor Driving Circuit:

The DC gear motor is used in the robot.To build the motor drive circuit first we chose LM324 and
L293D.But in the circuit we used L293D IC.It is a 16 pin chip called L293D. It can drive 2 DC motors..
We connected the IC with arduino uno. Then we programmed it as per it is required.By the following
figure the IC is naratively described:

But we didnt control the speed manually rather we did it by programming in microcontroller. The
speed of the rigt and left motor is to be nearly same. So we made the right motor speed 255 and left
motor speed 235.

3. Line Following Sensor:

We have made the sensor part using IR Transmitter (LED) and IR Receiver Diode(Photodiode). The
main function of the sensor is to detect the line and follow the path.

We have placed the circuit as given in the above picture on a mini breadboard. The Photodiode was
kept 1 mm above the LED.So that the photodiode could receive the ray properly. We used 10K
resistance also.Then we checked the sensor part using the connecting with the arduino. When we
hold a black tape on any sensor then it was giving the accurate reading.So Our sensor was ready to

4. Obstacle sensor:
To sense the obstacle or define any object we have used the ultrasonic sensor.The figure is given:

As per the figure we can see it has 4 pins.Distance sensors send an ultrasonic signal forward and
then wait to receive a bounced signal. Depending on how long the signal takes to bounce back the
approximated distance to an obstacle can be calculated. We used this little device to prevent the

robot from other obstacles in its way.The Trig and echo pin is connected to the 7 and 6 no pin of
arduino.As a result it can detect any obstacle within its range.

5. lCD Screen:
The purpose of using the LCD screen is to show the distance of the obstracle from the robot.

There are 16 pin which is added with the LCD to connect with arduino.The display has an LED
backlight and can display two rows with up to 16 characters on each row. There are rectangles for
each character on the display and the pixels that make up each character. The display is just white
on blue and is intended for showing text.Here two potentiometers are used.One is to adjust the
brightness and the other is to adjust the contrast.

6. Transmitter and Receiver Part:

The wireless transmitter and receiver pair operate at 315 MHz. They can easily fit into a breadboard
and work well with microcontrollers to create a very simple wireless data link. These modules are
indiscriminate and will receive a fair amount of noise.

The receiver is connected in one breadboard along with an arduino. The data pin is connected at the
13 no pin of arduino on digital part. The data pin of transmitter is connected to 4 no pin of digital
part of arduino.

7. Power supply:
We have used 6V battery with a connector in arduino. A 9V battery is used to give power in the
motor driver circuit also. Another arduino is supplied with a constant DC of 5V.

To create a project every person has to follow some trouble. In the project we also faced some
problem. But we also overcame it. Some instruments were really new for us to operate. But we
learned how to manage it. Some other troubleshooting are explained below:
1. Controlling the motor speed:
It was very necessary for us to fix the speed of the left and right gear motors almost equally. The
motors had to be of same speed.But it was not.So we had to make it almost same through
programming. We made change in the code of arduino and fixed it.
2. Making sensor With the LDR and LED:
Basically in the circuit we used sensor made of Photodiode and Infrared LED. At first we used the
LDR and White LED as sensor. But the sensor monitor did not give the accurate value. On the other
hand the Photodiode and Infrared LED gave a good value. so we chose this one as our line following
3. Lack of power supply:
Firstly in our project we used a 6V battery for the power supply .But it was very difficult to give
power supply in motors, arduino and distance sensor combined. After that problem we used 9v
supply to the circuit and 6V in the arduino. Another 5V is used in the other arduino which is holding
the receiver.
4. In LCD connection pots are used:
Some circuits were there in which we didnt find any pot for the LCD screen connection. But later on
we added two pots. As one is used to vary the contrast and another one is used to vary the
5. Coding of transmitter and receiver:
We did the transmitter and receiver with the help of coding.But while coding the software was
creating problem. Due to some irrelevant problem it took so much time to be corrected.
6. Selection of circuit:
It was almost a new project for us. We were selecting bigger circuit and that was not so much costeffective. But later on by gathering more information we selected the suitable and cost effective

Project Image:
The motor driver circuit



LCD Screen with Receiver:

Overall Images of Robot:

Code used in microcontroller:

Two arduinos are used in the project.
One aruino is connected to the chasis and also connected with receiver.The arduino code is:
#include <NewPing.h>
#include <VirtualWire.h>
#define TRIGGER_PIN 6
#define ECHO_PIN 7
#define MAX_DISTANCE 200
const int transmit_pin = 3;
const int dangerThresh = 10;
// Left Motor Controls
# define LeftMotorForward 8 // ip B`

# define LeftMotorReverse 9 // ip A
# define El 10
// Right Motor Controls
# define RightMotorForward 12 // ip A
# define RightMotorReverse 13 // ip B
# define Er 11
// Grid Sensors // holding the bot with gripper oriented outwards
# define Rs A0
# define Ms A1
# define Ls A2
void setup()
{ // put your setup code here to run once:
pinMode (LeftMotorForward, OUTPUT);
pinMode (LeftMotorReverse, OUTPUT);
pinMode (El, OUTPUT);
pinMode (RightMotorForward, OUTPUT);
pinMode (RightMotorReverse, OUTPUT);
pinMode (Er, OUTPUT);
analogWrite (El,235);
analogWrite (Er,255);
pinMode (Rs, INPUT); // A0
pinMode (Ms, INPUT); // A1
pinMode (Ls, INPUT); // A2

void loop()
unsigned int DistanceObs = DistanceSensor.ping_cm();
{ if ( analogRead(Ms)<analogRead(Rs) && analogRead(Ms)<analogRead(Ls))
{ if (DistanceObs>dangerThresh)
{MotorControl(1,1); send("Running Forward");}
else { send("Obstacle detected! ");
MotorControl(0,0); send("Danger Alert! All stop!");}
else if (analogRead(Rs)<analogRead(Ms) && analogRead(Rs)<analogRead(Ls))
{ MotorControl(1,0); send("Turning Right"); }
else if (analogRead(Ls)<analogRead(Rs) && analogRead(Ls)<analogRead(Ms))
{ MotorControl(0,1); send("Turning Left"); }
void MotorControl(int driveL, int driveR)
switch (driveL) {
case 0:

// lft STOP

digitalWrite (LeftMotorReverse,0);
digitalWrite (LeftMotorForward,0);
case 1:

// lft FORWARD

digitalWrite (LeftMotorForward,235);
digitalWrite (LeftMotorReverse,0);
case 2:

// lft REVERSE

digitalWrite (LeftMotorReverse,235);
digitalWrite (LeftMotorForward,0);
switch (driveR) {
case 0:

// rgt STOP

digitalWrite (RightMotorReverse,0);
digitalWrite (RightMotorForward,0);
case 1:

// rgt FORWARD

digitalWrite (RightMotorReverse,0);
digitalWrite (RightMotorForward,255);
case 2:

// rgt REVERSE

digitalWrite (RightMotorReverse,255);
digitalWrite (RightMotorForward,0);
void send (char *message)
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
Another arduino is connected with LCD and Receiver.The arduino code is given below:

#include <VirtualWire.h>
#include <LiquidCrystal
// Instantiation of the LCD:
LiquidCrystal lcd ( 8, 9, 4, 5, 6, 7 ) ;
// Global Variables:
char ch [ 100 ] ;
int pos = 0 ;
void setup ( )
lcd . begin ( 16, 2 ) ;

// Setting the LCD, 4 lines of 20 characters each.

lcd . setCursor ( 0 , 0 ) ; // the cursor is placed on the top of the screen.

vw_setup ( 2000 ) ;
vw_rx_start ( ) ;

// bits per second (baud) for communication is indicated.

// the reception starts.

void loop ( )
{ byte buf [ VW_MAX_MESSAGE_LEN ] ;
byte buflen = VW_MAX_MESSAGE_LEN ;
int i ;
if ( vw_get_message ( buf , & buflen ) )
if ( pos < 2 )
lcd . setCursor ( 0 , pos ) ;
pos = 0 ;
lcd . clear ( ) ;

// Prints per screen componentwise array until it reaches the end.
for ( i = 0 ; i < buflen ; i++ )
lcd . print ( buf [ i ] ) ;
// Other ways to print:
// Lcd.write (buf [i]);
// Lcd.print (buf [i], BYTE);
// Lcd.print ((char) buf [i]);
pos ++ ;

Application of the project in along with the future work:

In this project of obstacle, there are several ways to apply it in different field of our daily life. Again it
can be upgraded by adding many features also. Mainly it can be used in many effective sector s of
our life.
1. Detecting obstacle in damaged place:
Sometimes large buildings collapse due to their improper construction. Some Valuable things could
stick there or any person can stuck. The robot will then detect the fallen concretes or any obstacle
and then it would be easier to the helpers to remove obstacle easily.
2. In corporate sector:
In offices due to lack of peon it becomes hard to work fast. But the robot can make it easy. It can
take small things like papers from one to another person.
3. Medical Sector:
In medical sector the obstacle detecting line follower robot is really a useful one .As it can carry
medicines to the patients. In many cases it becomes really tough for a few nurses to maintain a large
number of patients. Then the robot can help them by transportation.
Future Works:

1. Adding Camera:
By adding an camera module it can show also the picture of obstacle.So that the owner can easily be
aware about the size of the obstacle. It would be easier to be more conscious.
2. Total distance of obstacle:
Our project is about showing distance of obstacle from the robot. But we can improve it by adding a
feature to detect the distance of obstacle from the owner. On the other hand owner will have the
LCD to catch the information.
3. Using component to remove object:
It can also be improved by adding a part which will detect and remove the object from its way. Again
it will start its work. Then it will be more easy to remove obstacle from way. It can be used in road
for cleaning.

We made the robot named Obstacle detecting Line follower robot. In the modern era of science and
technology it is necessary to reduce the manpower and increase the uses of instrument. Through
this hardware project we have learnt about many new projects and we have also developed our skill
in programming. It was great scope for us to take the technology a little bit far.

1. Mr.Hasib Md. Abid Bin Farid,Assitant Professor,AUST.