Electronic – How to wake up ESP8266 with light change

esp8266low-powerphotoresistorsleep

I want to send information to the server when the light changes (turns on or turns off). As for now, I have a photoresistor connected to ESP8266's ADC pin. I'm measuring voltage and sends information to a server when it changes much. ESP stays always on.

Here is my current circuit:

enter image description here

However, I'd like to make it in slightly more energy efficient way.

The sensor will be used in a bathroom, so the light is usually turned off.

Perhaps I could make ESP8266 wake up somehow by photoresistor and then send a request to the server and wait for the light to turn off back again and then send the second request and enter the deep-sleep mode? Or maybe there is a better way?

I'm seeking help in creating a circuit. What should I use? How the circuit should look like?

Best Answer

The deep sleep functionality of the ESP8266 is managed by tying pin 16 to the RESET pin and when you call the deep sleep function you pass the number of microseonds you want to sleep. Then the microcontroller sets pin 16 high and goes to sleep. After the specified amount of time the pin 16 goes low causing the ESP8266 to reset. Please see the "low power solutions" pdf from Espressif for the API details, including some application notes.

So, your plan of connecting to pin 16 is not going to work exactly. You need a circuit that detects that pin 16 is high and then generates a low pulse on RST when your condition triggers. Without knowing more details about your circuit and exact triggering condition or is hard to provide a detailed answer.