Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Line Follower Robot

By Dishant Shah

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 in white area 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.

 

Video

 
·         BLOCK DIAGRAM
Let us see how the line follower robot works. First see the block diagrams.
 
Line Follower Robot
 
·         EXPLANATION OF BLOCK DIAGRAM
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
Sensors are required to detect position of the line to be followed with respect to the robot’s 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”.
 
Sensor circuit contains emitter, detector and comparator assembly.
 
·         PHOTOSENSORS
IR or VISIBLE light is emitted from the emitter (IR light is mostly preferred to avoid interference from the visible light which is generally around the robot. However IR light is also present in atmosphere but its intensity is much less than that of visible light, so IR light can give much reliable output. For better accuracy of the sensors, they must be covered properly for the isolation from the surrounding.)
 
This emitted light strikes the surface and gets reflected back. If the surface is white, more intensity of light gets reflected and for black surface very less intensity of light is reflected.
 
Photo detector is used to detect the intensity of light reflected. The corresponding analog voltage is induced based on the intensity of reflected light. This voltage is compared with the fixed reference voltage in comparator circuit and hence it is converted into logic 0 or logic 1 which can be used by the controller.
The comparator circuit may be designed in two ways.
 
Case-1
Black area=1
White area=0
 
Case-2
Black area=0
White area=1
 
In the following section, case-1 is used.
 
 
Sample circuit for the sensor is as shown in fig.
 
·         EMITTER CIRCUIT
 
 
EMITTER-CIRCUIT.jpg
 
·         OP-AMP PIN OUT
 

OP-AMP-PIN-OUT.jpg

·         PIN DESCRIPTION
Vcc is 5V power supply.
Input+ is non-inverting input terminal of an op-amp =V(+).
Input- is inverting input terminal of an op-amp=V(-).
Output is either logic1 or logic 0 depending upon both input terminals.
Output is Logic 1 if V(+) > V(-)
                Logic 0 if V(+) < V(-)
 
·         DETECTOR CIRCUIT
A= centre point of voltage divider circuit (always 2.5V)
B= Non-inverting terminal of OP-AMP
C= Inverting terminal of OP-AMP
D=Output terminal of OP-AMP
 
 
·         WORKING OF DETECTOR CIRCUIT
·         When light falls on detector D2, a voltage drop of around 0.7V occurs across D2 and hence 2.5V (voltage at A) – 0.9*V (drop across D2) = 1.6*V (voltage at C)
·         When light does not falls on detector D2, no current flows through it and hence voltage at C = Voltage at A =2.5V
 
*These values will be change with change in atmosphere, lighting conditions etc. We have to change variable resistor to get the desired output.
 
Now let us see various conditions as given in the table below.
 
Voltage at A
Voltage at B
Voltage at C
Voltage at D
output
2.5V
Less than 2*V
If light falls,(white area) 1.6*V
0V
Logic 0
2.5V
Less than 2*V
If light does not fall,(black area)
2.5V
Vcc=5V
Logic 1
2.5V
Greater than 2*V
If light falls,(white area) 1.6*V
Vcc=5V
Logic 1
2.5V
Greater than 2*V and less than 2.5V
If light does not fall,(black area)
2.5V
0V
Logic 0

 

 

 
If voltage at C is greater than 2.5V, the output will be always at logic 1. This condition must be avoided.
 
*These values will be change with change in atmosphere, lighting conditions etc. We have to adjust variable resistor to get the desired output.
 
·         LDR (LIGHT DEPENDENT RESISTOR)
 
It is a special type of resistor. Its resistance is dependent upon the intensity of light falling upon it.
 
It has wide range of resistance depending upon the intensity of light. Its resistance can vary from few ohms to some kilo-ohms or even more.
 
 
To use LDR, above circuits with the following modifications can be used.
1.      Use visible LED instead of IR emitter.
2.      Replace detector with LDR.
 

Controller & Motor Driver

·         CONTROLLER
 
It is the most important part of the line follower robot. It reads the sensor’s output and based on it, drives the motor’s motion.
 
Let us see how to decide motor’s motion based on 8 possible combinations of three sensors.
 
Sensors give logic 1 for black area and logic 0 for white area. Robot has to follow black line on white surface.
 
 
Here is the truth table for it.
 
LEFT SENSOR
MIDDLE SENSOR
RIGHT SENSOR
STATUS
DECISION
0
0
0
NO LINE
FORWARD*
0
0
1
LINE AT LEFT SIDE
LEFT TURN
0
1
0
LINE AT CENTRE
FORWARD
0
1
1
LINT AT CENTRE & MIDDLE (SHARP LEFT TURN )
TURN LEFT
1
0
0
LINE AT RIGHT SIDE
TURN RIGHT
1
0
1
LINE AT BOTH SIDES(Y SHAPER TURN)
RIGHT TURN*
1
1
0
LINE AT CENTRE & RIGHT SIDES(SHARP RIGHT TURN)
RIGHT TURN*
1
1
1
LINE AT ALL SIDES (CROSS OVERS)
RIGHT TURN*
 
*=> In these situations, take decision as per your application.
 

 

·         MOTOR DRIVER IC
 
L293 is one of the most widely used IC for motor driving. One IC can drive two different motors independently.
 
Pin-out for the L293 is as shown in fig.
 
MOTOR-DRIVER-IC.jpg
 
·         PIN DESCRIPTION
 
E1 & E2- logic 1 (5V) to enable M1 or M2 respectively. Both the pins can be controlled either from controller or by directly connecting 5V power supply.
 
Pin 8- Voltage required to drive motors-It can be 9V or 12V.
 
Vcc- 5V power supply
 
M1-B-=to drive M1 in forward direction
 
M1-A =to drive M1 in reverse direction
 
M2-A=to drive M2 in reverse direction
 
M2-B=to drive M2 in forward direction
 
These pins must be driven by controller.
We do not need reverse motion here. So M1-A and M1-B will be set at logic 0.
 
Hence for various motions of robot, see the following truth table.
 

Circuit Diagram & IMP Guidelines

·         CIRCUIT DIAGRAM OF LINE FOLLOWER ROBOT
 Check the Circuit Diagram Tab
·         CIRCUIT CONNECTIONS
 
1.      There are three sensors. They are connecter with microcontroller P89V51RD2BN as
a.       Left sensor= Pin P0.2
b.      Middle sensor=Pin P0.1
c.       Right sensor=Pin P0.0
 
2.      Motor driver IC L293 gets four inputs from P89V51RD2BN as
a.       M1-A=P2.0
b.      M1-B=P2.1
c.       M2-A=P2.2
d.      M2-B=P2.3
 
3.      Left side motor is M1 and right side motor is M2.
 

 

·         IMP GUIDLINES
 
(1.  Usually three sensors cannot provide sufficient accuracy because if one sensor fails to detect a line, robot will be out of the track.
The most efficient solution is to increase the number of sensors. This change can change the program more complex.
The best way is to use more sensors and use the program of three sensors given below. Let us see how this is possible.
Suppose we wish to use three sensors (l1, l2, l3) on left side, two sensors (m1, m2 )at middle and three sensors (r1, r2, r3) on right side.
Now left sensor= l1+l2+l3
         Right sensor=r1+r2+r3
        Middle sensor=m1+m2
+ shows Boolean or operation.
Now eight sensors can be represented using three sensors only and the given code can be used. Such arrangement will improve the accuracy of the robot.
(2.   Assume black line to be followed in white area.
Analyse the track to be followed. If it does not contain the missing lines than when all the sensors shows white area, it means robot has gone out of the track. At such condition provide the reverse motion to robot so robot will automatically detect the find the line again. If you will not provide reverse motion, you may have to face penalty. Using this idea you can avoid it.
 

HARDWARE REQUIREMENTS & PREPARATION

·         HARDWARE REQUIREMENTS
 
In this robot, very few hardware elements are required. You need following things.
 
1.      Body of PLY/PLASTIC/METAL etc.
 
It is required to enclose the entire robot within it. You can make robot in which circuitry is visible. In such case, you need a base only.
 
Many types of materials are available which can fulfil the requirements, but thin sheet of PLY is the best choice as drilling and fitting of assemblies on ply is very easy.
 
2.      PVC/PLASTIC pipe
 
It is required for proper alignment of motors. You can fit motor at each end of the pipe so that any misalignment between motor’s axis is avoided which will improve performance of robot on track while moving.
 
3.      Clamps, screws & screw driver
 
Combine assembly of motors and pipe can be fitted on base of robot using clamps and screws.
 
4.      Drilling Machine
 
It is required to drill holes on base of robot for screws.
 
·         STEP BY STEP HARDWARE PREPARATION
 
1.      First prepare GPBs/PCBs of sensors, controller’s working environment and motor driver assembly and provide interconnections between them also.
2.      Select base material (we assume it as a PLY) and shape of it.
3.      Calculate approx. space required for individual circuits and prepare a plan how they will be placed.
4.      Draw the plan on ply. Provide some margins.
5.      Cut ply as per the plan.
6.      Drill holes at corners of circuits and at their respective position on base.
7.      Fit the circuit with base with the help of screws.
8.      Now your robot is ready.
9.      If you want, you can cover the entire robot in suitable body.
10. Isolate sensors from atmosphere so that their performance is not affected by atmospheric light, camera flashing etc. (This is very much essential when you are using IR sensors/ LDR etc.) 

 

 

 

 

 

Project Source Code

 

Project Source Code

###


#include<reg51.h>

//forward=0x09;value to be put on P2 for forward motion

//left turn=0x08; value to be put on P2 for left turn

//right turn=0x01; value to be put on P2 for right turn

//P0 as input port-connected to sensors

//P2 as output port-connected to L293-motor driver IC

 

void delay(unsigned char di)                          //delay subroutine

{

      unsigned char dii;

      unsigned int d;

      for(dii=0;dii<di;dii++)

            for(d=0;d<1275;d++);

}

void main()

{

unsigned char msg[8]={0x09,0x08,0x09,0x08,0x01,0x01,0x01,0x01};

unsigned char a;

while(1)                       //repeat forever

{

a=P0 & 0x07; //read sensors and mask upper 5 bits(bit 3 to 7) of P0

P2=msg[a];      //select the desired value from array msg based on sensors //position

delay(10);        //provide delay

}

} 

 

###

 


Circuit Diagrams

Line-Followet-Circuit-Diagram


Filed Under: Electronic Projects
Tagged With: line follower, motor, robot
 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • Introduction to Brain Waves & its Types (Part 1/13)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Advice for my disabled son please
  • Very low voltage/power Schmitt trigger?
  • 3D IC Design: Is it possible to stack CPU and FPGA?
  • dc to dc converter sparks when inserting fuse
  • 7 segment display connections

RSS Electro-Tech-Online.com Discussions

  • Pet Microchip scan
  • Disabled son needs advice please
  • Modify a digital clamp ammeter ?
  • Confirming whether this circuit will work
  • How does a blinky/flashing ball work?
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering