The KY-027.1 is a digital infrared obstacle avoidance sensor module designed for detecting objects in its proximity. It operates by emitting infrared light through an infrared LED and detecting the reflected light using a phototransistor. When an object is detected, the module outputs a digital signal, making it easy to interface with microcontrollers and other digital systems.
The KY-027.1 module is compact and easy to use, with the following key specifications:
Parameter | Value |
---|---|
Operating Voltage | 3.3V to 5V |
Output Type | Digital (High/Low) |
Detection Range | 2 cm to 30 cm (adjustable) |
Detection Angle | ~35° |
Current Consumption | ~20 mA |
Dimensions | 32mm x 14mm x 8mm |
The KY-027.1 module has three pins for easy interfacing:
Pin | Name | Description |
---|---|---|
1 | VCC | Connect to the positive supply voltage (3.3V to 5V). |
2 | GND | Connect to the ground of the power supply. |
3 | OUT | Digital output pin. Outputs HIGH (1) when no obstacle is detected, and LOW (0) when an obstacle is detected. |
VCC
pin to a 3.3V or 5V power source and the GND
pin to the ground.OUT
pin to a digital input pin of a microcontroller (e.g., Arduino UNO) or a digital logic circuit.OUT
pin. It will output:Below is an example of how to connect and use the KY-027.1 with an Arduino UNO:
VCC
pin of the KY-027.1 to the 5V pin of the Arduino.GND
pin of the KY-027.1 to the GND pin of the Arduino.OUT
pin of the KY-027.1 to digital pin 2 of the Arduino.// KY-027.1 Obstacle Avoidance Sensor Example
// Connect the OUT pin of the KY-027.1 to Arduino digital pin 2
const int sensorPin = 2; // KY-027.1 OUT pin connected to digital pin 2
const int ledPin = 13; // Onboard LED pin for visual feedback
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 output
if (sensorValue == LOW) {
// Obstacle detected
digitalWrite(ledPin, HIGH); // Turn on the LED
Serial.println("Obstacle detected!");
} else {
// No obstacle
digitalWrite(ledPin, LOW); // Turn off the LED
Serial.println("No obstacle.");
}
delay(100); // Small delay for stability
}
The sensor is not detecting obstacles:
False detections or erratic behavior:
Output pin always HIGH or LOW:
OUT
pin is connected to the correct microcontroller pin.Q: Can the KY-027.1 detect transparent objects?
A: The sensor may struggle to detect transparent or highly reflective objects due to insufficient reflected infrared light.
Q: How do I increase the detection range?
A: Adjust the onboard potentiometer clockwise to increase the sensitivity and detection range.
Q: Can I use the KY-027.1 with a 3.3V microcontroller?
A: Yes, the KY-027.1 operates within a voltage range of 3.3V to 5V, making it compatible with 3.3V systems.
Q: What is the maximum detection angle of the sensor?
A: The KY-027.1 has a detection angle of approximately 35°, which is suitable for most obstacle detection applications.