loading

Line trackers are one of the most prominent kinds of robot. they have been existed for very long time and usually for beginners in robotics this is the best project you can play with since this robot has some basic functions and basic programming.

A line tracker robot is a robot able to detect and track a line (black) even if the path is altered by changing the shape of the line. this type of robot has a simple task, and doesn't require strong skills in programming and electronics.

Step 1: STUFF REQUIRED:

HARDWARE:

  • Arduino Uno
  • 1x IR Sensor Module
  • 1x L293D Motor Driver IC
  • Robotic Platform / Chassis
  • Breadboard / PCB ( It's up to you )
  • 2x DC Motors
  • 1x Castor Wheel
  • 2x Wheels
  • 1x 12V Battery
  • 1x 9V Battery
  • And finally some connecting wires

SOFTWARE:

  • Arduino IDE : ARDUINO

Step 2: HOW IT WORKS:

The robot has five infrared sensor module attached at the front of our robot that detects from where the light reflects back. that information is used to decide whether to continue straight or to change the direction of the motors to turn accordingly.

Working of line tracker is very simple and interesting. line tracker senses black line by using sensor module and then sends the signal to arduino. then arduino drives the motor according to the sensors' output.

FUNDAMENTAL LOGIC OF LINE TRACKER:

A Dark object reflects less light than a bright object, or we can also say, a dark object absorbs more light than a bright object, this is the only fundamental logic behind a line tracking robot. so, in a line tracking robot, we use a sensor that detects the difference between bright and dark objects, or simply, distinguishes a black line from a white surface.


Step 3: MAKING CONNECTIONS AND ASSEMBLING THE ROBOT:

Look over your robotic platform / chassis and decide how you would like to assemble it. It's all up to you, either you can make an open and exposed version of your line tracker using breadboard connections or you can go with an enclosed and sorted wiring style like I did using PCB. However, I preferrd to choose enclosed and sorted version for my line tracker and tried to give a unique and different look to my line tracker robot.

I have also made a motor driver shield which is directly connected to the arduino uno board as per the connections ( shown in above figures ).


Make the connections as follows:

  • ARDUINO VCC - SENSOR MODULE VCC
  • ARDUINO GND - SENSOR MODULE GND
  • ARDUINO DIGITAL PIN 12 - SENSOR MODULE S1
  • ARDUINO DIGITAL PIN 11 - SENSOR MODULE S2
  • ARDUINO DIGITAL PIN 10 - SENSOR MODULE S3
  • ARDUINO DIGITAL PIN 9 - SENSOR MODULE S4
  • ARDUINO DIGITAL PIN 8 - SENSOR MODULE S5

And connections for motor driver is shown in above figure.

Step 4: ARDUINO PROGRAMMING:

Upload the given code to your Arduino Uno board and get ready for the ACTION !

#define lmotorf 4 //Motor A1
#define lmotorb 5 //Motor A2 #define rmotorf 6 //Motor B1 #define rmotorb 7 //Motor B2

//HIGH white //LOW black

void setup() { pinMode(lmotorf,OUTPUT); pinMode(rmotorf,OUTPUT); pinMode(lmotorb,OUTPUT); pinMode(rmotorb,OUTPUT); pinMode(8,INPUT); pinMode(9,INPUT); pinMode(10,INPUT); pinMode(11,INPUT); pinMode(12,INPUT); pinMode(13,INPUT); }

void loop() {

int sensor1=digitalRead(8);//sensor1 int sensor2=digitalRead(9);//sensor2 int sensor3=digitalRead(10);//sensor3 int sensor4=digitalRead(11);//sensor4 int sensor5=digitalRead(12);//sensor5

if((sensor2==LOW)&&(sensor3==LOW)&&(sensor4==LOW)) //When ALL ARE on WHITE line {

digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor2==HIGH)&&(sensor3==LOW)&&(sensor4==HIGH))

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor2==LOW)&&(sensor3==HIGH)&&(sensor4==LOW))

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor1==HIGH)&&(sensor5==LOW)&&(sensor2==LOW)&&(sensor3==HIGH)&&(sensor4==LOW))//1 LEFT

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,LOW); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); }

else if((sensor1==LOW)&&(sensor5==HIGH)&&(sensor2==LOW)&&(sensor3==HIGH)&&(sensor4==HIGH))//1 LEFT

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,LOW); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor1==HIGH)&&(sensor5==LOW)&&(sensor2==LOW)&&(sensor3==LOW)&&(sensor4==LOW))//1 LEFT

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,LOW); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); }

else if((sensor1==LOW)&&(sensor5==HIGH)&&(sensor2==HIGH)&&(sensor3==HIGH)&&(sensor4==HIGH))//NULL

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,LOW); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor2==LOW)&&(sensor3==LOW)&&(sensor4==HIGH))//1 LEFT

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,LOW); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor2==LOW)&&(sensor3==HIGH)&&(sensor4==HIGH))//1 LEFT

{ digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,LOW); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); }

else if((sensor2==HIGH)&&(sensor3==LOW)&&(sensor4==LOW))//FOR RIGHT

{ digitalWrite(lmotorf,LOW); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); }

else if((sensor2==HIGH)&&(sensor3==HIGH)&&(sensor4==LOW))//FOR RIGHT

{ digitalWrite(lmotorf,LOW); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor1==HIGH)&&(sensor5==LOW)&&(sensor2==HIGH)&&(sensor3==HIGH)&&(sensor4==HIGH))//1 LEFT { digitalWrite(lmotorf,LOW); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor1==HIGH)&&(sensor5==LOW)&&(sensor2==HIGH)&&(sensor3==HIGH)&&(sensor4==LOW))//1 LEFT { digitalWrite(lmotorf,LOW); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); }

else if((sensor1==LOW)&&(sensor5==HIGH)&&(sensor2==LOW)&&(sensor3==HIGH)&&(sensor4==LOW)) { digitalWrite(lmotorf,LOW); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else if((sensor1==HIGH)&&(sensor5==LOW)&&(sensor2==HIGH)&&(sensor3==HIGH)&&(sensor4==HIGH)) { digitalWrite(lmotorf,LOW); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); }

else if((sensor2==HIGH)&&(sensor3==HIGH)&&(sensor4==HIGH))//FOR RIGHT { digitalWrite(lmotorf,HIGH); digitalWrite(rmotorf,HIGH); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); } else { digitalWrite(lmotorf,LOW); digitalWrite(rmotorf,LOW); digitalWrite(lmotorb,LOW); digitalWrite(rmotorb,LOW); }

}

I hope this was helpful !

All the best and Have fun :)

<p>https://www.instructables.com/id/Face-Detectionrecognition/</p>
<p>and also your coding logic ........</p>
Nice Project!<br><br>can u pls give the Indian shopping link to the ir sensor?Or from where did u buy it?
thanks hrithikbansal70 <br>u can get the 5 channel ir sensor module from :<br>http://www.ebay.com/itm/Five-5-Channel-Tracking-Sensor-Module-Board-Trace-Module-Infrared-Detection-New-/272109624665<br><br>all the best :)<br>
Hi.1.my motor driver (l298n) have ENA and ENB pins.where will i connect them? 2.i have same ir sensor set : clp and near sensors are empty in yours too is it correct? 3. I understoog that in your program ina, inb,inc,ind pins connected to arduino digital 4,5,6,7 is it true? Thank u.
4,5,6,7 is for motors
Ena nd enb pins for speed control but in this project there is no need of them so u can short it wid +5v <br>2.all the connection nd code are perfect don't worry about it <br>thnks
i made it.this is the only five sensor car in the internet..thanx
Hi.1.my motor driver (l298n) have ENA and ENB pins.where will i connect them? 2.i have same ir sensor set : clp and near sensors are empty in yours too is it correct? 3. I understoog that in your program ina, inb,inc,ind pins connected to arduino digital 4,5,6,7 is it true? Thank u.
<p>thank you</p>
<p>cool design and idea nd thnxs for ur code its awesome</p>

About This Instructable

1,640views

18favorites

More by aishwarya.arora.35:Arduino Based Line Tracker Robot  
Add instructable to: