

An infrared (IR) object sensor detects the presence of objects by emitting infrared light and measuring the reflection. It is a compact and versatile component widely used in automation, robotics, and security systems. The sensor is ideal for applications such as obstacle detection, line-following robots, proximity sensing, and touchless switches.








The IR object sensor typically consists of an IR LED (emitter) and a photodiode or phototransistor (receiver). Below are the key technical details:
The IR object sensor typically has three or four pins. Below is a table describing the pinout for a common 3-pin IR object sensor:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin (3.3V to 5V DC) |
| 2 | GND | Ground pin |
| 3 | OUT | Output pin (Digital signal: HIGH or LOW) |
For models with an additional analog output pin, the configuration may look like this:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin (3.3V to 5V DC) |
| 2 | GND | Ground pin |
| 3 | DOUT | Digital output pin (HIGH or LOW) |
| 4 | AOUT | Analog output pin (proportional to object distance) |
Below is an example of how to use a digital IR object sensor with an Arduino UNO:
// Define the pin connected to the sensor's digital output
const int sensorPin = 2; // Digital pin 2
const int ledPin = 13; // Built-in LED pin for indication
void setup() {
pinMode(sensorPin, INPUT); // Set sensor pin as input
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = digitalRead(sensorPin); // Read the sensor's output
if (sensorValue == HIGH) {
// Object detected
digitalWrite(ledPin, HIGH); // Turn on the LED
Serial.println("Object detected!");
} else {
// No object detected
digitalWrite(ledPin, LOW); // Turn off the LED
Serial.println("No object detected.");
}
delay(100); // Small delay for stability
}
Sensor Not Detecting Objects
False Positives
Unstable Output
Analog Output Not Working
Q1: Can the IR object sensor detect transparent objects?
A1: No, most IR object sensors cannot reliably detect transparent objects like glass, as IR light passes through them.
Q2: How do I increase the detection range?
A2: You can adjust the potentiometer (if available) or use a sensor model with a longer detection range.
Q3: Can I use multiple IR sensors in the same project?
A3: Yes, but ensure they are spaced apart to avoid interference between their IR signals.
Q4: What is the difference between digital and analog output?
A4: Digital output provides a HIGH or LOW signal based on object detection, while analog output gives a voltage proportional to the distance of the object.
By following this documentation, you can effectively integrate and troubleshoot an IR object sensor in your projects.