How To Make Arduino Line Follower Robot?

How To Make Arduino Line Follower Robot?

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.

Large line follower robots are usually used in industries for assisting the automated production process. They are also used in military applications, human assistance purpose, delivery services etc.

Line follower Robot is one of the first robots that beginners and students would get their first robotic experience with. In this project, we have designed a simple Line Follower Robot using Arduino and some other components.

Arduino Line Follower Robot image.

Line Follower Robot

Line Follower Circuit Diagram.

Line Follower Robot Circuit

Required Components.

  • Auino UNO (or Arduino Nano) or Any Atmega328 microcintroller kit
  • L293D Motor Driver IC or shilled 
  • Geared Motors x 2 (BO)
  • Robot Chassis 
  • IR Sensor Module x 2
  • Black Tape (Electrical Insulation Tape)
  • Connecting Wires
  • Power supply (9V or 12V Battery)
  • Battery Connector
  • Battery Holder

Line Follower Source code.

// Author: Dharmendra Singh 
// Version: 
// Created: 5/11/2020 12:46:57 PM
// Purpose: hobby
// Processor: atmega328p
// File Created with  by Mikro Studio ©2013 

//IR SENSOR CONNECTIONS 
#define R_Sensor B,5  // D13   
#define L_Sensor B,4  // D12


//L293D CONNECTIONS 
#define IN1 B,1 //D9
#define IN2 D,6 //D6

#define IN3 D,5 //D5
#define IN4 D,3 //D3

#include "includes.h"
int Rig,Lef;
void HW_INI()
{
    MpinMode(IN1,OUTPUT);
    MpinMode(IN2,OUTPUT);
    MpinMode(IN3,OUTPUT);
    MpinMode(IN4,OUTPUT);
    
    MdigitalWrite(IN1,LOW);
    MdigitalWrite(IN2,LOW);
    MdigitalWrite(IN3,LOW);
    MdigitalWrite(IN4,LOW);
    
    MpinMode(R_Sensor,INPUT);
    MpinMode(L_Sensor,INPUT);
    MdigitalWrite(R_Sensor,HIGH);
    MdigitalWrite(L_Sensor,HIGH);
 // hear code for one time run or hw ini 
}

void SW_LOOP()
{
    Lef = MdigitalRead(L_Sensor);
    Rig = MdigitalRead(R_Sensor);
    if((Lef==LOW) && (Rig==HIGH))
    {
        MdigitalWrite(IN1,HIGH);
        MdigitalWrite(IN2,LOW);
        MdigitalWrite(IN3,LOW);
        MdigitalWrite(IN4,LOW);
    } 
    else if((Lef==HIGH) && (Rig==LOW))
    {
        MdigitalWrite(IN1,LOW);
        MdigitalWrite(IN2,LOW);
        MdigitalWrite(IN3,HIGH);
        MdigitalWrite(IN4,LOW);
    } 
    else if((Lef==HIGH) && (Rig==HIGH))
    {
        MdigitalWrite(IN1,HIGH);
        MdigitalWrite(IN2,LOW);
        MdigitalWrite(IN3,HIGH);
        MdigitalWrite(IN4,LOW);
    } 
    else
    {
        MdigitalWrite(IN1,LOW);
        MdigitalWrite(IN2,LOW);
        MdigitalWrite(IN3,LOW);
        MdigitalWrite(IN4,LOW);
    }
    Mdelay_ms(100);
 // hear code for your loop 
}

Download Line Follower Source code.

Admin
Author: Admin

Leave a Reply