IR Proximity Sensor
The IR Proximity Sensor has a distance range of 2 cm to 30 cm, and it is ideal for obstacle detection, line tracking, and more.
It is designed for easy setup and has onboard detection indication to verify its status. A preset knob allows you to fine-tune the distance range for more accurate readings.
This IR sensor is best for IoT projects, such as creating automatic sanitizer dispensers and home automation systems.
This infrared sensor is suitable for various applications in industrial, automotive, and consumer electronics settings. This sensor offers unbeatable value for money while ensuring optimal accuracy and efficiency in all your projects.
The detection range of the infrared proximity sensor can be adjusted by the potentiometer.
Read our blog on proximity sensor working principles.
Enjoy our free shipping on orders above Rs 500/- within India.
Features:
1. Easy to assemble and use
2. Onboard detection indication
3. The effective distance range of 2 cm to 30cm
4. A preset knob to fine-tune distance range
5. If there is an obstacle, the indicator lights on the circuit board.
Infrared Sensor Applications:
1. IP cameras
2. Alarm systems and other crime prevention devices
3. Battery-driven human presence sensors for IoT smart homes
4. IR sensors are also used in IR imaging devices, optical power meters, sorting devices, remote sensing, flame monitors, moisture analyzers, night vision devices, infrared astronomy, etc.
The IR proximity sensor circuit diagram consists of the following components:
LM358 IC
Resistors in the kilo-ohm range
2 pairs of IR transmitter and receiver
LED
Variable resistors
Wiring Guide
1. Connect the sensor’s VCC pin to the Arduino’s +5 V supply (or 3.3 V if your module supports it).
2. Connect the sensor’s GND pin to the Arduino’s ground (GND).
3. Connect the sensor’s OUT pin (digital output) to one of the Arduino digital input pins, e.g., D2.
4. Ensure the sensor has a common ground with the Arduino to avoid erratic behavior.
5. Optionally: adjust the onboard potentiometer to set the detection distance (typically 2‑30 cm).
Arduino Code Example – Basic Detection
const int sensorPin = 2; // sensor output pin
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
Serial.println("IR Obstacle Sensor Test");
}
void loop() {
int val = digitalRead(sensorPin);
if (val == LOW) {
Serial.println("Obstacle detected!");
}
else {
Serial.println("Clear");
}
delay(500);
}
Arduino Code Example – LED Indicator
const int sensorPin = 2;
const int ledPin = 13; // onboard LED on many Arduino boards
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int state = digitalRead(sensorPin);
if (state == LOW) {
digitalWrite(ledPin, HIGH);
Serial.println("Obstacle!");
} else {
digitalWrite(ledPin, LOW);
Serial.println("All clear");
}
delay(300);
}
Tips & Notes
1. The sensor output usually goes **LOW** when an obstacle is detected (and HIGH when clear) on typical modules.
2. Dark or non‑reflective surfaces may not trigger the sensor as reliably—aim for reflective surfaces for best results.
3. Adjust the onboard sensitivity potentiometer if detection is too close or too far.
4. Keep wiring short and solid to avoid noise; use shielded or twisted wires if needed in noisy environments.
5. If using the sensor in analog mode (if applicable), you may read the analog output via A0 and use thresholds in code instead of simple HIGH/LOW.
IR Proximity Sensor – Troubleshooting Tips
1. False Triggering: If the sensor triggers without any object present, check for reflective surfaces nearby. Highly reflective objects (mirrors, shiny metals) can cause false readings.
2. Sunlight Interference: Direct sunlight or strong IR sources may cause the sensor to behave erratically. Try shielding the sensor or repositioning it away from direct sunlight.
3. Wiring & Connections: Loose or long wires can introduce noise. Ensure solid, short connections between the sensor and Arduino, and use proper grounding.
4. Adjust Sensitivity: Many IR modules have a potentiometer to adjust detection distance. Turn it carefully to reduce false triggers.
5. Surface Color & Material: Dark or transparent objects may not reflect IR well. Test with different materials if detection seems inconsistent.
6. Environment Check: Avoid placing the sensor near other IR emitters (remote controls and heaters) that may interfere with readings.
7. Power Supply Stability: Ensure a stable 5 V supply. Voltage fluctuations can cause inconsistent sensor behavior.