M5Stack Reflective IR Sensor Always Reads 0
-
Issue: M5Stack Reflective IR Sensor Always Reads 0
Environment:
Device:M5Stack Basic
Board: LilyGO T-Display (ESP32-D0WDQ6-V3)
Sensor Module: M5Stack Reflective IR
Development Environment:
Arduino IDE (ESP32 board configuration)
M5Unified library
Wiring:
VCC → 5V (or 3.3V)
GND → GND
Analog OUT → GPIO36 (VP)
Digital OUT → GPIO26
Problem:
The M5Stack Reflective IR sensor is connected properly, but when reading the analog value using analogRead(36), the result is always 0 and does not change.What I Have Tried:
Checked Serial Monitor Output (Baud Rate: 115200 bps)
Used Serial.println(analogRead(36));
The value remains 0 at all times.
Tested with Hand in Front of SensorExpected the analog value (0-4095) to change.
No change in the output.
Checked Sensor WiringVCC is correctly connected to 5V (or 3.3V).
GND is properly connected to GND.
Analog OUT is connected to GPIO36 (ESP32 ADC pin).
The wiring appears to be correct.
Measured Voltage with MultimeterVCC-GND voltage: 5V (or 3.3V) → OK
Analog OUT-GND voltage: 0V → No change even when hand is placed in front of the sensor.
Tried a Minimal Test Code:void setup() {
Serial.begin(115200);
analogReadResolution(12); // Set ADC to 12-bit
pinMode(36, INPUT);
}void loop() {
int analogValue = analogRead(36);
Serial.println(analogValue);
delay(500);
}
Still always reads 0.
Checked Digital Output (GPIO26)Used digitalRead(26), but the output remains LOW at all times.
Seems like the sensor is not responding at all.
Tested on Another ESP32 Board (M5Stack Basic)Same issue: Analog OUT remains 0 at all times.
Possible Causes:Sensor might be defective since Analog OUT is always 0V.
ESP32 ADC issue, but tested on another board with the same result.
Incorrect voltage supply, but tested with both 5V and 3.3V without any difference.
Questions:Is it normal for the M5Stack Reflective IR sensor's Analog OUT to stay at 0V?
If adjusting the sensitivity (potentiometer) does not change the output, could this indicate a defective sensor?
Are there any additional debugging steps I should try?
I would appreciate any insights from anyone who has experience with this sensor. Thank you! -
@shinshin8 said in M5Stack Reflective IR Sensor Always Reads 0:
Board: LilyGO T-Display (ESP32-D0WDQ6-V3)
What do you mean 'Board: LilyGO T-Display (ESP32-D0WDQ6-V3)'
What version of Arduino IDE are you using?
Are you using this example:
https://github.com/m5stack/M5Unit-ReflectiveIR/blob/main/examples/detect.inoLater edit:
Is the IR LED turned on?
You can use a phone camera to observe near IR.
Have you tried adjusting the sensitivity trim pot full scale, CW, CCW?
Your hand may not reflect enough IR.
The output is active low, so you should see 0Vdc when a reflective object is in the path. ADC 0Vdc as well.