So a few days ago, My ultrasound sensor stopped working and started giving 0s as output when I tried to use it.I did a lot of research to try and fix it(reducing voltage,new ping library etc) but to no avail(If any of you have an idea on how to resolve this,please put it in the comments below).
Undeterred,I decided to make an Obstacle Avoidance Bot using Infrared Proximity Sensors.They happen to be cheaper too(not by a large margin though) and I did have a few of them from my line follower bot.
The objective is simple-if the sensors encounter an obstacle they move back and turn left or right as the case may be.
So I will call the three sensors sL,sM and sR for left,middle and right respectively.
The connections are rather straight forward-
All the 3 IR sensors receive 3.3V from Arduino(I did not risk 5V although I am told there will be no problem) and are connected to the same GND pin.
sR is connected to A0
sL is connected to A2
sM is connected to A5
The right motor is connected to M1 of the motor shield and the left motor to M2.
Once this is all completed,the bot is good to go.
IMPORTANT-
The Infrared sensor as shown above has proved to be efficient in its task.However there is one extremely important point which I must address.Infrared proximity sensors are greatly affected by external light.In my code,the bot avoids obstacle if the sensor value is below 600.This value however changes based on external lighting in the place where you work and try the bot.I strongly recommend you to first run a Analog Read Serial code on your Arduino,determine the correct threshold and use it in your program.In fact this is one of the main disadvantages of using Infrared senors rather over Ultrasonic sensors. Please pay great care to this point.
.
Comments