

An IR (Infrared) sensor is an electronic device that detects infrared radiation emitted by objects. It is widely used in applications such as proximity sensing, motion detection, and remote control systems. IR sensors are versatile and can be used in both analog and digital modes, making them suitable for a variety of projects, including robotics, home automation, and security systems.








Below are the key technical details of a typical IR sensor module:
The IR sensor module typically has three pins. Below is the pin configuration:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Connect to the positive terminal of the power supply (3.3V or 5V). |
| 2 | GND | Connect to the ground terminal of the power supply. |
| 3 | OUT | Output pin that provides a digital signal (HIGH or LOW) or analog voltage. |
Below is an example of how to use an IR sensor with an Arduino UNO to detect an object and turn on an LED:
// Define pin connections
const int irSensorPin = 2; // Digital pin connected to the IR sensor's OUT pin
const int ledPin = 13; // Built-in LED pin on Arduino UNO
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 == LOW) { // Object detected (LOW signal from sensor)
digitalWrite(ledPin, HIGH); // Turn on the LED
Serial.println("Object detected!");
} else { // No object detected (HIGH signal from sensor)
digitalWrite(ledPin, LOW); // Turn off the LED
Serial.println("No object detected.");
}
delay(100); // Small delay for stability
}
Sensor Not Detecting Objects:
False Detections:
No Output Signal:
Interference Between Multiple Sensors:
Q: Can the IR sensor detect transparent objects?
A: IR sensors may struggle to detect transparent objects like glass, as infrared light can pass through them. Use alternative sensors for such applications.
Q: How do I increase the detection range?
A: Adjust the potentiometer on the sensor module. Note that the maximum range is limited by the sensor's design.
Q: Can I use the IR sensor outdoors?
A: While possible, outdoor use may result in reduced accuracy due to sunlight and environmental factors. Consider using an IR sensor with ambient light filtering for outdoor applications.