Object Follower Bot using Arduino

Object follower is an electronic machine which follows the object. If any object found, it will follow other wise it won’t move. Like Line follower, object follower which works based on the light signals which are received and transmits by the proximity sensor. In the last article, we have given how to work line follower and now in the article, we will teach you how to follow the object.

Required Components:

  1. Arduino UNO
  2. Proximity (IR) Sensor -2
  3. BO- Motors -2
  4. L293D Motor Driver
  5. Power Supply
  6. Jumper Wires
  7. Chasis
  8. Caster Wheel
  9. Wheels -2

Circuit Diagram:

Program Code:

int ls =A0, rs=A1;
int in1=2, in2=3, in3=4, in4=5, ENA=9, ENB=10;
void setup() {
// put your setup code here, to run once:
pinMode(ls, INPUT);
pinMode(rs, INPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
Serial.begin(9600);

}

void loop() {
// put your main code here, to run repeatedly:
int l=digitalRead(ls);
int r=digitalRead(rs);
Serial.print(“left sensor:\t”);Serial.println(l);
Serial.print(“right sensor:\t”);Serial.println(r);
analogWrite(ENA, 200);
analogWrite(ENB, 200);
if(l==0 && r==0)
{
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
}
if(l==0 && r==1)
{
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
}
if(l==1 && r==0)
{
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}
if(l==1 && r==1)
{
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}
}

2 thoughts on “Object Follower Bot using Arduino”

Leave a Reply

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