

An IR (Infrared) sensor is an electronic device that detects infrared radiation emitted by objects. It is widely used in various applications such as proximity sensing, motion detection, and remote control systems. IR sensors are versatile and can be used in both analog and digital systems, making them a popular choice for robotics, automation, and consumer electronics.
Common applications of IR sensors include:








Below are the general technical specifications of 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 | 760 nm to 1 mm (Infrared range) |
| Response Time | < 2 ms |
| Operating Temperature | -25°C to 85°C |
The IR sensor module typically has three pins. Below is the pinout description:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin (3.3V to 5V) |
| 2 | GND | Ground connection |
| 3 | OUT | Output pin (Digital or Analog signal, depending on model) |
Below is an example of how to connect and use an IR sensor with an Arduino UNO for obstacle detection:
// IR Sensor Obstacle Detection Example
// Connect the OUT pin of the IR sensor to Arduino digital pin 2
const int irSensorPin = 2; // IR sensor output pin
const int ledPin = 13; // Onboard LED pin for indication
void setup() {
pinMode(irSensorPin, INPUT); // Set IR sensor pin as input
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = digitalRead(irSensorPin); // Read the IR sensor output
if (sensorValue == HIGH) {
// Object detected
digitalWrite(ledPin, HIGH); // Turn on LED
Serial.println("Object detected!");
} else {
// No object detected
digitalWrite(ledPin, LOW); // Turn off LED
Serial.println("No object detected.");
}
delay(100); // Small delay for stability
}
Sensor Not Detecting Objects
False Readings
Short Detection Range
Output Signal Fluctuates
Q1: Can the IR sensor detect transparent objects?
A1: IR sensors may struggle to detect transparent objects like glass. Use specialized sensors for such applications.
Q2: What is the maximum range of an IR sensor?
A2: The range depends on the model, but typical IR sensors can detect objects up to 30 cm.
Q3: Can I use an IR sensor outdoors?
A3: Yes, but ensure it is shielded from direct sunlight to avoid interference.
Q4: How do I differentiate between analog and digital IR sensors?
A4: Check the module's datasheet. Analog sensors output a variable voltage, while digital sensors output HIGH or LOW signals.