The Keyes IR Sensor Module, manufactured by ETC_BVN (Part ID: uno), is an infrared sensor used for detecting objects and measuring distance by emitting and receiving infrared light. This versatile component is widely used in various applications, including obstacle detection, line-following robots, and proximity sensing.
Parameter | Value |
---|---|
Operating Voltage | 3.3V - 5V |
Operating Current | 20mA |
Detection Range | 2cm - 30cm |
Output Type | Digital (High/Low) |
Dimensions | 32mm x 14mm x 7mm |
Weight | 2g |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V - 5V) |
2 | GND | Ground |
3 | OUT | Digital output (High when object detected, Low otherwise) |
Arduino UNO Keyes IR Sensor Module
------------ -----------------------
5V ----------------> VCC
GND ----------------> GND
Digital Pin 2 ------> OUT
// Keyes IR Sensor Module Example Code
// Connect the OUT pin of the sensor to digital pin 2 on the Arduino UNO
const int sensorPin = 2; // Pin connected to the sensor's OUT pin
const int ledPin = 13; // Pin connected to the onboard LED
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 value
if (sensorValue == HIGH) {
digitalWrite(ledPin, HIGH); // Turn on the LED if object is detected
Serial.println("Object detected!");
} else {
digitalWrite(ledPin, LOW); // Turn off the LED if no object is detected
Serial.println("No object detected.");
}
delay(100); // Small delay to avoid serial monitor flooding
}
No Detection:
False Positives:
Inconsistent Readings:
Q: Can the Keyes IR Sensor Module detect transparent objects?
Q: What is the maximum detection range of the sensor?
Q: Can I use the sensor with a 3.3V microcontroller?
By following this documentation, users can effectively integrate the Keyes IR Sensor Module into their projects, ensuring reliable object detection and distance measurement.