

The KeyesIR KY-032 is an infrared (IR) sensor module designed to detect infrared radiation. It is widely used in applications such as proximity sensing, motion detection, and remote control systems. The sensor operates by emitting infrared light and detecting the reflected signal, making it ideal for obstacle detection and line-following robots.
This module is compact, easy to use, and compatible with microcontrollers like Arduino, Raspberry Pi, and other development boards. Its adjustable sensitivity and range make it versatile for a variety of projects.








Below are the key technical details of the KeyesIR KY-032 IR sensor module:
| Parameter | Specification |
|---|---|
| Operating Voltage | 3.3V - 5V DC |
| Operating Current | ≤ 20mA |
| Detection Range | 2cm - 30cm (adjustable) |
| Detection Angle | 35° |
| Output Type | Digital (High/Low) |
| Sensitivity Adjustment | Potentiometer |
| Dimensions | 3.1cm x 1.5cm x 0.7cm |
The KY-032 IR sensor module has four pins, as described in the table below:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin. Connect to 3.3V or 5V DC. |
| 2 | GND | Ground pin. Connect to the ground of the circuit. |
| 3 | OUT | Digital output pin. Outputs HIGH (1) when no obstacle is detected, LOW (0) when an obstacle is detected. |
| 4 | EN | Enable pin. Used to enable or disable the sensor (optional, usually connected to VCC). |
Below is an example of how to connect the KY-032 IR sensor to an Arduino UNO:
| KY-032 Pin | Arduino UNO Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| OUT | Digital Pin 2 |
| EN | 5V |
The following code demonstrates how to use the KY-032 IR sensor with an Arduino UNO to detect obstacles:
// Define the pin connected to the KY-032 OUT pin
const int irSensorPin = 2;
// Variable to store the sensor state
int sensorState = 0;
void setup() {
// Initialize the serial monitor for debugging
Serial.begin(9600);
// Set the IR sensor pin as input
pinMode(irSensorPin, INPUT);
}
void loop() {
// Read the state of the IR sensor
sensorState = digitalRead(irSensorPin);
// Check if an obstacle is detected
if (sensorState == LOW) {
Serial.println("Obstacle detected!"); // Print message if obstacle is detected
} else {
Serial.println("No obstacle detected."); // Print message if no obstacle is detected
}
// Add a small delay to avoid flooding the serial monitor
delay(200);
}
Sensor Not Detecting Obstacles:
False Positives or Erratic Behavior:
No Output Signal:
Q1: Can the KY-032 IR sensor detect transparent objects?
A1: No, the sensor may not reliably detect transparent or highly reflective objects due to the way infrared light is reflected.
Q2: How do I increase the detection range?
A2: Use the onboard potentiometer to adjust the sensitivity. Note that increasing the range may reduce accuracy.
Q3: Can I use the KY-032 with a 3.3V microcontroller?
A3: Yes, the sensor operates at both 3.3V and 5V, making it compatible with 3.3V microcontrollers like ESP32 or Raspberry Pi.
Q4: What is the purpose of the EN pin?
A4: The EN pin is used to enable or disable the sensor. If not used, it should be connected to VCC by default.