

An infrared (IR) sensor detects infrared radiation, which is electromagnetic radiation with wavelengths longer than visible light. IR sensors are widely used in various applications, including proximity sensing, motion detection, and remote control systems. These sensors are versatile, cost-effective, and easy to integrate into electronic circuits, making them a popular choice for hobbyists and professionals alike.
Common applications of IR sensors include:








Below are the general technical specifications for a typical IR sensor module:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V to 5V |
| Operating Current | 20mA (typical) |
| Detection Range | 2 cm to 30 cm (varies by model) |
| Output Type | Digital (High/Low) or Analog |
| Wavelength Sensitivity | ~940 nm (infrared light spectrum) |
| Response Time | ~10 ms |
| Operating Temperature | -25°C to 85°C |
The pin configuration for a standard 3-pin IR sensor module is as follows:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin (3.3V to 5V) |
| 2 | GND | Ground pin |
| 3 | OUT | Output pin (Digital or Analog, depending on the model) |
Below is an example of how to connect and use a digital IR sensor with an Arduino UNO:
// IR Sensor Example Code
// This code reads the digital output of an IR sensor and prints the status
// to the Serial Monitor.
const int irSensorPin = 2; // IR sensor output connected to digital pin 2
int sensorValue = 0; // Variable to store the sensor's output
void setup() {
pinMode(irSensorPin, INPUT); // Set the IR sensor pin as input
Serial.begin(9600); // Initialize serial communication at 9600 baud
}
void loop() {
sensorValue = digitalRead(irSensorPin); // Read the sensor's output
if (sensorValue == LOW) {
// If the sensor detects an object, the output is LOW
Serial.println("Object detected!");
} else {
// If no object is detected, the output is HIGH
Serial.println("No object detected.");
}
delay(500); // Wait for 500 milliseconds before the next reading
}
Sensor Not Detecting Objects
False Detections
Inconsistent Readings
Output Always HIGH or LOW
Q: Can I use an IR sensor outdoors?
A: Yes, but you may need to shield the sensor from direct sunlight to avoid interference.
Q: How do I increase the detection range of my IR sensor?
A: If your sensor has a potentiometer, adjust it to increase the range. Alternatively, use a sensor model with a longer detection range.
Q: Can an IR sensor detect transparent objects?
A: IR sensors may struggle to detect transparent objects, as infrared light can pass through them. Use a different type of sensor for such applications.
Q: Is it possible to use multiple IR sensors in one project?
A: Yes, but ensure each sensor is positioned to avoid interference from the others. Use separate input pins for each sensor on your microcontroller.