ESP8266 and photocell GL55.. not reading

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Morrine
New user
Posts: 3
Joined: 23 May 2021, 22:47

ESP8266 and photocell GL55.. not reading

#1 Post by Morrine » 23 May 2021, 22:51

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 GL5528 photocell and a 1KOhm resistor 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 0Ohm resistor. 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

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: ESP8266 and photocell GL55.. not reading

#2 Post by ThomasB » 24 May 2021, 06:26

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.
Check your ESPEasy firmware file; If it has "_VCC" in the bin's name then you are using the wrong one.
I'm coming out of ideas, so if you have any informations that could help me troubleshoot this !
What is the full name of the firmware file that you used to flash your device? That is an important detail to share.

- Thomas

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP8266 and photocell GL55.. not reading

#3 Post by TD-er » 24 May 2021, 07:59

Apart from the "_VCC" remark made by Thomas, you should also think about the 'schematics'.

A NodeMCU indeed does have resistors present to convert 0...3v3 to 0...1V which the analog input of the ESP needs.
But that doesn't mean you should exchange the resistor you first tried to use for a 0 Ohm one.

I would have placed the photoresistor between GND and A0, but I don't think it really matters here.

In short, what you need is something like this:

Code: Select all

3v3 --- R1 --- A0 --- R2 --- GND
R1 is in your setup chosen as the photocell, and R2 should be the fixed resistor, but like I said those can also be swapped as you need to calibrate the output anyway.
But I can imagine it would be more intuitive to have a lower value in the dark and a higher value in bright light as you first intended.

What is important is that you limit the current through R1 + R2 to such an amount that with the lowest expected resistance of the photocell you won't take too much current.
Also given the relative high resistance of the LDR you should probably pick the resistance value of the resistor to be roughly equal to the resistance value of the LDR when lit with half the max. intended light intensity. (on a log scale, half the lux scale)
Based on a quick search on Google, I see most schematics use between 10k and 100k.

Morrine
New user
Posts: 3
Joined: 23 May 2021, 22:47

Re: ESP8266 and photocell GL55.. not reading

#4 Post by Morrine » 24 May 2021, 17:33

Hello guys !!

Thank you for your answers, the name of the firmware is "ESP_Easy_mega_20210503_test_A_alt_wifi_ESP8266_4M1M_VCC.bin"

So ... Indeed it got VCC in it's name, althought I don't really know what it means and why it's bad. I'll tell you I picked the first firmware on the list thinking it was the latest release ... My bad :'(

Which one should I choose then ? Could you enlight me on the reason aswell ?

Thanks again !! :)

Morrine
New user
Posts: 3
Joined: 23 May 2021, 22:47

Re: ESP8266 and photocell GL55.. not reading

#5 Post by Morrine » 24 May 2021, 17:56

So, following your indications, I tried with this firmware : "ESP_Easy_mega_20210503_test_A_ESP8266_4M1M.bin" and a 10K resistor

And it magically works !! Thank you very much again !!

No I just got to understand why !

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: ESP8266 and photocell GL55.. not reading

#6 Post by ThomasB » 24 May 2021, 18:23

And it magically works !! Thank you very much again !!
Fantastic news.
No I just got to understand why !
The software with "_VCC" in the name is a special version that can be used to measure the device's operational voltage on a battery powered device. It ignores the voltage on the Analog Input pin. Instead, it measures the VCC voltage without any pin connections or extra hardware. It does this magic by measuring the internal Vref.

You''re not the first to get confused by this. If the information is not already in the wiki and readthedocs, perhaps the docs need to be updated to reflect which version is needed for these two different analog applications.

- Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests