Objecet Avoider Bot using Arduino

Object avoider bot is an electronic machine which would run if no object detected other wise it is in off state. To make object avoider, you don’t required much knowledge just you need arduino programming skills and as well as few of electronic components like arduino, motor drive, proximity sensor and etc. Already, we have covered the object follower and line follower artciles if you have any confusion you must read it, you will get clear clarity on that.

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:

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==1 && r==1)
{
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
}
if(l==1 && r==0)
{
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
}
if(l==0 && r==1)
{
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}
if(l==0 && r==0)
{
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}
}

1 thought on “Objecet Avoider Bot using Arduino”

  • It is very good project. and also it is working properly. code also easy to understand. I expect more good projects from you. Thank you sir.

Leave a Reply

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