2
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ How much more energy efficient are you looking for? Whats the current load of your circuit? \$\endgroup\$ – Passerby Dec 11 '16 at 0:40
  • 2
    \$\begingroup\$ Just a bit. Well, I simply don't want my ESP8266 to be turned on at all time. If it could go to deep-sleep mode it would raise its time of life on a single battery a lot, wouldn't it? My device currently works for about 2 weeks on 2x AA. \$\endgroup\$ – Defozo Dec 11 '16 at 1:05
  • \$\begingroup\$ Are you using the sleep modes already available with internal timers? What's the actual current draw though? \$\endgroup\$ – Passerby Dec 11 '16 at 1:25
  • \$\begingroup\$ @Passerby I'm not using any sleep modes currently. Sorry, I can't measure the precise current draw now (but it's probably around 40 mA). Please see my updated question. \$\endgroup\$ – Defozo Jan 7 '17 at 1:34
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ I updated my question. Please take a look. \$\endgroup\$ – Defozo Jan 7 '17 at 1:35
1
\$\begingroup\$

Enter deepsleep without connecting GPIO16 and RESET leeds to endless deepsleep unless you pulse reset with an extern circuit!

That is what you have to do. Connect your photoresistor to a differential-Amp with monoflop in series to ensure clean pulses on reset pin or use a ultra low power mcu to do that. So every time the light changes the differntial-amp detects the high slope and triggers the Monoflop!

Reading Pin 16 is not a musthave you can use a timeout in monoflop but adding an AND-Gate is also not really hard to do.

\$\endgroup\$
0
\$\begingroup\$

You could just put the esp into light sleep mode, and tie a gpio pin as an interrupt to wake it up. Have your photoresistor wake up the esp whenever the light is turn on, then send to server. That should save a lot of power

See Esp8266

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.