IOT

Building an easy Line Follower Robot using Arduino Uno

A Robot is any machine that is totally automated, that is, it starts on its own, determines how to operate on its own, and stops on its own. It is a human-like duplicate that was created to alleviate human suffering. It can be operated pneumatically, hydraulically, or with simple electrical controls. Unimates, created by George Devol and Joe Engelberger in the late 1950s and early 1960s, was the first industrial robot.

A Line Following Robot – IR Sensor Based Line Follower is an introductory electronic device specifically to assist kids or electronic enthusiasts. And also novices study basic electronic basics knowledge of electronic components and cultivate their interest in programming toys. This is designed to support the principle of infrared with Automatic Line Patrol Technology. This Arduino robot kit will teach you ways to drive your Arduino robot car, the way to have it follow lines, the way to control it remotely

The line follower robot, as the name implies, is an autonomous vehicle that follows a visual line implanted on the surface. This visual line represents the path that the line follower robot will take. In general, it utilises a black line on a white background, but you may change it to a white line on a black background.

Working of Line Follower Robot:

Working as a line follower is a fascinating job. Line follower robot detects a black line using a sensor and delivers the signal to an Arduino. The Arduino then runs the motor based on the output of the sensors.

One of the self-operating robots is the line following robot. This detects and follows a line drawn on the surface of the region. A white line on a black surface or a black line on a white surface indicates the line. The line must detect this system. In this case, we’re employing two sensors to identify paths. That is a proximity sensor and an infrared sensor. The proximity sensor is utilized for path detection, while the infrared sensor is used for obstacle detection.

We employ IR transmitters and receivers in this line follower robot (photodiodes). The infrared transmitter constantly generates an infrared signal, which is reflected back by an obstacle and received by the infrared receiver and output as an analogue value. When IR rays strike a white surface, they are reflected back to the IR receiver, causing voltage changes. When IR rays strike a black surface, they are absorbed by the surface and no rays are reflected; hence, the IR receiver receives no rays. These sensors are located at the robot’s front end. The microcontroller is a highly sophisticated component that controls the whole circuit.

When the IR sensor detects a white surface, an Arduino receives 1 (HIGH) as input, and when it detects a black line, an Arduino receives 0 (LOW) as input. An Arduino Uno generates the appropriate output to operate the bot based on these inputs.

Components Used:

  • Arduino Uno
  • IR Sensor
  • L293D Motor driver
  • BO motors
  • Wheels
  • Lithium-Ion battery
  • Jumper Cables
  • A robot chassis is required to mount all the above components on it.

Arduino Uno:

Arduino Uno is an open-source based on the Microchip ATmega328P developed by Arduino. cc.  It contains 14 digital I/O pins (six of which may be used as PWM outputs), six analogue inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power connector, an ICSP header, and a reset button. It comes with everything you need to support the microcontroller; simply connect it to a computer through USB or power it using an AC-to-DC converter or battery to get started.

L298N Motor Driver:

Motor drivers serve as the link between motors and control circuits. The control circuitry operates on low current, but the motor demands high current, hence the motor driver’s duty is to transform the low current control impulses into high current signals. The L298N motor driver, which is a low current driver, is employed in this project. 

This L298N Motor Driver module is a high-power motor driver. It’s used to power DC and stepper motors. In an integrated circuit, this motor driver comprises an L298N motor driver IC and a 78M05 5V voltage regulator, resistors, capacitor, power LED, and a 5V jumper.

Infrared Sensor:

An IR sensor is an electronic sensor that measures and detects the infra-red light radiating from an object or its environment. These lights are not visible by naked eyes but can be seen through a camera. That hen light falls on the IR sensor, the photodiode response in terms of change in resistance. This change in resistance is measured in terms of voltage. This module can be connected directly to a microcontroller, Arduino, or Raspberry Pi.

An infrared source, a transmission channel, an optical component, infrared detectors, and signal processing are the five fundamental parts of an infrared detection system. Infrared transmission is possible through vacuum, atmosphere, and optical fibres. Refer to the page, Working Principle of an IR Sensor, to learn more about the IR sensor.

BO Motors:

BO Motor stands for Battery Operated Motor. These motors are widely employed in hobby-grade applications when a tiny DC motor is required as a basic actuator.

At lower working voltages, the BO series linear motor produces adequate torque and rpm. BO motors are offered in single shaft, dual shaft, and DC Plastic Gear BO configurations. These motors use a little amount of power. We utilized four single shaft BO motors in this build.

.

It has a 3-12V working voltage and is ideal for creating tiny and medium robots. The motor is perfect for do-it-yourselfers. This motor set is low-cost, compact, and simple to install, making it suitable for use in a mobile robot automobile. 

Lithium-ion Battery:

A lithium-ion battery, often known as a Li-ion battery, is a form of rechargeable battery in which lithium ions travel from the negative electrode to the positive electrode via an electrolyte during discharge and back again during charging.

Many goods employ lithium-ion (Li-ion) batteries, including electronics, toys, wireless headphones, portable power tools, small and big appliances, electric cars, and electrical energy storage systems. They can threaten human health or the environment if they are not properly maintained at the end of their useful life.

Connection Diagram:

We utilised four BO motors in this case. Motors 1 and 2 are linked to the L298N’s first channel, while motors 3 and 4 are connected to the motor driver’s second channel.

IN1, IN2, IN3, and IN4 pins are linked to Arduino Uno pins 9, 6, 5, 3. In this case, we placed a jumper between +5V and enabled pins (EN1 &EN2). You may remove it and link it to the outside world as seen in the image below.

Software & Programming Code:

Download the Arduino IDE Software and upload the code into your board.



int 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);

}

Applications of line follower robot:

  • Industrial Applications: These robots can be utilised in industries to replace traditional conveyer belts as automated equipment transporters.
  • Automobile applications: These robots can also be utilised as self-driving vehicles on roadways equipped with imbedded magnets.
  • Domestic applications: hese may also be used in the home for household tasks like as floor cleaning.
  • Guidance applications: These can be used to offer path guidance in public venues such as shopping malls and museums.

Advantages:

  • Robot movement is automatic
  • It is used for long distance applications
  • Simplicity of building
  • Fit and forget system
  • Used in home, industrial automations etc.

Leave a Reply

Your email address will not be published.