Basics

Sunday, 3 April 2016

SIMPLE LINE FOLLOWER ROBOT

Hello guys in this tutorial lets see how to make an simple line follower robot with single infra-red sensor. 

Usually for beginners in Robotics this is your first robot to play with Since this robot has some basic functions and basic programming learning this is like learning the A,B,C,D.... of Robotics.

  A line follower is an autonomous Robot which is able to follow a line (black or white) and alter its path based on the shape of the line.


COMPONENTS NEEDED:

  • Arduino UNO
  • one IR-sensor module
  • L293D motor driver
  • metal chassis
  • 2x BO motors
  • 1x caster wheel
  • 2x wheels
  • 2x 9v battery
  • 2x dc battery connectors
  • connecting wires
   The chassis is the body of this Robot, Arduino is the brain of this robot and two dc motors produce motion.


HOW IT WORKS?!


This is a simplest bot with a single sensor so its working principle is also as simple as follows..

  1.    when the IR sensor sees the black line one wheel of the bot rotates and the bot turns away from the line.
  2.   when the IR sensors sees the white background the other wheel rotates and the bot turns slightly towards the line.

           The above two steps occurs one after other in a repeat mode very fastly in a very short time which gives us the movement of the bot in the path following the black line.

    It just follows the Z pattern turning towards the line and turning away from the line.

LETS MAKE THE ROBOT:


STEP 1:

 Fix the wheels on the metal chassis and mount the Dc BO motors on the back wheels and fix a caster wheel in the front.
connect the L293D motor driver with the arduino and dc motors.

CONNECTIONS:

3,6(l293d) to left motor(output)
11,14(l293d) to right motor(output)

2,7,10,15(l293d) to pins 10,11,5,6 of Arduino(inputs)
Note: if the robot doesn't turn in the particular side of curves properly swap the motor pins connections and try it out.

STEP 2:


Connect your Arduino to your IR sensor.

  1. connect out pin of IR to pin 2 of Arduino
  2. connect vcc of IR to 5v of Arduino
  3. connect gnd of IR to gnd pin of Arduino.

STEP 3:

The programming part....

 Interface your arduino with arduino IDE software and upload the below program.





int lmotorpin1=5;

int lmotorpin2=6;
int rmotorpin1=10;
int rmotorpin2=11;
int sensor=2;
int sensorstate=0;

void setup(){
  pinMode(sensor,INPUT);
  pinMode(lmotorpin1,OUTPUT);
  pinMode(lmotorpin2,OUTPUT);
  pinMode(rmotorpin1,OUTPUT);
  pinMode(rmotorpin2,OUTPUT);
}

void loop(){
  sensorstate=digitalRead(sensor);
  if(sensorstate==HIGH){
    digitalWrite(lmotorpin1,HIGH);
    digitalWrite(lmotorpin2,LOW);
    digitalWrite(rmotorpin1,LOW);
    digitalWrite(rmotorpin2,LOW);
  }
  else{
    digitalWrite(rmotorpin1,LOW);
    digitalWrite(rmotorpin2,HIGH);
    digitalWrite(lmotorpin1,LOW);
    digitalWrite(lmotorpin2,LOW);
  }
}


DOWNLOAD PROGRAM:click here

STEP 4:

connect the power supply to your Arduino and motor driver....

YOUR BOT IS READY TO RACE.......

1 comment:

  1. hey 9V battery part is not clear to me. how to connect the two batteries to the final circuitry

    ReplyDelete