Line Follower Robot with Arduino and IR Sensors

Line follower robot is easy to make. creative and simplest robot in Embedded system.A robot which walks without any instructions. it gets instructions by itself from the Sensor. we are using Infrared sensors which act like our sense organs. The IR sensors, sense the colour. IR sensor gives a different value for both colours. So we calibrate the sensors value and input it into the Arduino with some conditions. In this tutorial, you will learn this line follower robot with Arduino and IR sensors. Arduino is the simplest and easy to use a microcontroller. Arduino Based Line follower Robot can make easily.

Line Follower Robot with Arduino and IR Sensors

 Line follower robot with Arduino can learn you many topics in Embedded and robotics. Uses of Input and output in Arduino microcontroller. How to configure and how to send and receive data from an input device or sensors. Arduino based Line follower robot having Motors chassis. Motor driver and many other things. here you can learn all these things in this full tutorial. so read the full article. we have more article on the same Arduino projects like a self-balancing robot
You need All these component to make this awesome IR robot


  • Components Required to Make Line Follower Robot 
  1. IR sensors


IR sensor is the most commonly used sensors in line follower robot and other projects in embedded. for colour detection, object detection, and many others. IR sensors having two Diode in which one transmits the Infrared rays and other is receiving the signal. the received signal based on the reflecting surface. a dark colour cannot reflect back the colour to the receiver but the light colour reflects back the signal to the receiver. this is the principle of working of line follower robot.
  1. Geared DC motors
DC motors with gears having more torque and accurate speed. it comes with different RPM.
Arduino board is easy to use and the simplest microcontroller which has  ADC inbuilt. you can learn Arduino from Arduino Tutorial
Chassis is the base of the robot on which we attach all the components. motors sensors etc.
They use only for connection purpose
   5.Motor Driver
  • Circuit Diagram For Line Follower Robot with Arduino/ Arduino line follower diagram
Circuit Diagram For Line Follower Robot with Arduino
In this circuit diagram, you can clearly see all the connection. if you can’t understand the connection you can read the next step by step connections. 
  1. Connect Arduino PIN 2 with IR sensor 1 Output Signal pin 
  2. Connect Arduino PIN 3 with IR sensor 2 Output Signal pin 
  3. Connect Arduino PIN 4 with motor driver IN1 pin
  4. Connect Arduino PIN 5 with motor driver IN2 pin
  5. Connect Arduino PIN 6 with motor driver IN3 pin
  6. Connect Arduino PIN 7 with motor driver IN4 pin
  7. Connect  motor driver Output 1 pins with Motor 1
  8. Connect  motor driver Output 2 pins with Motor 2
  • C Code for Arduino line follower /Line Follower Robot with Arduino code
void setup() {
  // put your setup code here, to run once:
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);


void loop() {

  int m= digitalRead(2); //sensor 1
  int n= digitalRead(3); //sensor 2 
  if (m==HIGH)

    digitalWrite(4, HIGH);   //motor 2
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);   //motor 2
    digitalWrite(7, HIGH);

    else if
      digitalWrite(6, HIGH);   //motor 1
    digitalWrite(7, LOW);
    digitalWrite(4, LOW);   //motor 2
    digitalWrite(5, HIGH);

        digitalWrite(4, HIGH);   //motor1
    digitalWrite(5, LOW);
    digitalWrite(4, HIGH);   //motor 2
    digitalWrite(5, LOW);
  // put your main code here, to run repeatedly:

copy this code into your Arduino IDE and Upload it into Arduino. 
Note:- sensor 1 should near the motor 1 & sensor 2 should  near the motor 2 on the chassis 

2 thoughts on “Line Follower Robot with Arduino and IR Sensors

  • June 9, 2019 at 9:08 am

    It’s not my first time to go to see this web page, i am visiting this website
    dailly and obtain good data from here everyday.

    • June 9, 2019 at 10:56 am

      thanks a lot for your valuable comment


Leave a Reply

Your email address will not be published. Required fields are marked *