Hey all, I have a Keyes LDR light sensor. It looks pretty simple to setup and configure. Can I use this with ESPHome?
Link here.
Thanks in advance.
Hey all, I have a Keyes LDR light sensor. It looks pretty simple to setup and configure. Can I use this with ESPHome?
Link here.
Thanks in advance.
Yes. Power it with 3.3V so you don’t damage the analogue input.
Thanks Tom, but how do I configure it? Usually the output is defined by the pin in an Arduino sketch (ie Light_PIN = A0
). How is this done via ESPHome?
I see examples for bh1750 and TSL2561 and see they are referred to via address rather than the pin they are attached to.
At this stage, I don’t know enough about how it all works. Can I modify either one of light sensor configurations above or do I create a new template for it somewhere?
That would depend on which tpye of ESP board you are using. ESP32 or ESP8266?
ESP32 Node MCU.
You are spoiled for choice the. The ESP32 has a lot of analogue to digital converters ( the ESP8266 only has one):
So pick one and configure it like this:
Oh cool, thanks for that.
Hey Tom, thanks for taking the time to respond. I really appreciate it. Another question if I may. I notice the example displays living room brightness as volts. What is the correlation between brightness (say LUM) and volts? Is that something determined by the device itself or does it need to be converted somewhere?
Thanks again…
There is no universal way to do this. Each light dependant resistor has it’s own characteristic curve that relates resistance to lux. They are not precise devices.
If you want a reading in lux you will have to calibrate it against a known standard. Or use a different type of sensor that has a direct output in lux like the BH1750.
Thanks, I suppose it could be read as a percent value where the reading is a ratio of the maximum voltage read.