A Line Follower Robot, as the name suggests, is an automated guided vehicle, which follow a visual line embedded on the floor or ceiling. Usually, the visual line is the path in which the line follower robot goes and it will be a black line on a white surface but the other way (white line on a black surface) is also possible. Certain advanced Line Follower Robots use invisible magnetic field as their paths.
Working of Line Follower Robot
The concept of the line follower robot is related to light. Here, we use the behaviour of light on the black and white surface. The white colour reflects all the light that falls on it, whereas the black colour absorbs the light.
In this line follower robot, we use IR transmitters and receivers (photodiodes). They are used to send and receive the lights. When IR rays fall on a white surface, it is reflected towards IR receiver, generating some voltage changes.
When IR rays fall on a black surface, it is absorbed by the black surface, and no rays are reflected; thus, the IR receiver doesn’t receive any rays.
Components Used
· Arduino Uno
· IR sensor
· L293D motor driver
· BO motor
· Wheels
· Lithium-ion battery
· Jumper cables
Arduino UnoArduino Uno is an 8-bit ATmega328P microcontroller. To support the microcontroller, it uses the components such as crystal oscillator, serial communication, voltage regulator, etc. It has 14 digital I/O pins( 6 pins can be used as PWM pins). It has six separate analog input pins, a USB connection, a Power barrel jack, an ICSP header, and a reset button.
This board is programmable with the Arduino IDE (Integrated Development Environment) platform via a type B USB cable. This board can be powered by a USB cable or an external voltage between 7 to 20 volts
Infrared SensorAn infrared sensor emits the light to detect some surroundings. In the infrared spectrum, all the objects radiate some form of thermal radiation that is invisible to our eyes, but an IR sensor can detect these radiations.
Here, IR LED is an emitter, and the IR photodiode is a detector. An IR LED emits the IR light, and the photodiode is sensitive to this IR light. When IR light falls on the photodiode, the output voltages and the resistances will change in proportion to the magnitude of the received IR light
L298N Motor DriverL298N is one of the easiest and chipset way to control DC motors. It is the two-channel motor driver that can control the speed and spinning direction of DC motors.
This L298N Motor Driver is a high-power motor driver module. It is used for driving DC and Stepper Motors. This motor driver consists of an L298N motor driver IC and a 78M05 5V voltage regulator, resistors, capacitor, power LED, 5V jumper in an integrated circuit.
BO MotorsBO Motor is known as Battery Operated motor. These motors are commonly used in hobby-grade projects where the user requires a small DC motor as a simple actuator
BO series linear motor provides good torque and rpm at lower operating voltages. The BO motors are available in single Shaft, Dual Shaft, and DC Plastic Gear BO. These motors consume low current. In this project, we have used four single shaft BO motors.
Circuit DiagramHere, we have used four BO motors. Motors 1 & 2 are connected to the first channel of L298N, whereas motors 3 & 4 are connected to the second channel of the motor driver.
IN1, IN2, IN3, and IN4 pins are connected to pin 9, 6, 5, 3 of Arduino Uno. Here, we have used the jumper between +5V and enables pins (EN1 &EN2). You can remove it and make the external connection, as shown in the image.
NextpcbThis article is sponsored by nextpcb.com
Nextpcb are also sponsor of this project. Nextpcb, is the one of the largest PCB prototype enterprise in China and a high-tech manufacturer specializing in quick PCB prototype and small-batch PCB production. You can order a minimum of 5 PCBs for just $0 it mean 1st order is free for makers. To get the PCB manufactured simply login Nextpcb.com upload the.zip of the gerber files or you can also drag and drop the.zip files. After uploading the zip file, you’ll see success message at the bottom if the file is successfully uploaded.
Programming Codeint mot1=9;
int mot2=6;
int mot3=5;
int mot4=3;
int left=13;
int right=12;
int Left=0;
int Right=0;
void LEFT (void);
void RIGHT (void);
void STOP (void);
void setup()
{
pinMode(mot1,OUTPUT);
pinMode(mot2,OUTPUT);
pinMode(mot3,OUTPUT);
pinMode(mot4,OUTPUT);
pinMode(left,INPUT);
pinMode(right,INPUT);
digitalWrite(left,HIGH);
digitalWrite(right,HIGH);
}
void loop()
{
analogWrite(mot1,255);
analogWrite(mot2,0);
analogWrite(mot3,255);
analogWrite(mot4,0);
while(1)
{
Left=digitalRead(left);
Right=digitalRead(right);
if((Left==0 && Right==1)==1)
LEFT();
else if((Right==0 && Left==1)==1)
RIGHT();
}
}
void LEFT (void)
{
analogWrite(mot3,0);
analogWrite(mot4,30);
while(Left==0)
{
Left=digitalRead(left);
Right=digitalRead(right);
if(Right==0)
{
int lprev=Left;
int rprev=Right;
STOP();
while(((lprev==Left)&&(rprev==Right))==1)
{
Left=digitalRead(left);
Right=digitalRead(right);
}
}
analogWrite(mot1,255);
analogWrite(mot2,0);
}
analogWrite(mot3,255);
analogWrite(mot4,0);
}
void RIGHT (void)
{
analogWrite(mot1,0);
analogWrite(mot2,30);
while(Right==0)
{
Left=digitalRead(left);
Right=digitalRead(right);
if(Left==0)
{
int lprev=Left;
int rprev=Right;
STOP();
while(((lprev==Left)&&(rprev==Right))==1)
{
Left=digitalRead(left);
Right=digitalRead(right);
}
}
analogWrite(mot3,255);
analogWrite(mot4,0);
}
analogWrite(mot1,255);
analogWrite(mot2,0);
}
void STOP (void)
{
analogWrite(mot1,0);
analogWrite(mot2,0);
analogWrite(mot3,0);
analogWrite(mot4,0);
}
Final OutputAfter uploading the code, if your bot is not running in the right direction, then change the wiring of BO motors. Also, calibrate both IR sensors by varying their potentiometer.
Below GIF shows the working of the line follower robot. Here, we have drawn the path on a white-coloured surface with black colour tape.
Comments