Date post: | 08-Jan-2017 |
Category: |
Engineering |
Upload: | pankaj-kumar |
View: | 435 times |
Download: | 6 times |
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
6/1/2016 Project by -
Name Pankaj Kumar Enrollment No. 03976802814 Branch ECE-3 College Guru Tegh Bahadur Institute of Technology
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 1
Certification
This is to certify that this project, the entire design and construction of the
Line Following and Obstacle avoiding robot was carried out and submitted as a
true work of Pankaj Kumar of Guru Teg Bahadur Institute of Technology (GTBIT)
college of Electronic and Communication Engineering (ECE) Branch with enrollment
number 03976802814 under the supervision of ____________________________.
_______________________ _______________________
_______________________ Date
(Project Supervisor)
_______________________ _______________________
_______________________ Date
(External Supervisor)
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 2
Acknowledgement
I can only acknowledge the unquantifiable help God gave me throughout this project
work, always showing up whenever I got to the end of my line and felt like changing
the project to a simpler one. Most remarkable was the breakthrough He gave me
when I was stuck at one C code function for a day!
I am deeply indebted to my parents and siblings for their constant support
especially in circumstances where I find it hard to even convince myself that my
request for help is fair and reasonable. I am equally indebted my very
understanding, fatherly and enviable project supervisor who is always willing to go
above and beyond in counselling and supervising me.
I could not have been able to understand how to go about the vital aspect of the
project work if not for the supervisory assistance of my friends and colleagues
(Actually, all aspect of my project work was vital). I must also acknowledge my
colleagues who over the four years we have been together, in ways they themselves
do not understand, have been the vital components of my educational and personal
growth which also greatly rubbed on my successful completion of this project work.
I greatly appreciate the tripartite support and nourishment I enjoyed from the entire
family of the Chapel of Faith.
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 3
Table of Content
S.no Content Page no.
1)
2)
3)
4)
5)
i)
ii)
6)
7)
8)
9)
i)
ii)
iii)
iv)
10)
11)
Project Report
Certification
Acknowledgement
Table of Content
Introduction
Line Following Robot
Obstacle Avoiding Robot
Working
Requirements
Labelled Photo
Some Important electronic Components
Arduino
Infrared Sensors
Ultrasonic Sensors
Motor Driver
Code
References
0
1
2
3
4
4
5
6
8
9
10
10
12
13
14
15
17
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 4
LINE FOLLOWING OBSTACLE AVOIDING ROBOT Introduction:
Line Following Robot:
A line following Robot is a robot (usually a vehicle) which follows a distinguished
colored path (usually a black lined path). It consists of several electronic components
which makes it follow (usually with tires) a programmed path. The main component of
such robot is a microcontroller which is the brain of the robot.
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 5
Obstacle Avoiding Robot:
An Obstacle Avoiding Robot is a robot (usually a vehicle) which follows a straight
path but if any obstruction is present/introduced in its path then the robot avoids its
collision with the obstruction (usually by stopping before the obstruction or by
changing path). It consists of several electronic components which makes it follow
(usually with tires) a programmed path and avoid collision. The main component of
such robot is a microcontroller which is the brain of the robot.
A Line Following Obstacle Avoiding Robot is a Robot (usually a vehicle) which have
both the characteristics of Line Following Robot and Obstacle Avoiding Robot i.e., it
follows a programmed path (usually a black line) and avoids any obstacle on the
way.
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 6
Working:
These robots are pretty cheap and easy to design. Some sensors are used to detect
the colored line on the path and any obstruction on the path. The robot then
responds to the sensors reading which is defined by programmer in the
microcontroller program.
This robot can follow a thick line (at least of 1 inch) perfectly (even the most complex
paths consisting of obtuse/acute angle turns and intersection of those black lines.
The robot starts when the battery is connected but the speed of robot is slow.
Therefore, another battery is then connected to provide more power to motors and
hence the robot moves comparatively faster.
When the two Infrared sensors connected at both sides of robot senses white path
then the two motors rotate clockwise and the robot moves forward. Similarly, when
the Infrared sensors senses black path then also the two motors rotate clockwise and
the robot moves forward. Hence, when the robot senses intersection of black lines
then it moves straight.
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 7
When one of the Infrared sensors (say right side) senses a black path while the other
one (say left one) senses a white path, then the path is turning towards right, hence
the robot moves right. To make the robot move right, the right motor stays stationary
and left motor rotates clockwise, hence robot takes right turn.
When one of the Infrared sensors (say left side) senses a black path while the other
one (say right one) senses a white path, then the path is turning towards left, hence
the robot moves left. To make the robot move left, the left motor stays stationary and
right motor rotates clockwise, hence robot takes right turn.
To take a sharp right turn, make the left motor rotate clockwise while making the
right motor rotate anticlockwise.
To take a sharp left turn, make the right motor rotate clockwise while making the left
motor rotate anticlockwise.
When the ultrasonic sensor in front of the robot senses any obstruction (in range of
20 cm) while moving forward then the motors stops rotating and the robot stops. The
robot starts moving as soon as the obstruction is removed.
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 8
Requirements:
Components Quantity Price (in Rupees)
Arduino Uno 1 400
Motor Driver Module 1 75
Geared Motor 300 RPM 2 65X2=130
Castor Wheel 1 40
Jumper Wire Male-Female 20 2X20=40
Jumper Wire Male-Male 20 2X20=40
Infrared Sensor Module 2 35X2=70
Ultrasonic Sensor 1 75
9 Volt Battery 2 50X2=100
9 Volt Battery Holder 2 10X2=20
Tires (attached to motors) 2 20X2=40
Chassis 1 50
Double Sided Tape 2 10X2=20
Scissors 1 0
14 Requirements Total Price : 1,060 Rupees
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 9
Labelled Photo:
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 10
Some Important Electronic Components:
Arduino:
Arduino is an open-source prototyping platform based on easy-to-use hardware and
software. Arduino Boards are able to read inputs - light on a sensor, a finger on a button, or a
Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing
something online. You can tell your board what to do by sending a set of instructions to the
microcontroller on the board. To do so you use the Arduino Programming Language (based on
Wiring), and the Arduino Software (IDE), based on Processing.
Over the years Arduino has been the brain of thousands of projects, from everyday objects to
complex scientific instruments. A worldwide community of makers - students, hobbyists, artists,
programmers, and professionals - has gathered around this open-source platform, their
contributions have added up to an incredible amount of accessible knowledge that can be of
great help to novices and experts alike.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping,
aimed at students without a background in electronics and programming. As soon as it reached a
wider community, the Arduino board started changing to adapt to new needs and challenges,
differentiating its offer from simple 8-bit boards to products for IoT applications, wearable, 3D
printing, and embedded environments. All Arduino boards are completely open-source,
empowering users to build them independently and eventually adapt them to their particular
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 11
needs. The software, too, is open-source, and it is growing through the contributions of users
worldwide.
Thanks to its simple and accessible user experience, Arduino has been used in thousands of
different projects and applications. The Arduino software is easy-to-use for beginners, yet
flexible enough for advanced users. It runs on Mac, Windows, and Linux. Teachers and students
use it to build low cost scientific instruments, to prove chemistry and physics principles, or to get
started with programming and robotics. Designers and architects build interactive prototypes,
musicians and artists use it for installations and to experiment with new musical instruments.
Makers, of course, use it to build many of the projects exhibited at the Maker Faire, for example.
Arduino is a key tool to learn new things. Anyone - children, hobbyists, artists, programmers - can
start tinkering just following the step by step instructions of a kit, or sharing ideas online with
other members of the Arduino community. There are many other microcontrollers and
microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-
24, Phidgets, MIT's Handyboard, and many others offer similar functionality. All of these tools
take the messy details of microcontroller programming and wrap it up in an easy-to-use
package. Arduino also simplifies the process of working with microcontrollers, but it offers some
advantage for teachers, students, and interested amateurs over other systems:
Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller
platforms. The least expensive version of the Arduino module can be assembled by hand,
and even the pre-assembled Arduino modules cost less than $50
Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX, and Linux
operating systems. Most microcontroller systems are limited to Windows.
Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use for
beginners, yet flexible enough for advanced users to take advantage of as well. For
teachers, it's conveniently based on the Processing programming environment, so students
learning to program in that environment will be familiar with how the Arduino IDE works.
Open source and extensible software - The Arduino software is published as open source
tools, available for extension by experienced programmers. The language can be
expanded through C++ libraries, and people wanting to understand the technical details
can make the leap from Arduino to the AVR C programming language on which it's based.
Similarly, you can add AVR-C code directly into your Arduino programs if you want to.
Open source and extensible hardware - The plans of the Arduino boards are published
under a Creative Commons license, so experienced circuit designers can make their own
version of the module, extending it and improving it. Even relatively inexperienced users
can build the breadboard version of the module in order to understand how it works and
save money.
Infrared Sensor:
An IR sensor is a device which detects IR radiation falling on it. There are numerous
types of IR sensors that are built and can be built depending on the application.
Proximity sensors (Used in Touch Screen phones and Edge Avoiding Robots), contrast
sensors (Used in Line Following Robots) and obstruction counters/sensors (Used for
counting goods and in Burglar Alarms) are some examples, which use IR sensors.
An IR sensor is basically a device which consists of a pair of an IR LED and a photodiode
which are collectively called a photo-coupler or an opto-coupler. The IR emitter LED
emits IR radiation and IR detector receives it after the radiation is reflected from a
surface. The radiation will not reflect from dark surface as dark surface absorbs the
radiation. And this concept is used in line following robot to track dark lines on white
surface.
Ultrasonic Sensor:
Ultrasonic transducers are transducers that convert ultrasound waves to electrical
signals or vice versa. Those that both transmit and receive may also be
called ultrasound transceivers; many ultrasound sensors besides
being sensors are indeed transceivers because they can both sense and transmit.
Active ultrasonic sensors generate high-frequency sound waves and evaluate the
echo which is received back by the sensor, measuring the time interval between
sending the signal and receiving the echo to determine the distance to an object.
Passive ultrasonic sensors are basically microphones that detect ultrasonic noise
that is present under certain conditions, convert it to an electrical signal, and
report it to a computer.
The sonic waves emitted by the transducer are reflected by an object and received
back in the transducer. After having emitted the sound waves, the ultrasonic
sensor will switch to receive mode. The time elapsed between emitting and
receiving is proportional to the distance of the object from the sensor.
This concept is used in obstacle avoiding robot, when ultrasonic sensor detects
any obstruction in the preprogrammed range then the robot stops moving.
Motor Driver Module:
L293D is a typical Motor driver or Motor Driver IC (used to build the module) which
allows DC motor to drive on either direction. L293D is a 16-pin IC which can control a set
of two DC motors simultaneously in any direction. It means that you can control two DC
motor with a single L293D IC. The L293D works on the concept of typical H-bridge, a
circuit which allows the high voltage to be flown in either direction. In a single L293D IC
there are two H-bridge circuits which can rotate two DC motors independently.
The motor driver module can be used to control the two motors at once. It can even
control the direction of motors (clockwise and anticlockwise) to move robot back and
forth and even turn. It is also useful in providing external power to the motors directly in
case the power from microcontroller is insufficient to run motor or to increase its speed.
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 15
Code:
#include <NewPing.h>
int x,y,t1=0,t2=0;
unsigned int D;
NewPing sonar(12,11,10);
void setup() {
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(5,OUTPUT);
pinMode(10,OUTPUT);
pinMode(6,OUTPUT);
pinMode(9,OUTPUT); }
void loop() {
x=digitalRead(2);
y=digitalRead(3);
if((x==1)&&(y==1)) {
D=sonar.ping_cm();
digitalWrite(5,HIGH);
digitalWrite(10,HIGH);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
t1=0;
t2=0;
if(D!=0) {
digitalWrite(5,LOW);
digitalWrite(10,LOW);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
delay(1000); } }
else if((x==1)&&(y==0)) {
if(t1>=20) {
digitalWrite(5,LOW);
digitalWrite(10,LOW);
digitalWrite(6,HIGH);
digitalWrite(9,HIGH);
delay(500);
digitalWrite(5,HIGH);
digitalWrite(10,LOW);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
delay(1000); }
- Header Library for ultrasonic sensor
- Declaring variables
- Initializing ultrasonic sensor, Syntax is
NewPing sonar(TriggPin, EchoPin, Maxdistance);
- Initializing input pin of Infrared sensor 1
- Initializing input pin of Infrared sensor 2
- Initializing output pin 1 of motor driver
- Initializing output pin 2 of motor driver
- Initializing output pin 3 of motor driver
- Initializing output pin 4 of motor driver
- Read value of Infrared sensor 1
- Read value of Infrared sensor 2
- If no IR sensor reads black line at any side
then move forward
- Check reading of ultrasonic sensor in cm
- If ultrasonic sensor reads an obstruction in the
vicinity of max distance then stop robot
- Delay of 1 second
- If left IR sensor reads black line then turn robot
to right
- If the robot is stuck while moving right then
move robot back for 0.5 seconds and move
robot right for 1 second
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 16
else {
digitalWrite(5,HIGH);
digitalWrite(10,LOW);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
delay(500);
t1+=1; } }
else if((x==0)&&(y==1)) {
if(t2>=20) {
digitalWrite(5,LOW);
digitalWrite(10,LOW);
digitalWrite(6,HIGH);
digitalWrite(9,HIGH);
delay(500);
digitalWrite(5,LOW);
digitalWrite(10,HIGH);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
delay(1000); }
else {
digitalWrite(5,LOW);
digitalWrite(10,HIGH);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
delay(500);
t2+=1; } }
else if((x==0)&&(y==0)) {
digitalWrite(5,HIGH);
digitalWrite(10,HIGH);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
t1=0;
t2=0; } }
- If left IR sensor reads black line then move the
robot left
- If the robot is stuck while moving left then move
robot back for 0.5 seconds and move robot left
for 1 second.
- If the two IR sensor reads black line at both
sides then the robot moves forward.
LINE FOLLOWING OBSTACLE AVOIDING ROBOT
Page 17
References
1) https://www.arduino.cc
2) www.instructables.com
3) https://www.coursera.org