| Mini
line follower Robot
Construct it yourself at home!
By Ibrahim
Kamal
Last update:
15/4/08
Overview
 |
|
This small line follower robot, was designed to be easily
built at home without any special equipment, and using a
minimum number of mechanical parts. You wont need more than
2 small motors, 2 free wheels and a piece of pcb (to hold
the micro-controller, the motors driver and the line sensor)
and sure.. your soldering iron!
The main trick making this design simple and affordable,
is that the robot's chassis is
actually the main board of the robot, where some supports
for the wheels - also made of small parts
of copper boards - are soldered to it. All the motors,
and the skids are mounted on
the main PCB. For an electronics hobbyist, PCB manufacturing
is a skill that will |
|
be learnt sooner or later,
so this design lets you use your experience in PCB manufacturing
to design a high precision chassis for your robot.
In case you're not familiar with line following algorithms, it
is recommended that you read that tutorial about line
tracking sensors and algorithms before reading this
article.
1-Overall
Design
 |

Fig. 1.A |
Figure
1A shows a 3D graphical representation of the robot, where different
parts can be clearly identified according to the following table:
Part
# |
Description |
1 |
The base of the robot, also the main PCB. |
2 |
Front skid |
3 |
Free Wheel, shaped as a pulley |
4 |
Plastic pulley |
5 |
Battery holder |
6 |
Pipe clamp use to hold the motors |
7 |
Ni-Cd 7.2V battery pack |
8 |
1200 rpm 6V motor |
It is clear that the drive train of this robot is differential
type, meaning the two rear wheels are responsible of moving the
robot forward and backward, but are also used to turn the robot
in any required direction depending the difference of speed between
the right and left wheels.
The first thing that need some explanation is the fact that there
are only 2 wheels, Well, while not being the best thing to do,
a caster wheel can sometimes be replaced with a skid, when the
robot weight and size are not important, and when the robot is
designed for indoor environment, where the robot can move on relatively
smooth surfaces, where friction wont be a serious problem.
It may seem strange that the battery was placed on the top of
the robot, and it is actually an important mistake, as a battery
at that height totally destabilize the robot because it raises
the center of gravity, increasing the moment of inertia. For more
information about robot stability and moment of inertial read
this tutorial. For
this size of robot, a smaller li-ion battery, placed beneath the
robot, would have given much better results.
2-The
chassis
 |
Again,
in figure 2.A, a graphical layout of the main PCB was
used rather than a picture to make it is easier to differentiate
between different parts of the PCB.
As you may have notices, the main board has a dual function:
Electrical and mechanical. From the mechanical point of
view, this boards is the chassis of the robot, where the
motors, the wheels and the electronics are mounted. You
can see in figure 2.A that the holes to be used to fix
the motors are present on the layout, as well as the holes
to mount the front and read skids. Using PCB layout software
to design the chassis, as well as PCB techniques to manufacture
it, gives a lot of accuracy which is very important for
the mechanical system to work correctly. You can see that
the line sensor is integrated in that same main board.
It's important that the line sensor be as far as possible
from the drive wheels in a differential steering robot.
This principle is explained in detail in this article
about line tracking
sensors and algorithms.
There are many kinds of materials from which the copper
plated boards are made. Try to choose a relatively thick
one for this chassis, to be able to bear the weight of
the motors and the batteries, all concentrated in four
points, where the screws are fixed. |
Fig.
2.A
|
3-The
wheels
 |
The
wheels in this design also have a dual function, they
act as a wheel and as a pulley, with which power is transmitter
from another smaller pulley using a rubber belt.
Those wheels were originally free wheels used in sliding
doors and windows. they are small, cheap and can bear
very important loads. They have been modified as shown
in figure 3.A so that they can be fixed to the chassis
using those 4mm standard screws. Note that the wheel is
still free to rotate around the axe of the screw, so the
only way to transmit power to that wheel will be though
a belt directly mounted on it, as you shall see later. |

Fig. 3.A
|
You can also notice that the wheels are mounted on the chassis
using small rectangular pieces
of
copper board welded the main board using a regular soldering
iron, and where the center of the wheel is etched on it
for maximum accuracy, this way, both the right and left
wheels are at the exact same height. You
can also notice that another small piece of PCB is added
to cary any eventual shear stress on the main part holding
the wheel. (see figure 3.B and 3.C) |

Fig. 3.B
|

Fig. 3.C
|
4-Motors
and power transmission
 |
The motors,
which are DC motors originally made for cassette players, are
cylindrical and thus very difficult to mount and firmly fix to
a chassis.
So
this unique technique was used, which is to use pipe clamps,
originally used to mount water pipes all along the walls
of buildings (see figure 4.A). Those pipe clamps are easily
available for all the diameters you can imagine, at least
you will easily find a pipe clamp whose diameter fits
the diameter of your motor. |

Fig. 4.A
|
You can notice
a small black plastic pulley fixed at the end of the motor's shaft,
which will be then used to transmit power to the wheels using
a belt. This small pulley can be found from the same store where
you can buy those motors, the rubber belts, as well as all kind
of accessories of cassette players.
When
the motors and the pipe clamps are assembled as shown
in figure 4.A, they can finally be easily inserted in
their place in the chassis (main board), then all you
need is to add a rubber belt to obtain the transmission
system shown in figure 4B.
This pulley / belt assembly acts exactly as as the gearbox
added to a DC motors to reduce speed and increase torque.
Depending on the size of the belt you have, you can adjust
its tension by adjusting the height of the motor itself,
which can easily be done by changing the position of the
nuts on the screws holding the motors to the PCB. The
optimum tension in the belt can be easily found by trial
and error.
|
Fig.
4.B |
5-Electronics
 |

Fig. 5.A
|
Circuit description:
Being powered from a 7.2V battery, the regulator U3 provides regulated
5V for the microcontroller and for the logic gates of the motor
driver. You can add a capacitor between the output of the regulator
and the ground to absorb the noise caused by the presence of motors
in the system, but I didn't use any, and didn't face any problems
regarding this issue.
When the switch SW1 is switched OFF, the battery can be charged
using the jack J2.
The line sensor is composed of 4 cells, and is based on the IR
emission/reception technique described in this tutorial.
D1 to D4 are IR LEDs used as receivers, D9 to D12 are also IR
LEDs, but used as emitters this time. The output of the line sensor
is directly fed from the Op Amps to the microcontroller. Only
two outputs are connected to the LEDs D7 and D8, giving a direct
indication of the output of the sensor, making the calibration
process very easy through the
potentiometer
R6. For more information about line sensors, check this
tutorial specially dedicated to line
tracking sensors and algorithms
Figure 5.B shows the 4 emitter and 4 receiver LEDs at
the front of the robot. Note that this is the optimal
position of the line sensor, as you can see in the tutorial
above about line sensors.
It is also clear that they are mounted on the copper side
of the board, even through they are regular LEDs (not
SMT type). The Leads of the LEDs are used to adjust the
height of the sensor from the ground. 10 to 20 millimeters
proved to be a fair height for the sensor to function
properly. |
Fig.
5.B |
The connections around the microcontroller are standard in most
of our 8051 based projects, they are the crystal resonator along
with the two decoupling capacitors, the debouncing circuit attached
to the reset pin, and the ISP (In system programming).
Upon switching on the robot, The software loaded on the microcontroller simply directs the robot to the line, using standard
line following algorithms described in the following article.
You can download the C code along with the HEX file to be loaded
into the microcontroller at the end of this article.
The two motors of the robot are driven using the reliable L293D
Motor driver IC, the motors are connected to the wire connections
W3, W4, W5, and W6. Being controlled by the microcontroller,
the speed of the motors can be easily adjusted using PWM pulses
fed to the motor through the Enable PINs of the driver. Note that
each channel has it's own independent Enable PIN, making it very
easy to control the speed of two different motors simultaneously.
REMINDER: Operating the L293D motor driver
Using
the L293D motor driver, makes controlling a motor as simple
as operating a buffer gate IC. It totally isolates the
TTL logic inputs from the high current outputs.
Putting a logic 1 on the pin In1 will
make Out1 pin go to Vpower (36 Volts
MAX.), while a logic 0 will make it go to 0V
Each couple of channels can be enabled and disabled using
E1 and E2 pins. When disabled a channel provide a very
high impedance (resistance) to the motor, exactly as if
the motor wasn't connected to the driver IC at all, which
makes this feature very useful for PWM speed control.
Figure 5.C shows different ways to connect a
motor to the IC.
One way is to use 2 channels to build |
Fig.5C:
Using the L293D motor driver
|
a bi-directional motor driver, another way is
to use 1 channel per motor, building a unidirectional driver.
In this project, we will be using the 4 channels to drive the
2 motors in both directions. To get more specific information
on this very useful IC, you can always download and inspect the
datasheet
Download
the zip file for this project
containing the full schematic, PCB design and Source CODE.
[note: i use ExpressPCB(FREEWARE)
to design the schematics and the PCB]
|
 |
Download
movie clips showing how the robot is following
a line in a track:
|
|
Preview of the last 15
messages discussing this page. Messages are sorted from the newest to
the oldest. |
Posted
by:
sivan
on:
02 Feb 2010 |
Mini line follower robot |
|
 |
hello,
can i know the value for the all the component that is using such, what is value of the : R8 R9 D1 D2 D3 D4 C1 C2 & .....
|
|
|
|
Posted
by:
varunsharma1803
on:
22 Jan 2010 |
Mini line follower robot |
|
 |
SIR,
IN THE ABOVE ARTICLE U MENTIONED THE USE OF PWM. WHY IS IT USEFUL & HOW CAN IT BE IMPLEMENTED IN THE ABOVE CIRCUIT. PLEASE REPLY SIR...THNX
|
|
|
|
Posted
by:
paijozz
on:
20 Jan 2010 |
Mini line follower robot |
|
 |
hi iam from indonesia, now on project to build robotic line folllower, i need help to increase my power supply from 4,8 v (4 AA battereis)to 6 v or 5,25v at least without significant current loss. would you please help... alot of thanks..
|
|
|
|
Posted
by:
minaadly
on:
15 Jan 2010 |
Mini line follower robot |
|
 |
Dear Ibrahim I am trying to add to the port 2 of the controller obstacles avoiding sensors but i am not sure will that work or not cuz i am using normal 9v batteries connected directly to the regulator and the motors im using consumes so much current, so what do you think will this just kill the whole robot or what??!! and do you think this idea of obstacle avoid is possible?? thanks buddy
|
|
|
|
Posted
by:
raj kishan
on:
02 Jan 2010 |
Mini line follower robot |
|
 |
Sir i have burned the program into the microcontroller(89s52) then wats the need of j1,i didn't give any connections of j1 to 89s52 wat should i do the terminals of 89s52 6,7,8 shold i ground them or leave them open.plz reply me sir.
|
|
|
|
Posted
by:
vinodkp
on:
27 Dec 2009 |
The IR LEDs in Series |
|
 |
A very good project with full details and PCB layout. It must have been very difficult to put everything on a small single sided PCB. But i have a doubt the schematics and the layout show that the IR Leds are connected in series with 25 Ohm resistance and to 5 volts power supply. Is it possible to run 4 LEDs in series with 5 volts power supply . As far as I know
Vf for IR leds ~ 1.8 volts total voltage drop required for the LEds to work = 1.8*4= 7.2 Volts.
Please clarify
|
|
|
|
 |
Posted
by:
minaadly
on:
24 Dec 2009 |
Mini line follower robot |
|
 |
Ibrahim i built the whole project but still the robot reactions aren't right and i used the 6v dc motors but they are so weak they can not move the robot's weight, when i put it on the black line the 2 motors move really fast, and when i deflect it to the right or to the left the right motor slows down dude i dont know what to do, what do u think is the problem!!! and there is something else i wanna ask u about the IR leds recievers are the 8 IR leds are identical "IR led senders" or should i use the green leds "IR recievers" thanks man
|
|
|
|
Posted
by:
minaadly
on:
19 Dec 2009 |
Mini line follower robot |
|
 |
Dear Ibrahim I am trying to add to the line following robot to be also Obstacle Avoidance feature, so do you have any ideas how to re-configure the line following robot to advance its features.. Thanks buddy and Sorry to bother Have a great day..
|
|
|
|
Posted
by:
ikalogic
on:
18 Dec 2009 |
Re: Mini line follower robot |
|
 |
Quoting minaadly: Dear Ibrahim I think there is something wrong in your pcb in the amplifier "U1" as you see in the schematic Pins 3, 5, 10, 12 are connected together, while in the pcb (3&5) are not connected with (10&12) hope you can back me up with that, and could you tell me the value of the potentiometer R6 you're using??.. Thank you in advance Good job buddy |
Hello
In the PCB, 3&5 and 10&12 are connected via a jumper wire on the connector side.
R6 can be anything from 1K to 100K.
ika
|
|
|
|
Posted
by:
minaadly
on:
17 Dec 2009 |
Mini line follower robot |
|
 |
Dear Ibrahim I think there is something wrong in your pcb in the amplifier "U1" as you see in the schematic Pins 3, 5, 10, 12 are connected together, while in the pcb (3&5) are not connected with (10&12) hope you can back me up with that, and could you tell me the value of the potentiometer R6 you're using??.. Thank you in advance Good job buddy
|
|
|
|
Posted
by:
bahauddin
on:
03 Dec 2009 |
Mini line follower robot |
|
 |
I am very new in this field and trying to learn..... I think your site is an excellent teacher for the very beginner's like me. Can you plz explain the logic or algorithm of the micro-controller:
especially: if ((l1+l2+l3+l4) != 0){}--> this part & the "pwm_gen() interrupt 1{}"-->part.
Thank you so much
|
|
|
|
Posted
by:
ikalogic
on:
30 Nov 2009 |
Re: Mini line follower robot |
|
 |
| Quoting minaadly: i have downloaded the hex code into the at89s52 through an atmel programmer so should i also use the isp in the schemetic above or should i ground the miso and the mosi and the sck and the reset or just ignore them??? |
Nooo!! don't ground them, leave them open!
|
|
|
|
You have
to be a member to post replies. |
|
|
|