Line Follower Robot

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Home Sign Up!

Browse Community Submit


All Art Craft Food Games Green Home Kids Life Music Offbeat Outdoors Pets Photo Ride Science Tech
Line Follower Robot
by vahid_you2004 on July 25, 2010
Table of Contents

Author: vahid_you2004 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

License: General Public License (gpl) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Intro: Line Follower Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

step 1: First Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

step 2: Things You Need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

step 3: Making the Circuit Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

step 4: Soldering Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

step 5: Soldering All Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

step 6: Wheels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

step 7: Programming the Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

step 8: RUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

step 9: Custom Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

step 10: How it works? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

http://www.instructables.com/id/Line-Follower-Robot/
Author: vahid_you2004
Author: vahid_you2004 Visit dihav.com
I'm a mechanical engineer, and I like computer programming, mechanics, electronics and specially the robotics.

License: General Public License (gpl)


Intro: Line Follower Robot
I made a line follower robot with PIC16F84A microprocessor equipped with 4 IR sensors. This robot can run on the black and white lines.

http://www.instructables.com/id/Line-Follower-Robot/
step 1: First Step
Before everything you must know how to make a Printed Circuit Board and how to solder components on it. You also need to know how to program a PIC16F84A IC.
Here are the links to good instructables about making a PCB and Soldering:

(Mostly) easy PCB manufacture


How to Solder

step 2: Things You Need


To make this robot you need the following things:

Some copper board


Printed circuits
Saw
Sandpaper
Iron
Circuit board acid
1mm drill
Soldering oil
Soldering wire
Soldering iron
Wire cutter
Some wire
2x Plastic wheels
1x Spherical front wheel
Glue

Circuit boards components:

A 4 AA battery holder
U1 = PIC16F84A Microcontroller + Socket
U2 = 7805 = 5V Voltage Regulator
U3 = LM324 Comparator
U4 = L298 Motor Driver + Aluminum Radiator
http://www.instructables.com/id/Line-Follower-Robot/
XT = 4MHz Crystal
C1 = C2 = 22pF Ceramic Capacitors
C3 = 100uF Electrolyte Capacitor
C4 = C5 = 100nF Ceramic Capacitors (104)
D = 8 x 1N4148 Diodes
R1 = 4.7K Resistor
R2 = R3 = 10K Resistors
R4 = R5 = R6 = R7 = 1K Resistors
R8 = 10K Resistor
R9 = 1K Resistor
R10 = R11 = 47K Resistors
R12 = R13 = R14 = R15 = 100ohm Resistors
R16 = R17 = R18 = R19 = 10K Resistors
RP = LP = MP = FP = 10K Potentiometers
L Motor = R Motor = 60rpm MiniMotors with Gearbox (6V)
R Sensor = L Sensor = M Sensor = F Sensor = TCRT5000 Infrared Sensors
ModeLED = LBLED = RBLED = Small Red LEDs
LFLED = RFLED = Small Green LEDs
Mode = Left = Right = Small Buttons
SW = Toggle Switch = On/Off Switch
J = Jumper = A piece of wire

http://www.instructables.com/id/Line-Follower-Robot/
Image Notes
1. A dead LED as front wheel

File Downloads

PCB.pdf ((595x842) 101 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'PCB.pdf']

step 3: Making the Circuit Boards


Print the circuits on a glossy paper with a laser printer. Cut copper boards, clear them with sandpaper and put the printed circuits on them. After pressing the hot iron on
the boards remove the papers and soak boards in acid, wait till visible copper disappears. Wash the boards, drill the holes and clear them with sandpaper.
File Downloads

PCB.pdf ((595x842) 101 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'PCB.pdf']

TopTop.wmf (38 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'TopTop.wmf']

TopBottom.wmf (31 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'TopBottom.wmf']

FrontTop.wmf (24 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'FrontTop.wmf']

http://www.instructables.com/id/Line-Follower-Robot/
FrontBottom.wmf (18 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'FrontBottom.wmf']

BottomTop.wmf (56 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'BottomTop.wmf']

BottomBottom.wmf (42 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'BottomBottom.wmf']

BackTop.wmf (20 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'BackTop.wmf']

BackBottom.wmf (15 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'BackBottom.wmf']

step 4: Soldering Components


Solder all parts on the boards.
Be careful of the correct direction of components.
Use a socket for PIC16F84A IC.
Solder motors and battery holder on the back side of the Bottom board and put some pieces of paper around motors to avoid unexpected contacts in the circuit.
Solder C4 and C5 right on the motors.
Put a piece of paper among potentiometers legs to avoid contacts.

Image Notes Image Notes


1. Front-Top board connections 1. Back-Top board connections

http://www.instructables.com/id/Line-Follower-Robot/
Image Notes Image Notes
1. A piece of paper 1. A piece of paper
2. A piece of paper
3. Motor

step 5: Soldering All Together


Connect terminals with same name on the boards together by some piece of wires (You can use the extra legs of the other components).
Solder the Back board to the Top board.
Solder the Front board to the Top board.
Bend the wires and put three boards on the battery holder and solder Front board and Back board to the Bottom board (Use some long flexible wires to contact terminals
of the Back and Bottom boards).
Connect + terminal on the Top board to the battery holders + pole.

http://www.instructables.com/id/Line-Follower-Robot/
Image Notes Image Notes
1. Front-Top board connections 1. Back-Top board connections

Image Notes Image Notes


1. Front-Bottom board connections 1. - pole to the Bottom board
2. + pole to the Top board
3. + pole to the Bottom board

http://www.instructables.com/id/Line-Follower-Robot/
step 6: Wheels
Connect 2 plastic wheels to the motors and cover them with a rubber band.
Attach a wheel to the Back board in front of the robot with some glue, I used a dead LED as front wheel but it makes the robot move slow and I recommend to use a
spherical wheel.
Cover the gearboxes with sheets of thin plastic.

Image Notes
1. A dead LED as front wheel

step 7: Programming the Robot


Download the robot program (Code.hex) and program the PIC16F84A IC.

http://www.instructables.com/id/Line-Follower-Robot/
File Downloads

Code.zip (6 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Code.zip']

step 8: RUN
Put 4 AA batteries into the battery holder, make a path, and turn on the robot.
If the robot does not work check soldering carefully.
Now you must adjust potentiometers to robot be able to detect black and white areas. Turn all potentiometers to leftmost position then turn back about 90 degrees to the
right. Hold the robot on the line, move it over a turning if the motors state does not changed change the potentiometers value.
Now put the robot on the path to follow it.

step 9: Custom Movement


You can define a custom movement for the robot by pressing the Mode button.
When the Mode LED is off the robot is on its default state.
After pressing the Mode button the Mode LED turns on, now you can hold the robot in different states and change the state of the motors depend on their default state
by Left and Right buttons.
After pressing the Mode button again the Mode LED starts blinking, now you can hold the robot in different states and change the state of the motors depend on values of
the sensors by the Left and Right buttons.
To switch to default state, press Mode button again.
There are four states for the motors:

1. Default state
2. Forward (Green LED is on)
3. Backward (Red LED is on)
4. Stop (Both Green and Red LEDs are on)

http://www.instructables.com/id/Line-Follower-Robot/
step 10: How it works?
This robot has 4 IR sensors that scan the path.
If the Right and Left sensors has same values and the values of them are different from the Middle or Front sensors the robot is on the line and motors running forward.
Else the robot is out of line so the robot keeps moving till one of the side sensors value changes then it turns to the direction that its sensor value changed.
You can read the program source code (Code.bas) to understand it better.

Related Instructables

Arduino Arduino
eyeRobot - The My Arduino Line Controlled Line Controlled Line
Adaptive
Robotic White Following Robot Following Robot Following Robot
Mapping and
Navigation with Cane by shrimpy Belvedere - A !!! - With Pololu (video) by (video) by
iRobot Create Butler Robot by QTR-6A IR earthshine earthshine
by wolffan Reflectance
societyofrobots Sensor Array
(video) by
DuFFxP93

Advertisements
Comments
37 comments Add Comment

addnan says: Oct 18, 2010. 12:56 PM REPLY


The confusion is that how four PCB's are connected to each other after putting components on it.

vahid_you2004 says: Oct 19, 2010. 5:12 AM REPLY


Put top board beside back board and connect terminals with the same name together, put top board beside front board and connect terminals with the
same name together, solder sensors terminals from bottom board to the front board, soder bottom RV to front RV, bend soldered wires to shape the
robot, solder motor wires to the back board, solder bottom - to back -.
View images they can help you.

addnan says: Oct 19, 2010. 8:53 AM REPLY


Thx man hope so it would help.

addnan says: Oct 18, 2010. 12:50 PM REPLY


Hi. I am very intrested in making this project. Could you please tell me where have yu put the circut diagram? The files you given at your site contain a folder
named as CIRCUT. But file inside is with .DSN extension. Could you please help me where is the circut diagram.
Wating for reply.

vahid_you2004 says: Oct 19, 2010. 5:07 AM REPLY


You can open DSN and LYT files with Proteus.
The diagram is only a simple circuit for testing the robot code, you can find its image in lower comments.

addnan says: Oct 18, 2010. 12:53 PM REPLY


Considering me as a beginner could you please give me a schematic diagram. Thanks.

syverson55 says: Oct 5, 2010. 9:03 AM REPLY


hi

xap_psp says: Sep 27, 2010. 8:08 AM REPLY


Can anyone help me how to get +3v and -3v from 4AA batteries?please please...

vahid_you2004 says: Sep 28, 2010. 5:45 AM REPLY


Just use battery holder ends.

http://www.instructables.com/id/Line-Follower-Robot/
xap_psp says: Sep 29, 2010. 8:16 AM REPLY
thanks alot...it was really confusin since i'm new to all these things..... thanks

raghavathej says: Sep 17, 2010. 6:46 AM REPLY


hey..its cool project... i have few modification 2 make...first keeping IR sensors in the front ,facing walls so that it can detect obstacles..secondly attach a
cleaner at the bottom...make it to work like a broom...for cleaning purpose...on need to follow the line...it has to just avoid ostacles...mail me at
[email protected]....

vahid_you2004 says: Sep 19, 2010. 3:59 AM REPLY


Good idea, but you must add another sensor to detect the wall, the front sensor is important.

cf1709 says: Sep 17, 2010. 6:50 PM REPLY


Cool project but it could help if it has the schematic diagram.

vahid_you2004 says: Sep 19, 2010. 3:52 AM REPLY


I have a simple schematic diagram that I changed the sensors with some switches and motors with LEDs, it can be helpful.

fkhairiah2 says: Aug 30, 2010. 11:16 PM REPLY


what type of program that u used?

vahid_you2004 says: Sep 1, 2010. 3:31 AM REPLY


Basic, PICBasic Pro

Wesley666 says: Jul 26, 2010. 4:12 PM REPLY


For as complicated as Line Followers all seem to be, this seems to be on the simpler side and works better and faster then most I have seen. Nice 'Ible! :D

rabbitkillrun says: Aug 1, 2010. 7:45 AM REPLY


Agreed. I wonder if it would be possible to make one without a microcontroller or anything. It's got me thinking. lol

Wesley666 says: Aug 22, 2010. 8:17 PM REPLY


You probably could. I always thought a simple circuit with a few transistors controlled by two LDR or Photo-transistors with a small white LED in the
middle to detect a reflective strip (What it is supposed to follow) versus everything else. I thought of it would be kind of like this 'Ible:
http://www.instructables.com/id/How-to-Build-a-Robot---The-BeetleBot/ But would use 2 H-Bridges to control the motors. I haven't actually tried it, but
it seems like a sound idea, it would probably have to go a bit slower, but I think it would work. It would need to be thought through a bit more then
this, but its an idea...

vahid_you2004 says: Aug 3, 2010. 4:08 AM REPLY


Without microcontroller you need more complicated controlling circuit, you must simulate program by only electronic components, I think using a
microcontroller is easier.

rabbitkillrun says: Aug 3, 2010. 3:55 PM REPLY


Easier? Yes. More satisfying? No, not for me at least.

vahid_you2004 says: Aug 4, 2010. 4:36 AM REPLY


Why? I think using a computer program to make an electronic circuit is very useful and interesting!

http://www.instructables.com/id/Line-Follower-Robot/
rabbitkillrun says: Aug 4, 2010. 9:23 AM REPLY
That it is. I enjoy programming, and programming something which physically does something is even better. However, I also like the
most basic of approaches too (basic as in parts used). Even if they are not at all practical, it's still fun every once in a while to see what is
possible.

Wesley666 says: Aug 15, 2010. 8:46 PM REPLY


Totally agree with you. Micro controlers may be more practical, but they take the fun of building circuits. Same with Arduino. Yes its
cool, handy, and practical, but you can make and LED blink with an Arduino and an LED. No transistors, or resistors or caps diodes or
anything else, and that's what makes things so fun is all those parts! :D

nikolas10 says: Aug 19, 2010. 5:17 AM REPLY


Can anybody help me? Could the robot be made to reverse around a track ? How could this be achieved and what changes to the logic might be required?

vahid_you2004 says: Aug 20, 2010. 4:51 AM REPLY


Press the Mode button to make its LED on, hold the robot over the path and move it backward with your hand and change the motors direction in
different states with motor buttons, now it can follow the path reverse. I tried to do it myself but it could not follow the sharp turnings because the sensors
are in the front of the robot, if you make the robot with sensors on the middle of it you will get better result.

vbrun_200 says: Aug 12, 2010. 9:50 PM REPLY


Thank you .............. I didn't mean this program but i meant the language so i can open your code and to know how your robot work ?

vahid_you2004 says: Aug 14, 2010. 4:04 AM REPLY


MicroCode Studio - PICBasic Pro You can also open the .bas file with Notepad

vbrun_200 says: Aug 16, 2010. 7:14 PM REPLY


Thank you very much .......................... for your reply

vbrun_200 says: Aug 9, 2010. 5:31 PM REPLY


Great job ................. Could you tell me what is the program that you use to program your PIC ?

vahid_you2004 says: Aug 11, 2010. 3:46 AM REPLY


PICProg 1.3 by Matrin, I can not find it's original website, so I uploaded it for you on rapidshare: http://rapidshare.com/files/412304229/PICProg.exe

Robot Lover says: Aug 8, 2010. 6:32 PM REPLY


Do you have a kit that we can purchase? If not than you did a really proffesional job!

RL

vahid_you2004 says: Aug 10, 2010. 3:45 AM REPLY


Thank you! I have not kit, try to make its kit yourself, it's really easy. When you do something yourself from its beginning you will enjoy more when you
see it working.

Robot Lover says: Aug 10, 2010. 8:08 AM REPLY


that is very true! I will scrap up some parts! Thank you! 5* RL

junits15 says: Jul 27, 2010. 5:49 PM REPLY


I made one of these with lego mindstorms, it was very finicky, it didnt always work, it was fun though

brunoip says: Jul 26, 2010. 12:52 PM REPLY


Great. I like it

thewizard42 says: Jul 26, 2010. 8:57 AM REPLY


Nice job! Thing looks pro

http://www.instructables.com/id/Line-Follower-Robot/

You might also like