

An infrared (IR) sensor, manufactured by Arduino (Part ID: G), is a device designed to detect infrared radiation. It is commonly used in applications such as motion detection, proximity sensing, and remote control systems. The sensor operates by emitting or detecting IR light, which is invisible to the human eye but can be used to sense objects, measure distances, or detect heat signatures.








Below are the key technical details of the Arduino IR Sensor (Part ID: G):
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V to 5V |
| Operating Current | 20mA (typical) |
| Detection Range | 2 cm to 30 cm (depending on model) |
| Output Signal | Digital (High/Low) |
| Wavelength | 940 nm (typical) |
| Response Time | < 2 ms |
| Operating Temperature | -25°C to 85°C |
The IR sensor typically has three pins, as described below:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin (3.3V to 5V) |
| 2 | GND | Ground connection |
| 3 | OUT | Digital output pin (High when no object detected, |
| Low when an object is detected) |
Connect the Pins:
VCC pin to the 5V pin of your microcontroller (e.g., Arduino UNO).GND pin to the ground (GND) of your microcontroller.OUT pin to a digital input pin on your microcontroller.Place the Sensor:
Write the Code:
// IR Sensor Example Code for Arduino UNO
// This code reads the digital output of the IR sensor and turns on an LED
// when an object is detected.
const int irSensorPin = 2; // Connect the OUT pin of the IR sensor to pin 2
const int ledPin = 13; // Built-in LED on Arduino UNO
void setup() {
pinMode(irSensorPin, INPUT); // Set the IR sensor pin as input
pinMode(ledPin, OUTPUT); // Set the LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = digitalRead(irSensorPin); // Read the sensor's output
if (sensorValue == LOW) {
// 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
}
The sensor is not detecting objects:
The sensor output is unstable:
The sensor is always HIGH or LOW:
Q: Can the IR sensor detect transparent objects?
A: Transparent objects, such as glass, may not be detected effectively due to their low reflectivity in the IR spectrum.
Q: Can I use the IR sensor outdoors?
A: While the sensor can be used outdoors, strong sunlight or environmental IR sources may interfere with its performance.
Q: How do I increase the detection range?
A: The detection range is hardware-limited. For longer ranges, consider using a different IR sensor model or an ultrasonic sensor.
By following this documentation, you can effectively integrate the Arduino IR Sensor (Part ID: G) into your projects for reliable motion and proximity detection.