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:
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?
-
\$\begingroup\$ How much more energy efficient are you looking for? Whats the current load of your circuit? \$\endgroup\$Passerby– Passerby2016年12月11日 00:40:57 +00:00Commented Dec 11, 2016 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– Defozo2016年12月11日 01:05:01 +00:00Commented Dec 11, 2016 at 1:05
-
\$\begingroup\$ Are you using the sleep modes already available with internal timers? What's the actual current draw though? \$\endgroup\$Passerby– Passerby2016年12月11日 01:25:10 +00:00Commented Dec 11, 2016 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– Defozo2017年01月07日 01:34:33 +00:00Commented Jan 7, 2017 at 1:34
3 Answers 3
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.
-
\$\begingroup\$ I updated my question. Please take a look. \$\endgroup\$Defozo– Defozo2017年01月07日 01:35:13 +00:00Commented Jan 7, 2017 at 1:35
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.
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
Explore related questions
See similar questions with these tags.