Your cart is currently empty!
Line Tracking Robot Using Arduino In Proteus
Line Tracking Robot Using Arduino In Proteus
In this article we will learn how to make Line Tracking Robot Using Arduino in Proteus.
In the last post we will learn how to make Forward and Backward Dc Motor Circuit using Arduino and LCD in proteus. You can visit our website,
I hope you appreciate my work, let’s discuss about today’s project.
Components:
- Arduino nano
- IC (L293D)
- DC motor
- IR sensors (4)
- Jumper wires
Circuit Diagram…
Construction…
- Connect VSS & VS pins of IC with +ve
- Connect GND pin of IC with GND
- Connect OUT1 pin of IC with one side of DC motor 1st
- Connect OUT2 pin of IC with 2nd terminal of 1st DC motor
- Connect OUT3 pin of IC with 1st side of 2nd DC motor
- Connect OUT4 pin of IC with 2nd side of 2nd DC motor
- Connect IN2 pin of IC with D13 pin of Arduino
- Connect IN4 pin of IC with D12 pin of Arduino
- Connect IN3 pin of IC with D11 pin of Arduino
- Connect pin 1 of IC with D9 pin of Arduino
- Connect pin 2 of IC with D10 pin of Arduino
- Connect pin 3 of IC with D8 pin of Arduino
- Connect the VCC pins of All IR sensors with +ve
- Connect the OUT pins of All IR sensors with GND
- Connect GND of 1st IR sensor with A0 pin of Arduino
- Connect GND of 2nd IR sensor with A1 pin of Arduino
- Connect GND of 3rd IR sensor with A2 pin of Arduino
- Connect GND of 4th IR sensor with A3 pin of Arduino
- Connect GND of 5th IR sensor with A4 pin of Arduino
Hardware Image…
Working…
A line tracking robot is a type of mobile robot designed to follow a specific path or track, typically a black line on a contrasting white surface. This is achieved by using sensors to detect the line and making adjustments to the robot’s motors to keep it on track. You can build a line tracking robot using an Arduino microcontroller and a few other components. Here’s a basic overview of how it works:
Applications…
- Educational Projects
- Automated Guided Vehicles
- Agriculture
- Traffic Management
- Automatic Robot Car
Advantages…
- Ease of Programming
- Affordability
- Community Support
- Educational Value
- Real-World Applications
Program Code Images…
Program code…
#define m1 9 //Right Motor MA1
#define m2 10 //Right Motor MA2
#define m3 11 //Left Motor MB1
#define m4 12 //Left Motor MB2
#define e1 13 //Right Motor Enable Pin EA
#define e2 8 //Left Motor Enable Pin EB
//*********5 Channel IR Sensor Connection*********//
#define ir1 A0
#define ir2 A1
#define ir3 A2
#define ir4 A3
#define ir5 A4
//*************************************************//
void setup() {
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);
pinMode(m3, OUTPUT);
pinMode(m4, OUTPUT);
pinMode(e1, OUTPUT);
pinMode(e2, OUTPUT);
pinMode(ir1, INPUT);
pinMode(ir2, INPUT);
pinMode(ir3, INPUT);
pinMode(ir4, INPUT);
pinMode(ir5, INPUT);
}
void loop() {
//Reading Sensor Values
int s1 = digitalRead(ir1); //Left Most Sensor
int s2 = digitalRead(ir2); //Left Sensor
int s3 = digitalRead(ir3); //Middle Sensor
int s4 = digitalRead(ir4); //Right Sensor
int s5 = digitalRead(ir5); //Right Most Sensor
//if only middle sensor detects black line
if((s1 == 1) && (s2 == 1) && (s3 == 0) && (s4 == 1) && (s5 == 1))
{
//going forward with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, HIGH);
digitalWrite(m2, LOW);
digitalWrite(m3, HIGH);
digitalWrite(m4, LOW);
}
//if only left sensor detects black line
if((s1 == 1) && (s2 == 0) && (s3 == 1) && (s4 == 1) && (s5 == 1))
{
//going right with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, HIGH);
digitalWrite(m2, LOW);
digitalWrite(m3, LOW);
digitalWrite(m4, LOW);
}
//if only left most sensor detects black line
if((s1 == 0) && (s2 == 1) && (s3 == 1) && (s4 == 1) && (s5 == 1))
{
//going right with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, HIGH);
digitalWrite(m2, LOW);
digitalWrite(m3, LOW);
digitalWrite(m4, HIGH);
}
//if only right sensor detects black line
if((s1 == 1) && (s2 == 1) && (s3 == 1) && (s4 == 0) && (s5 == 1))
{
//going left with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, LOW);
digitalWrite(m2, LOW);
digitalWrite(m3, HIGH);
digitalWrite(m4, LOW);
}
//if only right most sensor detects black line
if((s1 == 1) && (s2 == 1) && (s3 == 1) && (s4 == 1) && (s5 == 0))
{
//going left with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, LOW);
digitalWrite(m2, HIGH);
digitalWrite(m3, HIGH);
digitalWrite(m4, LOW);
}
//if middle and right sensor detects black line
if((s1 == 1) && (s2 == 1) && (s3 == 0) && (s4 == 0) && (s5 == 1))
{
//going left with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, LOW);
digitalWrite(m2, LOW);
digitalWrite(m3, HIGH);
digitalWrite(m4, LOW);
}
//if middle and left sensor detects black line
if((s1 == 1) && (s2 == 0) && (s3 == 0) && (s4 == 1) && (s5 == 1))
{
//going right with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, HIGH);
digitalWrite(m2, LOW);
digitalWrite(m3, LOW);
digitalWrite(m4, LOW);
}
//if middle, left and left most sensor detects black line
if((s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 1) && (s5 == 1))
{
//going right with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, HIGH);
digitalWrite(m2, LOW);
digitalWrite(m3, LOW);
digitalWrite(m4, LOW);
}
//if middle, right and right most sensor detects black line
if((s1 == 1) && (s2 == 1) && (s3 == 0) && (s4 == 0) && (s5 == 0))
{
//going left with full speed
analogWrite(e1, 255); //you can adjust the speed of the motors from 0-255
analogWrite(e2, 255); //you can adjust the speed of the motors from 0-255
digitalWrite(m1, LOW);
digitalWrite(m2, LOW);
digitalWrite(m3, HIGH);
digitalWrite(m4, LOW);
}
//if all sensors are on a black line
if((s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 0) && (s5 == 0))
{
//stop
digitalWrite(m1, LOW);
digitalWrite(m2, LOW);
digitalWrite(m3, LOW);
digitalWrite(m4, LOW);
}
}