Skip to main content

Line Follower Robot Using Arduino

                                         



Line follower Robot is a machine which follows a line, either a black line or white line. Basically there are two types of line follower robots: one is black line follower which follows black line and second is white line follower which follows white line. Line follower actually senses the line and run over it.


Concepts of Line Follower

Concept of working of line follower is related to light. We use here the behavior of light at black and white surface. When light fall on a white surface it is almost full reflected and in case of black surface light is completely absorbed. This behavior of light is used in building a line follower robot.

Concept of Black Line Follower Robot
In this arduino based line follower robot we have used IR Transmitters and IR receivers also called photo diodes. They are used for sending and receiving light. IR transmits infrared lights. When infrared rays falls on white surface, it’s reflected back and cached by photo diodes which generates some voltage changes and gives the output of value greater than 400. When IR light falls on a black surface, light is absorb by the black surface and no rays are reflected back, thus photo diode does not receive any light or rays and will give output value less than 400.

Image result for ir sensor arduino connections

Connections for IR sensor 1 :-


Arduino                                                                                         Ir sensor 1

Pin 6                                         Vcc
Gnd                                           Gnd
O/P                                            A0


Connections for IR sensor 2 :-


Arduino                                                                                         Ir sensor 2

Pin 7                                         Vcc
Gnd                                           Gnd
O/P                                            A1




Connections for Motor Driver :-



Here in L293d motor driver at the top we have total 7 pins . 4 Pins are used for controlling the motor and 3 pins in the middle of the l293d module are used for powering the module.

Connect the arduino and L293d as follows:-

Arduino Pins:-                L293d Motor Driver
Pin 13                                   M1 a                           // for controlling motor 1
Pin 12                                   M1 b
Pin 11                                   M2 a                           // for controlling motor 2
Pin 10                                   M2 b

Vin                                        12v
Gnd                                       Gnd                                     // providing power to L293d module
5v                                          5v


Working of Line Follower Robot using Arduino

Code for Line follower robot:-




void setup() {
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH); 
}

void loop() {

  int sensorValue1 =analogRead(A0);
  int sensorValue2 =analogRead(A1);

  if(sensorValue1>400&&sensorValue2>400)
  {
    digitalWrite(13,HIGH);
    digitalWrite(12,LOW);
    digitalWrite(11,HIGH);
    digitalWrite(10,LOW);
    
  }
  else if(sensorValue1>400&&sensorValue2<400)
  {
    digitalWrite(13,HIGH);
    digitalWrite(12,HIGH);
    digitalWrite(11,HIGH);
    digitalWrite(10,LOW);
  }
  else if(sensorValue1<400&&sensorValue2>400)
  {
    digitalWrite(13,HIGH);
    digitalWrite(12,LOW);
    digitalWrite(11,HIGH);
    digitalWrite(10,HIGH);
  }
  
  // put your main code here, to run repeatedly:

}

Working:-


Condition 1 for forward move . both the motors will move clock wise direction so we have provided 

 if(sensorValue1>400&&sensorValue2>400)
  {
    digitalWrite(13,HIGH);
    digitalWrite(12,LOW);
    digitalWrite(11,HIGH);
    digitalWrite(10,LOW);
    
  }

as both the sensors will reflect light from the surface.
Working of Arduino Line Follower Robot
Condition 2 for right move . one of the motors (right side motor) will move clock wise direction and the other will be stopped(left side motor) so we have provided 

else if(sensorValue1>400&&sensorValue2<400)
  {
    digitalWrite(13,HIGH);
    digitalWrite(12,HIGH);
    digitalWrite(11,HIGH);
    digitalWrite(10,LOW);
  }

as both one of the the sensors will reflect light from the surface and other will not reflect light as it is on black line.
Turning left to line follower robot using arduino
Condition 3 for left move . one of the motors(left side motor) will move clock wise direction and the other will be stopped(right side motor) so we have provided 
 else if(sensorValue1<400&&sensorValue2>400)
  {
    digitalWrite(13,HIGH);
    digitalWrite(12,LOW);
    digitalWrite(11,HIGH);
    digitalWrite(10,HIGH);
  }



as both one of the the sensors will reflect light from the surface and other will not reflect light as it is on black line.
Turning right to line follower robot







Comments

Popular posts from this blog

Lock using 4 Push button switch with arduino

Introduction : A  combination lock  is a type of locking device in which a  sequence  of symbols, usually numbers, is used to open the lock. The sequence may be entered using a single rotating dial which interacts with several discs or  cams , by using a set of several rotating discs with inscribed symbols which directly interact with the locking mechanism, or through an electronic or mechanical keypad. Here we will be using arduino uno along with em lock to make door lock with password.  Code of the project :- const int buttonPin1 = 1; const int buttonPin4 = 4; const int buttonPin3 = 3; const int buttonPin2 = 2; // the pin that the pushbutton is attached to const int correctLedPin = 7;       // the pin that the LED is attached to const int wrongLedPin = 6;  const int motorPin = 11;// the pin that the LED is attached to // variables that are changed by the program int buttonPushCounter = 0;   // counter for the number of button presses int val = 0; int bS1 = 0;   

Voice Recording Module ISD1820 with Arduino

1 Introduction  Voice Record Module is base on ISD1820, which a multiple‐message record/playback device. It can offers true single‐chip voice recording, no‐volatile storage, and playback capability for 8 to 20 seconds. The sample is 3.2k and the total 20s for the Recorder. This module use is very easy which you could direct control by push button on board or by Microcontroller such as Arduino, STM32, ChipKit etc. Frome these, you can easy control record , playback and repeat and so on. 2 Feature  - Push‐button interface, playback can be edge or level activated - Automatic power‐dwon mode - On‐chip 8Ω speaker driver - Signal 3V Power Supply - Can be controlled both manually or by MCU - Sample rate and duration changable by replacing a single resistor - Record up to 20 seconds of audio - Dimensions: 37 x 54 mm If you want change record duration, an external resistor is necessary to select the record duration and sampling frequency, which can range from 8 – 20 seconds

Home Automation Using Arduino (Relay Module)

Inroduction to Home Automation Home automation  or  domotics  is  building automation  for a home, called a  smart home  or  smart house . It involves the control and automation of lighting, heating (such as  smart thermostats ), ventilation, air conditioning ( HVAC ), and security, as well as  home appliances  such as washer/dryers, ovens or refrigerators/freezers.  Wi-Fi  is often used for remote monitoring and control. Home devices, when remotely monitored and controlled via the Internet, are an important constituent of the  Internet of Things . Modern systems generally consist of switches and sensors connected to a central hub sometimes called a "gateway" from which the system is controlled with a  user interface that is interacted either with a wall-mounted terminal, mobile phone software,  tablet computer  or a web interface, often but not always via Internet cloud services.                             Connection for Relay and arduino uno :- Wire the setup