1

I'm using a esp8266 to build a remote control to power a gas fireplace. I'm using this guide to try and maximize battery life.

The concept is the controller uses its built in WiFi to access a RESTful API on a remote server; If the API discovers"1", it should close a switch and the fireplace turns on. If the arduino reads a "0" via the API it opens the switch and the fireplace turns off. After discovery and performing the required action the unit calls Deepsleep and shuts off for ten seconds, whereupon it powers up and the cycle repeats itself again.

I just realized that if the controller powers off, I don't know what happens to the switch. If the fireplace was turned on, what happens when deep sleep starts. Is there a way (special switch?) that maintains its state in deepsleep mode?

  • Please edit question to clarify meaning of “I'd it sees” – James Waldby - jwpat7 Dec 17 '16 at 1:21
  • Save the last state in EEPROM. Or, since you are using a remote server, store the state on the server. – Gerben Dec 17 '16 at 13:24
  • 1
    @Gerben I think he means the physical state of the IO pin - when in deep sleep the general consensus (though I haven't found a definitive answer) is that the GPIO pins will lose their drive state when the chip goes to sleep. – Majenko Dec 17 '16 at 16:23
  • @Majenko that indeed makes more sense. – Gerben Dec 17 '16 at 16:54
1

You can get a latching relay. These come in two flavours - Unipolar, where you energise one pin to turn it on, and energise the other to turn it off, and Bipolar, where the direction of the current through the coil turns on or turns off.

Unipolar is easier to drive since you just need two transistors, diodes and resistors. Bipolar is harder, since you need a H-bridge (motor driver), but requires less wires to connect it up (2 as opposed to 3).

In both cases it is just a short pulse that is needed to switch the relay into a different state - there is no need to maintain the output, so is ideal for deep-sleep mode where everything is turned off except the RTC.

0

Yes, there is such 'switch'. You could use JK Flip-Flop to hold the last output. JK Flip-Flop has J, K and clock inputs and If J and K are different then the output takes the value of J at the next clock edge.

  • Wouldn't the flip-flop require power all the time, reducing the benefits of the deep sleep mode? – Harper Shelby Feb 15 '17 at 19:34
  • ESP8266 draws from 50 up to 200 mA while J-K flip-flop draws 5-6 mA + less than 100 µA per input. Everything reduces the benefits of the deep-sleep mode, even the ESP8266's counter which is still running during deep sleep. – Chupo_cro Feb 17 '17 at 3:26
  • So that's a "Yes, but the difference is marginal"? I was asking for enlightenment, so thanks for the info. – Harper Shelby Feb 21 '17 at 18:44
  • Well, the difference between the deep sleep mode and 'deep sleep + J-K flip flop' is indeed considerable because the current draw in deep sleep mode is only about 10 µA but 5-6 mA might still be acceptable when using batteries because a few seconds of ESP8266 drawing full power everytime it wakes up will probably drain the battery more than J-K flip-flop drawing a few mA continuously. Depends on waking up intervals and for the remote control to be acceptably responsive ESP has to wake up quite frequently. – Chupo_cro Feb 22 '17 at 5:06

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.