Page 1 of 1

Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 19:42
by Morrine
Hi everyone,

I launched myself into a home automation project in which I wanted to integrate a lux sensor to control the lights intensity via Domoticz.

So I flashed an ESP8266 with ESPEasy and connected a GL5528 like so : wiring 3,3V to A0 through a 1KOhm resistor and the GL5528 from A0 to GND.

When I look at the web interface (configured as Analog Input : Internal), I got a steady value of 65535. Whatever I do, it's not moving.

I first thought it was the resistor which was too low, so I changed it for a 4,7K then a 47K resistor without sucess. Still the same steady value ... I also replaced the GL5528 just in case.

Then I red on the wiki that ESP8266 NodeMCU already had a pullup/down resistor, so I replaced the 47K with a wire. Still, nothing has changed !

I'm coming out of ideas, so if you have any informations that could help me troubleshoot this !

Thank you in advance

Re: Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 20:06
by erem
you will most likely have better response if you ask this on the espeasy forum

here: https://www.letscontrolit.com/forum/

Re: Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 20:39
by jvdz
Shouldn't that be wired like shown in this example?:
https://www.hackster.io/gary-watts/esp8 ... schematics
Jos

Re: Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 20:47
by Treve
I build a LUX sensor with ESP8266 (standard software ) and Lux sensor BH1750, no use of resistors.
ESP8266 send his data to Domoticz, with a Blockly I manage the darkness in the living room. It works flawlessly.

Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 20:53
by Treve
Image

This was the test setup.

Re: Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 21:02
by jvdz
A photocell is something different from the BH1750, which works quite different. The photocell is simply a resistor which varies based on the light. That is why you need the 3.3v - LDR - a0 pin - fixed resistor - 0. The a0 wil get a variable Volt level based on the resistance of the LDR. :)
Agree that the BH1750 works "better" but I have both and it should also work when no accuracy is required.

Jos

Re: Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 21:43
by Treve
Hi Jos, I know the difference. I’m using the LDR as well as shown. It allows the sunscreen to go out.
The topic starter was talking about lux, so I responded with my build to show it can be very simpel, accurate and cheap

Image
With regards,

Evert

Re: Need help with an ESP8266 and a photocell

Posted: Sunday 23 May 2021 22:44
by Morrine
jvdz wrote: Sunday 23 May 2021 20:39 Shouldn't that be wired like shown in this example?:
https://www.hackster.io/gary-watts/esp8 ... schematics
Jos
Yup, it's what I did, sorry, I messed myself when writing ...
erem wrote: Sunday 23 May 2021 20:06 you will most likely have better response if you ask this on the espeasy forum

here: https://www.letscontrolit.com/forum/
Thanks for the link of the forum, I tried to post on the ESP reddit but got insta moderated for no reasons :(

I originally bought photocells to reduce cost at maximum since I already had resistors, but now I'm considering buying an I2C BH1750 !

I'll try posting on the ESP forum, I don't like to stay on a unexplained failure ...

Thank you for the quick answers :)

Re: Need help with an ESP8266 and a photocell

Posted: Monday 24 May 2021 17:59
by Morrine
I'm back with an answer from the ESP forum. Apparently, if the firmware contains VCC in its name, then the A0 input doesn't work quite fine. I changed mine and it's now working just perfect with a 10KOhm resistor. (ESP_Easy_mega_20210503_test_A_ESP8266_4M1M.bin : name of the firmware used)