IR Infrared Obstacle Avoidance Sensor Module with Arduino

How to use obstacle detecter IR sensor with Arduino

Here we demonstrate how to use IR Infrared Obstacle Avoidance Sensor Module with Arduino. IR Infrared Obstacle Avoidance Sensor Module can be used for building robot eye or for building alarm trigger. When any obstacle is detected in certain range the sensor will send a low output. And we can write program to act accordingly.

Such IR module consist mainly of infrared transmitter, infrared detector, and supporting circuit.  It has 3 pins the sensor output, the power supply pin and the ground pin. Such IR Infrared Obstacle Avoidance Sensor Module is shown below.

IR Infrared Obstacle Avoidance Sensor Module with Arduino

Circuit Connection for IR Infrared Obstacle Avoidance Sensor Module with Arduino

The connection diagram is shown below. The IR sensor module has three pins- signal pin, 5V pin and ground pin. Connect the signal pin to the 4th digital pin, the 5V pin to the +5V power supply of the Arduino and ground pin to the Arduino ground.

IR Infrared Obstacle Avoidance Sensor Module with Arduino

Programming IR Infrared Obstacle Avoidance Sensor Module with Arduino

The Arduino program code to detect obstacles using IR sensor module is below.

In the progtram code above, we have used the serial communication mode to transfer the signal detected by the IR sensor. To enable the serial communication we have declared the Serial.begin() function with baud rate of 9600. Also to turn on LED at pin 13 when something is detected we declared the pin 13 as output. Note that this LED is on the Arduino board and the LED will be turned on there. If you want to use external LED you can do this. See How to turn ON OFF a LED with LDR and Arduino tutorial as an example.

In the main loop, we have used the function digitalRead() to read any signal coming from the IR sensor module. This read value is saved in variable called dect. Then using the if else statements we have sent message to the PC via the serial communication. So if there is any obstacle detected by the infrared module, it will send LOW signal to Arduino. Arduino will then send to PC this detection and using Arduino IDE we display the message Alram! on the serial monitor. Otherwise the the message is Clear!.

Video demonstration of IR Infrared Obstacle Avoidance Sensor Module with Arduino

Now the following video demonstrates how the IR sensor works.

So in this way you can use or check IR Infrared Obstacle Avoidance Sensor Module with Arduino. See also other arduino tutorials, for example, Real-Time data acquisition from Arduino to Matlab.

If you liked this tutorial, share it. Also don’t forget to subscribe to our blog.

Leave a Reply

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