As a hack, I want to use an LDR (Light Dependent Resistor) to detect an LED turning on or off on an alarm panel. What is the best way to interface this with an ESP32? I found Resistor Sensor, but this uses an Update Interval, and I require instant reporting.
Like this?
Thanks - yes that’s exactly the kind of thing - I’m just confused what Platform I should use in ESPHome.
I’m guessing I just simply use the gpio Platform, and then use the voltage dividing resistor & LDR to make sure OFF is well below 1.6v, and ON is well above 1.6v? This seems to work, but not sure if it’s the best approach.
- platform: gpio
name: "esp_LDR_Binary"
pin:
number: 35
inverted: false
mode:
input: true
That’s pretty much it, I think: connect a resistor (say 10kOhm) in series and tap the midpoint. You can either choose different resistor values (digital) or do a threshold on the voltage measured (analogue).