Вы находитесь на странице: 1из 16

Line follower robot (Type: Non programmed)

Posted by admin on Friday, 27 January 2012

Line follower is an autonomous robot which follows either black line in white are or
white line in black area. Robot must be able to detect particular line and keep
following it.

For special situations such as cross overs where robot can have more than one path which can be
followed, predefined path must be followed by the robot. In the following section, we will discuss
the line follower robot which follows black line on white back ground and take right turn whenever
cross overs or Y shaped turn arrives.However with some minor suitable changes, users can make
robot for other possibilities also. An array of sensor is used to detect the line. Based on the status
of sensors, special circuit or controller decides the position of line and also the required direction of
motion required to follow the line. Motor driver circuit is used to ON/OFF the LEFT/RIGHT motors
of the robot to provide desired motion.
Sensors are required to detect position of the line to be followed with respect to the robots
position. Most widely used sensors for the line follower robot are PHOTOSENSERS. They are
based on the basic observation that the white surface reflects the light and the black surface
absorbs it. For more details, please read Sensor module article by me. There,
you will find all information about working of IR sensor, and how i made
custom sensor module.
To make line follower, you does not always need to do programming or deploy any
programming device. I have divided this article into two paths. after completing all
theory and construction of circuit and mechanical chassis of this line follower, we will
have two branches, one will go to the way, where you will program the PIC microchip
(or any other microcontroller) to run your line follower and other will go to a basic line
follower, which will be less advance and autonomous than the one with programming.
There are various concepts which you at any cost must know before starting to make
this line follower like DC motor controller, IR sensor module (or array in this case) and

Differential drive (chassis mechanics). i will recommend you to read these articles
before you go further. Differential drive, we will learn in this article only.

Why i chose line follower

I used line follower because its a nice eye catching robot, by which you can also learn
various concept in one go. Its like a intelligent machine or a vehicle. This will lead to
you on a path where you can go further advance and make various intelligent robotic
vehicles. with this, You can also win so many prices in your college technical fest
because its a famous competitive robot. Morever, This robot needs a very continous
and fast cycle of input -> processing -> output continously to function properly.
After making this robot, you can ferquently convert and modify this system a little to
make other robots like Object follower/repeller, Obstacle detector/avoider, Light
follower and similar robots.

Implementation

Lets, start with mechanics of robot. Hoping that you have already read about IR sensor
module and I think that firstly, you should be given a brief information about the the
term Differential drive. A differential wheeled robot is a mobile robot whose movement is based
on two separately driven wheels placed on either side of the robot body. It can thus change its
direction by varying the relative rate of rotation of its wheels and hence does not require an
additional steering motion.

To balance the robot, additional wheels or casters may be added, which is called
castor wheel. If both the wheels are driven in the same direction and speed, the robot
will go in a straight line. If both wheels are turned with equal speed in opposite
directions, as is clear from the diagram shown, the robot will rotate about the central
point of the axis. Otherwise, depending on the speed of rotation and its direction, the
center of rotation may fall anywhere on the line defined by the two contact points of
the tires. While the robot is traveling in a straight line, the center of rotation is an
infinite distance from the robot. Since the direction of the robot is dependent on the
rate and direction of rotation of the two driven wheels, these quantities should be
sensed and controlled precisely.
A differentially steered robot is similar to the differential gears used in automobiles in
that both the wheels can have different rates of rotations, but unlike the differential
gearing system,a differentially steered system will have both the wheels powered.
Differential wheeled robots are used extensively in robotics, since their motion is easy
to program and can be well controlled. Virtually all consumer robots on the market
today use differential steering primarily for its low cost and simplicity.
In the fourth turning, where its spinning, here the point of spin can vary again due to
speed of motor running in opposite side. For an instances, i form another case, when
Left motor is running and right motor is stopped. In that case also, robot will
spin clockwise, but the center of circle will be right wheel instead of the
center of robot.

Principal logic behind functionality

The main logic of functionality of a line follower robot is to controll the both motors
with the input comming from Sensors reading line position continously.

Now, for both types of line follower robot (with or without program), motor driver and
motor circuit will be same. Only first two blocks are changed.

Please note that, for line follower type-1 which is without programming, Its is
compulsion to use digital IR sensor module because we are directly using the IR sensor
module information into motor driver and building logic by electronic connection that
robot follows a darker line (hard calibrated) on brighter surface.
These robots can't run directly on line, they needed to be calibrated to the ambient
light and material of which line and background floor is made (reflective index). We
can also use only 2 sensors for running this type and its very easy to construct.
On other hand, Type-II line follower will need a programming device (any
microcontroller having ADC inbuilt or equipped). I have used PIC 18F4550
micrcontroller. There are several reason that i used this microcontroller over 8051 and
AVR.
1. Its programmable by USB and hence laptop, no serial cable is required. (usually in
line follower competitions, we have to burn programm again and again)
2. Its standard circuit can be easily made on bread board and hence cut overall cost
3. Most importantly, it has ADC(Analog to digital conversion) inside inbuilt, so no
overhead of interfacing another external ADC IC.

So now, after you have a microcontroller with ADC inside it, then you can use any
amount of sensor, you can preconfigure calibrated value, such that outside, inside,
intensity of lights and then select the profile before you run the robot to eliminate the
need of calibrating the sensors.
I used 3 IR sensor array in my PIC powered line follower robot and it worked for me in
any type of line (With varying width and colour).
To prepare, mechanical structure, take any metallic or plastic chassis. I preffer square
in shape because of ease in differential drive system. With this, attaching the geared
motor with high torque and lesser speed. It provide more control of electronics over
the motion of robot during turns. Here, i have attached an image showing my own

chassis of this robot, fixed with DC motors with gears.

Line Follower type-I

In this type of line follower robot, we build the logic by seeing the image above, Here,
you can clearly observe that the motor on the side where the sensor is on black line
has to be stopped so that the sensor comes again to the side of the line.
So cases are like this:
Both sensor on sides of line (brighter backgroud) => Both motor run Corresponds
to [1st stage and 6th stage]
Right on line & left outside => right motor off & left motor runs resulting in right
turning Corresponds to [ 2nd, 3rd and 5th stage]
Left on line & right outside => right motor runs & left motor stops resulting in left
turning Corresponds to [4rth stage]
Both on Black line => Both motor stops
so putting all information and cases together, i got a formula by which we should
connect the output of digital sensor to L293D motor driver and that is, firstly
calibrate your IR sensor such that they are giving 5 volt or logic 1 on white
surface and 0 logic on black line. After that just connect the output of each
Digital sensor module to each motor respectively. Such that right side IR sensor
will trigger the right side motor ON/OFF and left side sensor will trigger the left side
motor ON/OFF with help of Motor driver IC L293D.
Please note that, we have two sensors and will be making two seperate digital IR
sensor just by using one LM393 IC because it has two channels of comparision. So in
actual output of LM393 IC will be connected to motor driver. To understand this, my IR
sensor module article is compulsary to read.
Below is the video of this line follower working.
I hope this article helped you. Please feel free to comment below or contact me, for any query. :) In
the next tutorial, i will tell you about line follower type-II which will be programmed by PIC18F4550
with 3 sensors and will work in various environmental condition without much calibrations.

Line follower robot (Type: programmed with PIC


18F4550)
Posted by admin on Wednesday, 1 May 2013

In previous tutorial, i explained you from scratch about a line follower robot. The logic
behind it, the principal, Mechanic formation, motor and sensor caliberating and i also
showed you a working model of line follower robot, which was not very flexible with
turbulant nature of environment. It has some weakness and drawbacks like it was
required to caliberated before eunning, it needed to be caliberated every time in every
different ambient light. And most importantly, it was unable to make good decisions
accept following an continous smooth black line over white or lighter background.

To fill all these gaps in the robot which we made last time, I will now introduce one of
my friend "PIC 18F4550 MCU" from Microchip. Yes! he will solve all of these problems,
which i have mentioned above. So lets start with sensor part. Before we start, if you
want to get familiar with this development board of PIC 18F series, please
click here.This board is designed and developed by me and has various
interesting features.
In sensor connection also, in past we were restricted to use only 2 IR sensor module,
but now in this case, we can use any amount of sensor module depending upon what
quality and speed, if need and how much ADC pins are available freely on this chip.
This is true, that more IR sensors are there on line follower robot to detect the line,
more accurate and error free robot will be. You can also use higher RPM motors to run
robot fast.

In this tutorial, we will only use 3 IR sensor modules to keep it basic. Main aim to use
more than 2 sensors is to eliminate the intense need of caliberating IR powered sensor
everytime. Previosuly, with 2 sensors, we were just getting the value of sensor and
comparing it with a caliberated value, it was greater, we ran the motor and if it was
lesser than that value, then we were stopping the motor on that side. Now, with three
sensor, we will compare the value comming from each sensor, or each sensor
with

caliberated

value.

In

this

tutorial,

we

will

follow

the

later

solution, because for the former solution (which eliminated the need of caliberation
completely) is only successfull, if the mechanical chassis is made in such a way that IR
sensor will not be effected by SUN and much intense IR light in some Bulbs. Because
high IR disturbance can make a system very unstable that even PIC will not be able to
handle it.
Hence, there will be still a need of caliberating, but its done only once after
construction of robot with new sensors and that too only for ambient light error
correction. But this line follower robot will be really very smooth. Reason is in the
analysis of the states of robot.
After the change in number of IR sensors, there is also changes in the states of
robots. like to run:
Robot forward before, both sensor were required to be on both side of the black line,
but now logic is, middle sensor value lesser and sensor on the sides.
Robot left/right turn before, one sensor had to be on black line. But now, its two
sensor on black line.
How this change will help?
when you saw the video of working old linefollower, you must have noticed the zigzag
effect. This is the effect when a line follower robot's path correcting loop corrects the
path, when robot is going out of line in a zigzag manner or damping style.This
happens due to the fact that line follower with 2 sensors does not stop the
turning of robot at right time and it leads to overcorrection and hence
opposite side corrects and again it leads to overcorrection.
With 3 sensors, there is no such problem because of the middle sensor which stops the
correcting code at right time, before robot crosses to opposite side. ALso, you will
notice that in comparator based line follower, robot is always in hurry means it is
always moving and correcting, which is also good and also bad. But we do not have
control over it because there is no option to change that. But in PIC based or any other
Mcu based, we can program it such a way that robot will first correct itself
during going wrong and then move forward.
Basicle, now we can run motors as we want. we can also reverse them in some state.
But i wont go into that detail now. You can see all these effects which i mentioned you
in the video. This robot would have run so nice but i knowingly have run it on a line
whoes thickness is changed after programming this robot, so that you can see the
correcting effect.

Code explaination

I have made a robotic car which functions for 10 types of autonomous


behaviour (all close to each other logically) for example: light detection, line follower,
lighter line follower, obstacle avoidance and so on. From them, today i will tell you
about darker line follower robot. you can find code for this multi-behavioural robot
on my git repository for pic codes with name All_in_one_robot.c
Now let's discuss the line follower code. In this image, you can see that i have called
useSensor function made by me for opening ADC channels. Here, top three lines in
lo=4 is responsible for opening adc at adc_ch0, 1 and 2.

Please do not
get confuse due to extra calling statements, these are for some other sensors. As i
told you already that its code for several behavier with same logic.
Next, we have the functional routins which get us the value of ADC of different
sensors. Here, firstly we are setting adc channel to particular channel connected to
that sensor physically, then we call convert(), wat for completion and then save the
value for further use in the main function.
Main logic is in side while loop, where we have different comparision of these sensor.
Here i have not used saved value instead i have used int returning function with same
defination, so here you can see that i have coded different actions with different value
pattern of sensor as described above. I can't explain complete code here, but i think
that once you will have a look over the code on my git repository, you will get an idea
of logic implementation. at each function, i have also a portion of self caliberation
code for sensors and it also indicates the caliberated states by green LEDs.

I hope that this article helped you in making your own PIC powered line follower robot.
If still, there are somethings unclear, feel free to contact me at my contact page or
comment below.

FireBall
Expressway was a very easy line follower to
build and program. Since line following was
so easy, why not build a fast line follower?
Extra Parts was the result. It used the same
line sensors as Expressway, the same
wheelbase as Expressway, the original
motors out of Excuse, a spare NiMh battery,
and an old control board that was in the
junk box. The problem with Extra Parts was that it would not follow a
straight line. About a year of fine tuning the PID algorithm and settings,
and it still would not follow a line. There was a spare LiPo battery laying
around, so that went into Extra Parts in place of the NiMh and
everything started to work! So, in addition to speed, torque, and
traction, add low weight (or mass) to the desirable characteristics of a
good line follower. After all of that fun, it seemed like the ExSpurt
chassis would make a good line follower since it had the proper
characteristics.
At the 2009 Peoria Bot Brawl, club member
Len Sheldon was raffling off one of
his Probotix FireBall V90 machines. Years ago
some friends tried to get me interested in a
CNC mill, but there was too much other stuff
to do. Now, this new machine looked very
interesting. So, I tried to buy all of the raffle
tickets, but ran out of money before they ran
out of raffle tickets. Unfortunately, I didn't win it. Fortunately, My
videographer, Cathy, did win it. Unfortunately, I had to listen to every
thing that she was going to make for the five hour drive home.
Fortunately, Cathy didn't have room for it at her house so FireBall V90 is
in my basement. Unfortunately, I have to ask permission to use it every
time.
I had extra Maxon motors, wheels, and batteries
from ExSpurt. ThePololu QTR-8RC is a much nicer
sensor package that was used on Expressway and Extra
Parts, so one was added to the project. A new chassis
was required that was a little wider and had a front
sensor mount. Late one Saturday evening, I started the
chassis drawing. It turned out well, so on to download
Vectric Cut 2D software and go through the tutorials. G
code was generated. After several "air" parts were made, the chassis was
cut out of carbon fiber, my first CNC part. The whole thing from initial
drawing to final finished chassis was done in about an hour! This is the

way to make robots!


Take the new chassis, four Maxon motors,
and the old ExSpurt jig, add some epoxy, let
cure overnight, and the base for a new line
follower has been built.

I've been having good luck with the Parallax


Propeller in the RoboMagellan robot, so why not use
it here. There is a small package called the Spin
Stamp that puts a Propeller chip on the same size
package as the Basic Stamp. A new control board was
made with the same H-Bridge and driver as ExSpurt,
but with a Spin Stamp. The voltage regulators on the
Spin Stamp are a little unusual, so it took some time
to work out a reasonable voltage regulator arrangement that provided
both 3.3 volts and 5.0 volts.
Of course, all of the code was downloaded from Parallax forums and the
Propeller Object exchange. The Spin Stamp only uses three cogs, the PID
loop, QTis sensor, and SN754410 motor driver. The only change that was
made to the SN754410 object was the pin numbers. The QTis object was
changed quite a bit. First, only 2,000 counts (25usec) is used to charge
up the capacitor. Then the discharge lasts for 40,000 counts (0.5 msec).
Finally, a Case command was added to convert the sensor input to an
integer offset from center. The Case command in Spin wasn't very fast at
about 250 usec, so it was run during the 40,000 counts that the
capacitors were discharging.
The PID loop was extensively modified. It had the following variables:

Speed factor is a way of slowing down the top speed. This is very
handy while fine tuning the PID loop and adjusting to variable
conditions at contests
PID loop timing can be as fast as 1 msec. There doesn't appear to
be any performance gain for 1 msec PID loop over 10 msec PID
loop.
Proportional feedback factor. This is the standard PID loop factor.
Integral feedback factor, this has always been zero for my robots.
Differential feedback factor. Again, the standard PID loop factor.
Center Point, it the offset from the center of the line that the
robot will run. Some contests have mostly left or right hand turns,
so some adjustment of the center point might be beneficial.
Corner Speed, is the amount of the PID correction factor that is
fed to the "fast" or outside motor in a turn. The purpose is to slow

down when in a turn.


That seems to be enough tuning things to adjust for anyone.
FireBall's first contest was the 2010 Bot Brawl in
Peoria. Practice was black 3M electrical tape on
the white kitchen floor. Please watch the videos
here. The first run was at a speed factor of 60%,
which was well within FireBall's capacity. The
second run was at a speed factor of 70% which is
about at the limit experienced on the kitchen
floor. The third run was 75% and slower due to
lack of smoothness in the corners. It appears that FireBall is about 25%
faster than the Pololu 3pi, but only slightly faster than Mike Dvorsky's
Low Down. FireBall was lucky!
The next contest was ChiBot's Fall 2010 at the Ihobby Expo. The racing
line following contest is unusual in that they have a white line on a
black surface. No problem? Not quite. It seems that one or two sensors
detect a black line on a white surface, but three or four sensors might
detect a white line on a black background. The white must "bleed" over
a lot! So, the Case command was a lot longer. For practice, a sheet of
plywood was painted black and white 3M electical tape marked the
course. Lots of runs were made on this surface fine tuning the variables.
Due to the wider appearing line, fastest speed was lower than for the
Peoria contest. FireBall won again against international competition.

Вам также может понравиться