Introduction: Line Follower Robot

Picture of Line Follower Robot
     This is my second Line Follower Robot and as its name suggest, it is a robot whose purpose is following a line. This robot can be used in contests where a robot must follow a route delimited by a black line on a white background in the shortest time possible.
     This robot is really simple to make and then you can use this platform for other purposes.
     Below is a video of the robot running on a track similar to one used in contests.

Step 1: The Mechanics

Picture of The Mechanics


     The motors I used for this robot are 2 servomotors modified for speed. You can also use other motor if it' s good enough... I didn't have any so I modded 2 servomotors.

HOW TO MOD THE SERVOMOTORS (look at the pictures)

1. Remove the four screws from the servo and take it all apart.
2. Remove the electronics keeping only the wires from the motor (I kept the other 3 wires from the potentiometer but you don't have to).
3. Try to fit the gears except for one. I glued the big gear to the one beneath it so as to be high enogh to "get out" of the case. It isn't exactly a rule for how to do this... various servos will have various gears so you will need to try until you will find the best "combination".
4. Put everything toghether.

The BODY (look at the picture):

 The base of the robot is made of PCB cutted to the properly size.
You will also need 5 screws:
     - 2 for putting together the front and the base of the robot
     - one for lifting the sensors off the ground (you can use something else here, if you have)
     - 2 for lifting and fixing the microcontroller PCB

Step 2: The Electronics

Picture of The Electronics


I made my sensors using 5 SMD IR emiting diodes, 5 SMD phototransistors and 5 1k SMD resistors. Between the phototransistor and the IR I put some black silicone so the IR light would not come directly to the phototransistor. The PCB design is in the archive "line follower.rar". It is made in PROTEUS, but I have a word document including all the PCB designs which can be printed on glossy paper or Press and Peel, and then transfered to the PCB using the method of the iron.
If you don't want to make your own sensor you can buy one from here: .


The "heart" of this robot is an ATMEGA8 microcontroller which gets the information from the sensors and drive the L293D motor controller.
Parts list:

1x 28-pin socket (for ATMEGA8)
1x 14-pin socket (for L293)
1x ATMEGA8 - You can also use an ATMEGA 168 or 328. The program is made in Arduino , so if you have an arduino, you can program the microcontroller on it, then remove it from arduino and insert it in this PCB. Also you can program this microcontroller via the 6 pins with an ISP. You can buy an ATMEGA 328 to program it on your arduino from here:
1x L293D
1x 16MHz Crystal
2x 22pF (10-28pF)
1x LM7805
1x Push Button
1x 100nF
1x 100uF
1x 4.7 uF
6x LEDs
1x 1K resistor
1x 33R resistor
1x Break Away Header
1x Straight Female Header
1x Switch
Also you will need one 4 AA battery holder.     

     Everything you need for making the microcontroller pcb and the sensors PCB is in the "line follower.rar" archive. You will find the PCB design, and the schematics which are made in Proteus, but are also available in the Word document.
     Now all you have to do is take the soldering iron and start to solder all the parts.
     After you' ve assembled the robot, you need to program the microcontroller. The program is made is Arduino so you can upload it to Arduino and then put the microcontroller in this "motherboard". You also have the HEX file for an ATMEGA8 using 16Mhz crystal.

Step 3: Assembly

Picture of Assembly
     After everything is done... all you need to do is assembling the robot. You can watch a video of me assembling it. Enjoy.

Step 4: Testing

Picture of Testing
     If you followed this tutorial and you got something like in the video below, then, CONGRATULATIONS you have succeeded in making your first LINE FOLLOWER ROBOT.


PhanindraE (author)2017-09-17


the dropbox link which you have commented below is expired, will you please help me for the code and the further queries?

bishal.bishal (author)2015-01-22

I have a question regarding the arduino program. I can't get it why are the values for p1 p2 p3 p4 p5 p6 set. I also don't know what are those for. I see that you are using analog sensor. And at last how can I modify the program to use digital sensors.

Magesh Jayakumar (author)2014-12-23

good bot

khalouda915 (author)2014-10-27

is there a site i can buy all the components all once ?

kruwee (author)2014-06-11

swich on sensor not respond help me

kruwee made it! (author)2014-06-11

it run streng only not follow line.

cts_casemod (author)2014-03-25

I've built this, but without sucess. Did someone managed to get it working?

If i stick my finger in one of the sensors it does power both motors, but the steering does not react to anything else. Once that sensor goes of motors stop.

tpatel7 (author)2014-03-07

cann u send me the eagle.sch and .brd files i want to add some things my email is

dbhalerao (author)2014-03-03

I got L14G2. It is 3 terminal photo transistor....
Which photo diode did you use???

leekingblue (author)2013-10-06

u can send it to me? please.
i really need this circuit :)

adi-sreyaj (author)leekingblue2013-10-07

bro i think #nbinest is not gonna reply for our queries soon i think it will be better for u to search the internet.....

i am also into making of this one....till now i have found everything i need to make this one just by surfing the net .....:) but still have many questions left to ask #nbibest>>>>>>>>>>:(

adi-sreyaj (author)2013-10-07

how can i make this robot follow white lines on black background?

aprasad14 (author)2013-09-14

Dear sir, i am school student.i am using atmega 328 ic.programme with arduino uno.sir Robot not working.Sir please worked arduino uno programme file.

my e-mail -

Sir please reply urgently....

instructables are nice (author)2013-07-14

Hello could you please tel whether i can use this

or should i use this

Please answer quickly thank you

Well... you need to have a microcontroller that is compatible with arduino. One of the microcontrolers that are used in arduino. I think atmega328 is used in Arduino Uno maybe?

mazedm80 (author)2013-06-11

u can make a good design...

bhanuka10 (author)2013-04-10

what is the program you used to draw the pcb ?
Do you have the C or assembly code(for understanding the code) other than hex for atemega 8?

rch5 (author)2013-02-04

Plzz tell me about its programing and also pcb!

nbibest (author)rch52013-03-14

creative_genius (author)2012-12-30

thanks for such good i'ble, Please put the PCB layout for us to diy

nbibest (author)creative_genius2013-03-14

disheet (author)2013-02-22

plzzzz send me high speed line follower robot details like circuit diagram,component,etc.

nbibest (author)disheet2013-03-14

Here. Everything you need.

prithvinath (author)2013-03-14

nbibest (author)prithvinath2013-03-14

Hello, thank you for your interest in my robot. And sorry for the late answer.

J5 and J6 is just a switch. J7 is used for connecting to battery, so when J5 is not shorted to J6, the circuit is open and the robot is stopped.

prithvinath (author)2013-03-14


prithvinath (author)2013-03-10

in the circuit diagram explain the terminals j5,j6 etc

GeniusDevils (author)2013-02-27

Have a look at a new concept - A wall follower robot

agupta52 (author)2013-02-19

If i want to use arduino for this, how will the schematic change please tell

msalamti (author)2013-02-10

well done

enrrsell (author)2012-09-23

how are those components connected on the PCB layout. it will be great if its visible. tnx

svasu1 (author)2012-08-24

Why do you use the 6-pin SIL in the circuit?

nbibest (author)svasu12012-08-25

It's for programming. I have built an USBasp programmer and that's my "standard" for programming :D

svasu1 (author)nbibest2012-08-27

k..den i wont hav that in my circuit..coz i wanna keep it simple..
Bro.. it would be nice if you send me the schematic for the sensor too..coz i wanna make some modifications...nd u hav only uploaded the design
you can upload it here or mail it to me at Thanks.

canutemark (author)2012-06-23

plsssssssss can i have the connecting circuit diagrme. send it to me.


canutemark (author)2012-06-22

can u please give me the circuit diagrame. plsssssssssssssssssss. im still a kid

rohaanzahid (author)2012-04-13

I have make this project through your guidance just what to know what was your
ir sensor reading on black and white line mine was approx 2v on shinny black and 4.6 volt on shinny white what distance you keep from surface to sensors.also what rpm of motor do you use?

ALSO please tell what does variable nr do in your program?

spankeerrrrrrr (author)2012-01-31

türk ?

bakermiro (author)2011-12-13

About This Instructable




More by nbibest:Line Follower Robot
Add instructable to: