Infrared Obstacle Avoidance Sensor Module
This Infrared Obstacle Avoidance Sensors Module has a built-in IR transmitter 5mmLED and IR receiver 5mmLED that sends out IR waves and then looks for the reflected IR waves to detect the presence of any objects in front of the sensor module. The module has an on board potentiometer that let users adjust the detection range. This sensor can be used in light and complete darkness.
Infrared Obstacle Avoidance Sensors Module Features
- There is an obstacle, the green indicator light on the circuit board
- Detection distance: 2 ~ 30cm
- Detection angle: 35 °
- Comparator chip: LM393
- 3mm screw holes for easy mounting
- 35x15x14mm
Arduino code
EXAMPLE CODE: // IR Collision Detection Module // Henry's Bench int LED = 13; // Use the onboard Uno LED int isObstaclePin = 7; // This is our input pin int isObstacle = HIGH; // HIGH MEANS NO Object In Front Of Sensor void setup() { pinMode(LED, OUTPUT); pinMode(isObstaclePin, INPUT); Serial.begin(9600); } void loop() { isObstacle = digitalRead(isObstaclePin); if (isObstacle == LOW) { Serial.println("OBSTACLE!!, DETECTED!!"); digitalWrite(LED, HIGH); } else { Serial.println("clear"); digitalWrite(LED, LOW); } delay(200); }