New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep sleep and wake up using interrupt #1488

Closed
shayo opened this Issue Jan 23, 2016 · 31 comments

Comments

Projects
None yet
@shayo

shayo commented Jan 23, 2016

Hi,

I saw the option to enter deep sleep for a predefined amount of time ( ESP.deepSleep)
Is it possible to wake up during that time with an external interrupt?
If so, how?

Thanks,

Shay

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@chaeplin

chaeplin Jan 23, 2016

Contributor

check esp api in https://github.com/esp8266/Arduino/blob/master/doc/libraries.md#esp-specific-apis

ESP.deepSleep(microseconds, mode) will put the chip into deep sleep. mode is one of 
WAKE_RF_DEFAULT, WAKE_RFCAL, WAKE_NO_RFCAL, WAKE_RF_DISABLED.
 (GPIO16 needs to be tied to RST to wake from deepSleep.)
Contributor

chaeplin commented Jan 23, 2016

check esp api in https://github.com/esp8266/Arduino/blob/master/doc/libraries.md#esp-specific-apis

ESP.deepSleep(microseconds, mode) will put the chip into deep sleep. mode is one of 
WAKE_RF_DEFAULT, WAKE_RFCAL, WAKE_NO_RFCAL, WAKE_RF_DISABLED.
 (GPIO16 needs to be tied to RST to wake from deepSleep.)
@shayo

This comment has been minimized.

Show comment
Hide comment
@shayo

shayo Jan 23, 2016

That doesn't really answer my question. I understand that if order to wake up from a deep sleep timer, GPIO16 needs to be wired to RST, but is it possible to wake up before that, using an external event on some GPIO line?

shayo commented Jan 23, 2016

That doesn't really answer my question. I understand that if order to wake up from a deep sleep timer, GPIO16 needs to be wired to RST, but is it possible to wake up before that, using an external event on some GPIO line?

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@chaeplin

chaeplin Jan 23, 2016

Contributor

@shayo
No, you can't use an external event on some GPIO line.
In deepSleep state, only rtc is on(cpu and system clock is off).
GPIO16 generate a short pule to reset esp.
So any reset pulse will wake up esp.

With ESP.deepSleep(0), esp will be going to sleep forever.

Contributor

chaeplin commented Jan 23, 2016

@shayo
No, you can't use an external event on some GPIO line.
In deepSleep state, only rtc is on(cpu and system clock is off).
GPIO16 generate a short pule to reset esp.
So any reset pulse will wake up esp.

With ESP.deepSleep(0), esp will be going to sleep forever.

@duncan-a

This comment has been minimized.

Show comment
Hide comment
@duncan-a

duncan-a Jan 23, 2016

But, if GPIO16 triggers the 'wake from deep sleep' by firing a Reset, why can't a Low pulse on RST achieve the same result?

Am I missing something?

CHAE-PIL LIM notifications@github.com wrote:

@shayo
No, you can't use an external event on some GPIO line.


Reply to this email directly or view it on GitHub.

duncan-a commented Jan 23, 2016

But, if GPIO16 triggers the 'wake from deep sleep' by firing a Reset, why can't a Low pulse on RST achieve the same result?

Am I missing something?

CHAE-PIL LIM notifications@github.com wrote:

@shayo
No, you can't use an external event on some GPIO line.


Reply to this email directly or view it on GitHub.

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 23, 2016

Collaborator

GPIO16 is connected to CH_DP for deepSleep.
and pulled low during deepSleep.
if CH_DP goes high the chip wakes up.
for what reason the high signal comes from does not mater.
can be the RTC timer or any other electrical stuff connected to CH_DP.
so adding a pullup to CH_DP and a switch that is normally close to GPIO16 will work fine.

Collaborator

Links2004 commented Jan 23, 2016

GPIO16 is connected to CH_DP for deepSleep.
and pulled low during deepSleep.
if CH_DP goes high the chip wakes up.
for what reason the high signal comes from does not mater.
can be the RTC timer or any other electrical stuff connected to CH_DP.
so adding a pullup to CH_DP and a switch that is normally close to GPIO16 will work fine.

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@chaeplin

chaeplin Jan 24, 2016

Contributor

@duncan-a External interrupt to rst is ok. But @shayo's question is "using an external event on some GPIO line".

@Links2004 GPIO16 is in HIGH during deepSleep.

I will use CH_DP when I use esp-01.

GPIO16 to RST has one advantage when wake up---> wifi connect with static ip : 150 ~ 210msec

reset switch for deepsleep.
button

edited)
flip-flop version --> monostable flip flop
flip

Contributor

chaeplin commented Jan 24, 2016

@duncan-a External interrupt to rst is ok. But @shayo's question is "using an external event on some GPIO line".

@Links2004 GPIO16 is in HIGH during deepSleep.

I will use CH_DP when I use esp-01.

GPIO16 to RST has one advantage when wake up---> wifi connect with static ip : 150 ~ 210msec

reset switch for deepsleep.
button

edited)
flip-flop version --> monostable flip flop
flip

@me-no-dev

This comment has been minimized.

Show comment
Hide comment
@me-no-dev

me-no-dev Jan 24, 2016

Collaborator

As an option, you can have the ESP in deep sleep waiting for the RTC to trigger pin 16 for wakeup and use the reset button at the same time as manual reset. Reading the reset cause can tell you which event woke up the ESP :) then you can programmatically split and act different on both.

Collaborator

me-no-dev commented Jan 24, 2016

As an option, you can have the ESP in deep sleep waiting for the RTC to trigger pin 16 for wakeup and use the reset button at the same time as manual reset. Reading the reset cause can tell you which event woke up the ESP :) then you can programmatically split and act different on both.

@Humancell

This comment has been minimized.

Show comment
Hide comment
@Humancell

Humancell Apr 3, 2016

@chaeplin ... thanks for the schematic and comments.

I'm curious ... when you say "flip flop" does this mean it fires the reset on both opening AND closing the switch?

Humancell commented Apr 3, 2016

@chaeplin ... thanks for the schematic and comments.

I'm curious ... when you say "flip flop" does this mean it fires the reset on both opening AND closing the switch?

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@Humancell

This comment has been minimized.

Show comment
Hide comment
@Humancell

Humancell Apr 4, 2016

Thank you ... I saw that you had posted about your solution here also: https://github.com/chaeplin/esp8266_and_arduino/tree/master/_48-door-alarm-deepsleep

I"m working on a similar idea, and am curious ... with your door sensor, it appears that you have the deep sleep timer still working, but then you can be triggered by the reed switch opening ... or closing?

And with the added circuitry (did you use the monostable flip-flop with your reed switch door sensor?) what is the final deep sleep current that you are seeing? Do any of these components add to the current draw during deep sleep?

Humancell commented Apr 4, 2016

Thank you ... I saw that you had posted about your solution here also: https://github.com/chaeplin/esp8266_and_arduino/tree/master/_48-door-alarm-deepsleep

I"m working on a similar idea, and am curious ... with your door sensor, it appears that you have the deep sleep timer still working, but then you can be triggered by the reed switch opening ... or closing?

And with the added circuitry (did you use the monostable flip-flop with your reed switch door sensor?) what is the final deep sleep current that you are seeing? Do any of these components add to the current draw during deep sleep?

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@chaeplin

chaeplin Apr 4, 2016

Contributor

@Humancell Trigged when opening, cause the type of reed switch is normally opened(Q3 is added to invert signal).

With C2, R4 and R9, a low signal is converted to reset pulse(Arduino reset method), so no more monostable flip-flop is needed.

My µCurrent GOLD shows 0A while in deepsleep.

Contributor

chaeplin commented Apr 4, 2016

@Humancell Trigged when opening, cause the type of reed switch is normally opened(Q3 is added to invert signal).

With C2, R4 and R9, a low signal is converted to reset pulse(Arduino reset method), so no more monostable flip-flop is needed.

My µCurrent GOLD shows 0A while in deepsleep.

@Humancell

This comment has been minimized.

Show comment
Hide comment
@Humancell

Humancell Apr 4, 2016

Ok ... this makes sense. So the reed you are using is open, and then closes with the magnet nearby?

If I need to do the reset on the reed switch both opening AND closing? I want to create an event when the door opens ... AND when it closes ... which obviously adds complexity. Is this where the flip-flop comes into play?

Sorry for being slow on this ...

Humancell commented Apr 4, 2016

Ok ... this makes sense. So the reed you are using is open, and then closes with the magnet nearby?

If I need to do the reset on the reed switch both opening AND closing? I want to create an event when the door opens ... AND when it closes ... which obviously adds complexity. Is this where the flip-flop comes into play?

Sorry for being slow on this ...

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@chaeplin

chaeplin Apr 4, 2016

Contributor

@Humancell _48-door-alarm-deepsleep is doing what you want.
I can't make a reset signal when door is closing, So I use modem sleep and light sleep while door is opened.

I think attiny85 with pin change interrupt is more easier than R/C/TR circuit.
attiny85 : gpio 1) reed sw. gpio 2) to esp reset. gpio 3) to esp gpio
esp : deepsleep.

https://github.com/chaeplin/esp8266_and_arduino/tree/master/_28-attiny85-nrf24-3pin-ir
http://www.gammon.com.au/interrupts

sch : attiny85 + esp01
http://imgur.com/MooQJV9

Contributor

chaeplin commented Apr 4, 2016

@Humancell _48-door-alarm-deepsleep is doing what you want.
I can't make a reset signal when door is closing, So I use modem sleep and light sleep while door is opened.

I think attiny85 with pin change interrupt is more easier than R/C/TR circuit.
attiny85 : gpio 1) reed sw. gpio 2) to esp reset. gpio 3) to esp gpio
esp : deepsleep.

https://github.com/chaeplin/esp8266_and_arduino/tree/master/_28-attiny85-nrf24-3pin-ir
http://www.gammon.com.au/interrupts

sch : attiny85 + esp01
http://imgur.com/MooQJV9

@Humancell

This comment has been minimized.

Show comment
Hide comment
@Humancell

Humancell Apr 5, 2016

Thank you for the wealth of links and information. This is exactly what I was looking for. Now I can dedicate an ATtiny85 to be a strictly "interrupt-woken" peripheral that will produce the low-pulse required to wake the ESP-12F. I can then also use the ESP-12F deep sleep timer to wake at regular intervals to produce "heartbeats" from the sensor when the door is open or closed for extended periods.

With your suggestion on pins above, would I be passing the ESP deep sleep sugnal on pin 16 through the ATtiny85 also? Is that what your pin #3 is above? So teh ATtiny85 would wake on either the reed switch to ESP GPIO wake signal?

Humancell commented Apr 5, 2016

Thank you for the wealth of links and information. This is exactly what I was looking for. Now I can dedicate an ATtiny85 to be a strictly "interrupt-woken" peripheral that will produce the low-pulse required to wake the ESP-12F. I can then also use the ESP-12F deep sleep timer to wake at regular intervals to produce "heartbeats" from the sensor when the door is open or closed for extended periods.

With your suggestion on pins above, would I be passing the ESP deep sleep sugnal on pin 16 through the ATtiny85 also? Is that what your pin #3 is above? So teh ATtiny85 would wake on either the reed switch to ESP GPIO wake signal?

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@chaeplin

chaeplin Apr 5, 2016

Contributor

@Humancell I use esp-01 for the circuit. Pin no 3 is used to present state of door to esp GPIO 1(Attiny85 control debounce). As you use ESP-12F, GPIO16 can be used to signal ATtiny85 as your suggestion.

Contributor

chaeplin commented Apr 5, 2016

@Humancell I use esp-01 for the circuit. Pin no 3 is used to present state of door to esp GPIO 1(Attiny85 control debounce). As you use ESP-12F, GPIO16 can be used to signal ATtiny85 as your suggestion.

@Ukritkhonglao

This comment has been minimized.

Show comment
Hide comment
@Ukritkhonglao

Ukritkhonglao Apr 17, 2016

@chaeplin Hi,
Im very new to interrupt function. So Im working on a project with esp12e and want to wake it up wirelessly from deep sleep using RF transmitter.
the RF receiver(SRX882) data pin -> pin3 ATtiny85.
esp12e RST -> pin6 ATtiny85.
So my understanding is that pin 5 and 6 can generate pulse becase they have pwm function? So ATtiny85 will generate pulse to RST of esp12e in order to wake up from deep sleep?

Ukritkhonglao commented Apr 17, 2016

@chaeplin Hi,
Im very new to interrupt function. So Im working on a project with esp12e and want to wake it up wirelessly from deep sleep using RF transmitter.
the RF receiver(SRX882) data pin -> pin3 ATtiny85.
esp12e RST -> pin6 ATtiny85.
So my understanding is that pin 5 and 6 can generate pulse becase they have pwm function? So ATtiny85 will generate pulse to RST of esp12e in order to wake up from deep sleep?

@chaeplin

This comment has been minimized.

Show comment
Hide comment
@chaeplin

chaeplin Apr 17, 2016

Contributor

@Ukritkhonglao
You don't need pwm. A short low pulse will do.

digitalWrite(pin5, LOW);
delay(10);
digitalWrite(pin5, HIGH);
Contributor

chaeplin commented Apr 17, 2016

@Ukritkhonglao
You don't need pwm. A short low pulse will do.

digitalWrite(pin5, LOW);
delay(10);
digitalWrite(pin5, HIGH);
@fjaraujo

This comment has been minimized.

Show comment
Hide comment
@fjaraujo

fjaraujo Jun 28, 2016

Hi @chaeplin, I tried to implement your schemes (your edited version of monostable flip flop and the version in github) and in both cases didn't work. I have used 3904 instead of 4401,... could be by this? Other point is the capacitors... which is the polarity?

thanks in advance for your help

fjaraujo commented Jun 28, 2016

Hi @chaeplin, I tried to implement your schemes (your edited version of monostable flip flop and the version in github) and in both cases didn't work. I have used 3904 instead of 4401,... could be by this? Other point is the capacitors... which is the polarity?

thanks in advance for your help

@joostmarkerink

This comment has been minimized.

Show comment
Hide comment
@joostmarkerink

joostmarkerink Jul 1, 2016

Isn't it easier and more power efficient to let the attiny control the vcc of the esp using a transistor?

joostmarkerink commented Jul 1, 2016

Isn't it easier and more power efficient to let the attiny control the vcc of the esp using a transistor?

@pieman64

This comment has been minimized.

Show comment
Hide comment
@pieman64

pieman64 Jul 29, 2016

@chaeplin I am using D0 for something other than wake from deepsleep. D0 is set to be permanently low for this other function. Is there any way that I can still use D0 to wake from deepsleep i.e. by changing pinMode on the fly or setting D0 high or low just before it goes to sleep? I have tried several combinations but haven't been able to get D0 to be "multi purpose".

pieman64 commented Jul 29, 2016

@chaeplin I am using D0 for something other than wake from deepsleep. D0 is set to be permanently low for this other function. Is there any way that I can still use D0 to wake from deepsleep i.e. by changing pinMode on the fly or setting D0 high or low just before it goes to sleep? I have tried several combinations but haven't been able to get D0 to be "multi purpose".

@cavazorro

This comment has been minimized.

Show comment
Hide comment
@cavazorro

cavazorro Aug 28, 2016

Hello everybody, I'm doing a project where I have several buttons waiting to be pushed, once a button is pushed, I need to send the button number to a server using the ESP8266. I want to have everything sleeping while it is waiting for activity. I like the ATTiny85 option but don't know if I should use it for cutting power to the ESP8266 using a transistor, or if I should use it to wake it up.
Also, if anyone has an idea of how to best wire the buttons so I can send the button number to the ESP8266, it would be greatly appreciated. There are 4 buttons in total.

cavazorro commented Aug 28, 2016

Hello everybody, I'm doing a project where I have several buttons waiting to be pushed, once a button is pushed, I need to send the button number to a server using the ESP8266. I want to have everything sleeping while it is waiting for activity. I like the ATTiny85 option but don't know if I should use it for cutting power to the ESP8266 using a transistor, or if I should use it to wake it up.
Also, if anyone has an idea of how to best wire the buttons so I can send the button number to the ESP8266, it would be greatly appreciated. There are 4 buttons in total.

@dariocdj

This comment has been minimized.

Show comment
Hide comment
@dariocdj

dariocdj Sep 22, 2016

EDIT : OK GUYS I ANSWER :

Hi guys, @chaeplin i've don't understand well some issues :

  1. if i use 48-door-alarm-deepsleep with your resistor and capacitor circuits, you've wrote that you "use modem sleep and light sleep while door is opened".. so you can send a signal when door is opened and closed also, right? if i leave door opened for 1 hour and than i close it, esp wake from modem or light sleep and tell me that is closed, right?

yes

  1. What must be connected to LIGHT SLEEP IN on your circuit ??? is DOOR_INT_PIN 5 of sketch ?

yes but i've used gpio12

  1. GPIO IN is DOOR_PIN 4 of your sketch ?

yes but i've used gpio13

  1. what is the advantage to use attiny85? that esp goes always in deepsleep ? in that case a sketch must be loaded on attiny? where i can find it ?

No idea

  1. In 48-door-alarm-deepsleep circuit, what is the polarity of capacitors ? is it 1MICROfarad or 1NANOfarad?
    is 1000NANO = 1microfarad caps with NO polarity (ceramic 105)

Q3 and E is 2N4401 transistors ?
yes i've used 2n3904

  1. is the edited flip-flop version --> monostable flip flop the last solution ? in that case what sketch must be use ?

used _48-door-alarm-deepsleep

Thanks a lot for your answer and sorry for my bad english and for my useless questions....
Dario

dariocdj commented Sep 22, 2016

EDIT : OK GUYS I ANSWER :

Hi guys, @chaeplin i've don't understand well some issues :

  1. if i use 48-door-alarm-deepsleep with your resistor and capacitor circuits, you've wrote that you "use modem sleep and light sleep while door is opened".. so you can send a signal when door is opened and closed also, right? if i leave door opened for 1 hour and than i close it, esp wake from modem or light sleep and tell me that is closed, right?

yes

  1. What must be connected to LIGHT SLEEP IN on your circuit ??? is DOOR_INT_PIN 5 of sketch ?

yes but i've used gpio12

  1. GPIO IN is DOOR_PIN 4 of your sketch ?

yes but i've used gpio13

  1. what is the advantage to use attiny85? that esp goes always in deepsleep ? in that case a sketch must be loaded on attiny? where i can find it ?

No idea

  1. In 48-door-alarm-deepsleep circuit, what is the polarity of capacitors ? is it 1MICROfarad or 1NANOfarad?
    is 1000NANO = 1microfarad caps with NO polarity (ceramic 105)

Q3 and E is 2N4401 transistors ?
yes i've used 2n3904

  1. is the edited flip-flop version --> monostable flip flop the last solution ? in that case what sketch must be use ?

used _48-door-alarm-deepsleep

Thanks a lot for your answer and sorry for my bad english and for my useless questions....
Dario

@dariocdj

This comment has been minimized.

Show comment
Hide comment
@dariocdj

dariocdj Sep 22, 2016

Guys, someone has implemented a working circuit to wake esp on reed open or close? with attiny or with R/C/TR circuit ?

dariocdj commented Sep 22, 2016

Guys, someone has implemented a working circuit to wake esp on reed open or close? with attiny or with R/C/TR circuit ?

@oriolrius

This comment has been minimized.

Show comment
Hide comment
@oriolrius

oriolrius Sep 25, 2016

@chaeplin @dariocdj Hi Dario, I'm also interested on your previous questions. Have you found any answer to them? I'm very interested on implementing R/C/TR circuit but I have the same stoppers like you.

Regards and thanks guys for so interesting thread.

Oriol

oriolrius commented Sep 25, 2016

@chaeplin @dariocdj Hi Dario, I'm also interested on your previous questions. Have you found any answer to them? I'm very interested on implementing R/C/TR circuit but I have the same stoppers like you.

Regards and thanks guys for so interesting thread.

Oriol

@dariocdj

This comment has been minimized.

Show comment
Hide comment
@dariocdj

dariocdj Sep 28, 2016

@oriolrius no sorry, i'm searching for an answer yet...... please update this post if you understand the right way...

dariocdj commented Sep 28, 2016

@oriolrius no sorry, i'm searching for an answer yet...... please update this post if you understand the right way...

@oriolrius

This comment has been minimized.

Show comment
Hide comment
@oriolrius

oriolrius Sep 28, 2016

@dariocdj I decided to start trying with ATTiny85 based solution because it seems better IMHO. I don't like to implement logic using passive electronics. I prefer to have a master-slave configuration based on two MCU. I don't expect having anything done before a month because I have other priorities. Anyway when I finish that I'll publish my solution on my blog page (http://oriolrius.cat).

Regards.
Oriol

oriolrius commented Sep 28, 2016

@dariocdj I decided to start trying with ATTiny85 based solution because it seems better IMHO. I don't like to implement logic using passive electronics. I prefer to have a master-slave configuration based on two MCU. I don't expect having anything done before a month because I have other priorities. Anyway when I finish that I'll publish my solution on my blog page (http://oriolrius.cat).

Regards.
Oriol

@avolag

This comment has been minimized.

Show comment
Hide comment
@avolag

avolag Nov 7, 2016

Dear all, thanks a lot for your information. I'm really new on esp programming. I have a question: To record temperature data every a known interval of time, the dsleep() function is perfect (connecting GPIO16 to the RESET). But I also need to acquire data from a rain gauge (that have a reed switch). But I don't understant how I can do it. I want use reed input as external trigger as interrupt, so when the rain activate the reed, it can reset the ESP, without wait the RTC set time. Even more obscure for me, the possibility to use RTC memory to store data. Rain data could be stored in the RTC memory and send it when the ESP wake from deepsleep. Do you have same advice?

avolag commented Nov 7, 2016

Dear all, thanks a lot for your information. I'm really new on esp programming. I have a question: To record temperature data every a known interval of time, the dsleep() function is perfect (connecting GPIO16 to the RESET). But I also need to acquire data from a rain gauge (that have a reed switch). But I don't understant how I can do it. I want use reed input as external trigger as interrupt, so when the rain activate the reed, it can reset the ESP, without wait the RTC set time. Even more obscure for me, the possibility to use RTC memory to store data. Rain data could be stored in the RTC memory and send it when the ESP wake from deepsleep. Do you have same advice?

@Marmachine

This comment has been minimized.

Show comment
Hide comment
@Marmachine

Marmachine May 3, 2017

@chaeplin you inspired me, thanks for sharing your info!

I want to trigger a wake up by a PIR sensor, but only when in deep sleep.
I think the situation is quite similar to the above, although the PIR gives a (2.2V HIGH) signal instead of the magnetic switch in the door sensor.

So i came up with the idea to use a relay and i think that my below scheme could work. It's still a draft though, i haven't got all the parts yet to setup a test, but maybe someone already has some ideas or suggestions regarding this? I'm no expert in electronics so i could be disapointed when i put this all together!?

esp8266_pir_relay_schematic_schema

Marmachine commented May 3, 2017

@chaeplin you inspired me, thanks for sharing your info!

I want to trigger a wake up by a PIR sensor, but only when in deep sleep.
I think the situation is quite similar to the above, although the PIR gives a (2.2V HIGH) signal instead of the magnetic switch in the door sensor.

So i came up with the idea to use a relay and i think that my below scheme could work. It's still a draft though, i haven't got all the parts yet to setup a test, but maybe someone already has some ideas or suggestions regarding this? I'm no expert in electronics so i could be disapointed when i put this all together!?

esp8266_pir_relay_schematic_schema

@tbalon

This comment has been minimized.

Show comment
Hide comment
@tbalon

tbalon Jul 10, 2017

I had good success simply controlling power to the ESP8266. My sensor used a LiPo battery with a boost/buck regulator that had an enable pin. I used the regulator enable as a power switch to the ESP01. In my case, I used a normally open reed switch connected to an ATiny85 which was in sleep mode. When the switch closed, it grounded a pin on the ATiny generating an interrupt. The ATiny then enabled the regulator which in turn starts up the ESP01. The ATiny85 only uses a few uA in sleep mode, the Microchip regulator only uses 2 uA in standby... I'm using a 400ma LiPo and a supercap to off load in-rush current during startup. I configured the ESP01 to use N-mode wifi to limit power to 120ma during posts. I removed the power led from the ESP01 as well.

At power-on, the ESP01 sets its GPIO_0 high to indicate it's busy. It then reads the door state on its RX pin and posts json updates. Once its all done it goes into deep-sleep which causes GPIO_0 low. The ATiny detects this and shuts off power and goes back into sleep. A watchdog on the ESP01 forces a deep-sleep after 15 seconds in case it cannot associate with the AP or the door is propped open.

dooralarm_schematic

tbalon commented Jul 10, 2017

I had good success simply controlling power to the ESP8266. My sensor used a LiPo battery with a boost/buck regulator that had an enable pin. I used the regulator enable as a power switch to the ESP01. In my case, I used a normally open reed switch connected to an ATiny85 which was in sleep mode. When the switch closed, it grounded a pin on the ATiny generating an interrupt. The ATiny then enabled the regulator which in turn starts up the ESP01. The ATiny85 only uses a few uA in sleep mode, the Microchip regulator only uses 2 uA in standby... I'm using a 400ma LiPo and a supercap to off load in-rush current during startup. I configured the ESP01 to use N-mode wifi to limit power to 120ma during posts. I removed the power led from the ESP01 as well.

At power-on, the ESP01 sets its GPIO_0 high to indicate it's busy. It then reads the door state on its RX pin and posts json updates. Once its all done it goes into deep-sleep which causes GPIO_0 low. The ATiny detects this and shuts off power and goes back into sleep. A watchdog on the ESP01 forces a deep-sleep after 15 seconds in case it cannot associate with the AP or the door is propped open.

dooralarm_schematic

@devyte

This comment has been minimized.

Show comment
Hide comment
@devyte

devyte Oct 18, 2017

Collaborator

Interesting discussion, but closing per #3655 .

Collaborator

devyte commented Oct 18, 2017

Interesting discussion, but closing per #3655 .

@devyte devyte closed this Oct 18, 2017

@HobbytronicsPK

This comment has been minimized.

Show comment
Hide comment
@HobbytronicsPK

HobbytronicsPK Feb 8, 2018

If someone is looking for waking ESP8266 from deepsleep with multiple buttons interrupt, have a look on to the following link.
Wake ESP8266 by input signals during Deep Sleep the same way as Pin Change Interrupts

HobbytronicsPK commented Feb 8, 2018

If someone is looking for waking ESP8266 from deepsleep with multiple buttons interrupt, have a look on to the following link.
Wake ESP8266 by input signals during Deep Sleep the same way as Pin Change Interrupts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment