Robotics

Line Follower Robot - Kits, Tutorials & Programming Code

Summary

We have all seen science fiction movies featuring robots and been fascinated by them. Whether they take the form of killer robots from outer space or nice-guy police bots, they are an important part of science-fiction. Soon enough, thanks to the advancement of technology, they have become a part of our lives. So, what exactly is a robot? A robot is any device, which automatically processes information and then gets a job done. Therefore, in essence, it replicates a human being, because humans can sense their environment, collect data, process it and then act on it. Such systems are capable of handling complex tasks and are hence, a great work to improve efficiency and take a load off your shoulders. Are you interested in building robots? If so, then this might be the article you are looking for. Here’s a look at how to build your own line follower robot and why you should pursue this.

Read more..


Isaac Asimov’s Law of Robotics

  1. Robots should not in any way harm a human being.
  2. All robots must obey a human’s order, as long as it does not violate the first law.
  3. All robots must protect their own existence, as long as it does not violate the first two laws.

Learn more about robotics


Latest projects on Robotics

Want to develop practical skills on Robotics? Checkout our latest projects and start learning for free


What is a Line Follower Robot?

Robots can be either fixed robots or mobile, with mobile ones having a movable base which allows them to move about freely. Line Follower Robot is a mobile bot which follows a particular line or path and chooses its motion based on its interaction with obstacles. The path here is usually a black line which is drawn on a white floor. Furthermore, magnetic lines may also be used to direct the trajectory of the robot.

Applications of Line Follower Robot

  1. Basic domestic uses and industrial uses
  2. Carry parcels from point A to point B
  3. Managing a crane system for moving things
  4. Carry passengers through small distances
  5. Transport materials in industrial areas
  6. Assist production and assembly automation

How to build Robotics projects Did you know

Skyfi Labs helps students develop skills in a hands-on manner through Robotics Online Courses where you learn by building real-world projects.

You can enrol with friends and receive kits at your doorstep.

You can learn from experts, build working projects, showcase skills to the world and grab the best jobs.
Start Learning Robotics today!


Which sensor is used in a line follower robot?

The working of a Line Follower robot is based on light and the detection of it. That is why we use a black line of a light-coloured surface. The basic principle here is that white surface fully reflects light, whereas dark surfaces absorb it. Therefore, Arduino Line Follower robots use IR transmitter-receiver pairs as their main sensors. This is so because they send and receive infrared lights with great efficiency. The photodiode measures the reflected light and generates a particular voltage as a result of it. Therefore, in such robots, a white surface gives a high input whereas a black surface provides a 0 or low input.

Discover more about Line Follower Robot

Why do you need to use IR sensors for the line follower robot?

An Arduino-powered Line Follower Robot has three main sections to it:

Sensor section:

  1. Consists of IR diodes, Op-Amp, potentiometer and LEDs.
  2. Potentiometer sets a reference voltage while the IR sensors provide a comparing voltage.
  3. The comparator compares both and generates an appropriate digital signal as the output.

Control Section:

  • An Arduino or microcontroller makes up the control section of the robot.
  • The outputs come into the Arduino through input pins.
  • The processor reads these inputs and then gives the appropriate commands

Driver section:

  1. Consists of motor drivers and DC motors.
  2. The Motor driver produces enough voltage and current to run the motor.
  3. Arduino output drives this motor driver which then drives the motors.

Therefore, the IR sensors are used to transmit and detect IR light rays. While working, two pairs are used on both sides. When both the left and right, the sensor pair sees a white area, they move forward. In case only one sensor detects black, they move towards that side. This occurs till the robot readjusts and both sensor pairs detect the white surface again. When both pairs pick up a black surface, the robot stops.

Line Follower Robot - Kits, Tutorials & Programming Code

We at Skyfi Labs have come up with an innovative solution to learn and build this Line Follower robot which comes along with the kit, video tutorials and programming code.

Line Follower Robot Circuit Components

  • 8051 Microcontroller
  • Development Board
  • (2) 10KΩ Resistors
  • 10µF Capacitor
  • 33pF Capacitors
  • Button
  • Motor driver -L298N
  • Robot Chassis
  • Motors
  • (2) IR Sensors

Designing a Line Following Robot

  1. The DC motors by virtue of the driver IC is connected to the controller. The controller puts out a maximum voltage of 5V. This cannot run motors, and hence you need to amplify this using a driver IC L298N. This produces outputs up to 36v and 3A.
  2. The Driver IC with 15 pins with the Driver Module is set to pins P2.0, 2.1, 2.2 and 2.3.
  3. IR sensors come in through Pins 2.6 and 2.7.
  4. The chassis along with the motors and wheels should now be connected to the microcontroller.
  5. To protect the IR transmitter use a 150Ω resistor in series while it is forward biased.
  6. The IR receiver in reverse bias should have a 10KΩ resistor between it and the VCC.
  7. The output for this comes between the resistor and an IR receiver.
  8. The analog output turns digital via a simple comparator IC such as LM358.

Line Following Robotic Programming

 

Code

#include<reg51.h>

sbit mot1=P2^0;

sbit mot2=P2^1;

sbit mot3=P2^2;

sbit mot4=P2^3;

sbit s_left=P2^6;

sbit s_right=P2^7;

void forward (void);

void backward (void);

void left (void);

void right (void);

void forward (void)

{

  mot1=0;

            mot2=1;

            mot3=1;

            mot4=0;

}

void backward (void)

{

  mot1=0;

            mot2=1;

            mot3=0;

            mot4=1;

}

void left (void)

{

  mot1=0;

            mot2=1;

            mot3=0;

            mot4=0;

}

void right (void)

{

  mot1=0;

            mot2=0;

            mot3=1;

            mot4=0;

}

void stop (void)

{

  mot1=0;

            mot2=0;

            mot3=0;

            mot4=0;

}

void main()

{

            s_left=1;

            s_right=1;

            while(1)

            {

             if(s_left==0 && s_right==0)

             {

                         forward();

             }

             else if(s_left==1 && s_right==1)

             {

                         stop();

             }

             else if(s_left==0 && s_right==1)

             {

                         left();

             }

             else if(s_left==1 && s_right==0)

             {

                         right();

             }

 }

}

Make the robot upload the code and watch it working. If you are facing any issues, let us know in the comment section.

Explore all robotics projects

Line Follower Robot - Kits, Tutorials & Programming Code
Skyfi Labs Last Updated: 2022-03-25





Join 250,000+ students from 36+ countries & develop practical skills by building projects

Get kits shipped in 24 hours. Build using online tutorials.

Subscribe to our blog

Stay up-to-date and build projects on latest technologies