0
\$\begingroup\$

Hey all I am trying to see how long I can possibly have a ESP8266 ESP-07 operate with only 1 or 2 of the Lithium Ion Battery 18650 Cell which claims to have 2600mAh.

I am making a window alarm sensor and I'm looking to incorporate a window reed switch in order to check it's status via the ESP8266 and if its opened (meaning the window is not closed) then send something via WIFI to a REST service. Likewise, if the reed switch is not opened (meaning the window is fully shut) then sleep.

The flow with only ESP-07 would look something like this:

1: Power up for the first time.

2: Send Date/Time, window closed or opened, etc.. via ESP-07 WIFI to the REST service.

3: Have the ESP-07 go into deep sleep mode.

4: Wake up from sleep after 1 minute.

5: Check window reed switch.

5: If reed switch is open then send REST service via ESP-07 WIFI.

7: Goes back into deep sleep mode.

8: Loop back to #4.

The flow with ESP-07 & ATTiny85 would look something like this:

1: Power up ESP-07/ATTiny85 for the first time.

2: Send Date/Time, window closed or opened, etc.. via ESP-07 WIFI to the REST service.

3: Have the ESP-07 go into deep sleep mode.

4: Have ATTiny85 check every 30 seconds for window reed switch status.

5: If reed switch is open then send REST service via ESP-07 WIFI.

6: ESP-07 goes back into deep sleep mode.

7: Loop back to #4.

It would seem that using the ESP8266 along side an ATTiny85 would make it last longer since I could check the status of the reed switch via the ATTiny85 and if it see the window closed then pause and check it again in 1 minute. If the ATTiny85 does see the reed switch opened then start up the ESP8266 and send the info via WIFI then go back into deep sleep. However, I am not sure how this would be on the battery side of things - if it would be less or same or more.

I'm looking to see how long 1 and/or 2 of the Lithium Ion Battery's would last (in days) with using just the ESP-07 and also using both the ESP-07 and the ATTiny85 as explained above.

I've done some googling and found a few websites that show how to put the ESP-07 into deep sleep mode but really wouldn't say how long it would take with my setup above. Most were using standard AA or AAA batteries.

The overall goal is: Have the window alarm power last at least 1 year.

The items:

enter image description here

Datasheets:

Lithium Ion Battery 18650 Cell

ATTiny85

Window Reed Switch (Generic) or Mouser (Generic)

ESP8266 ESP-07

The battery ESP-07 consumption chart I found:

enter image description here

\$\endgroup\$
  • 2
    \$\begingroup\$ Photos of your components are no help...provide links to datasheets. Tell us what percentage of time your device is active, not just a vague description of what it does while it is awake. Also, it sounds like someone can rob your place if they just open the window, climb in, and close the window within 30 seconds. \$\endgroup\$ – Elliot Alderson Jul 31 '18 at 18:06
  • \$\begingroup\$ @ElliotAlderson added that info. Thanks for the suggestion. \$\endgroup\$ – StealthRT Jul 31 '18 at 18:22
  • \$\begingroup\$ A year (365 days of 24 hours) has 8760 hours. If your device needs 1 mA, your battery should have more than 8.76 Ah. Your 2600 mAh battery current should be less than 297 µA. But self discharge of battery should be regarded too. \$\endgroup\$ – Uwe Jul 31 '18 at 18:32
3
\$\begingroup\$

If you are using ATTiny then you don't need to put ESP to sleep mode. You can disconnect power from it altogether using MOSFET or power management IC.

Now, ATTiny85 is not the best choice for low-power application. ATMega328P can run on button cell for a year.

Also the rechargeable lithium battery is really bad choice for this application too. You'd need voltage sensing circuit and cut-off to avoid damaging the battery. And if it is activated then you have no alarm at all. The better choice would be either alkaline or non-rechargeable lithium.

UPDATE

Finally, what's to stop hypothetical robbers from closing the window/door behind? If you only check once a minute there is a possibility that alarm won't be triggered at all.

Better option is to use NC reed switch. Then the voltage on the line can be used as wake up interrupt, so your MCU can sleep indefinitely, or wake up once a week (if you can find suitable ultra low power timer) to check battery voltage. I suspect with this setup battery can last for many years.

Furthermore, if you use timer chip with manual input you can connect your sensors to that input and connect power switch to timer output. Then you wouldn't need second MCU at all.

\$\endgroup\$
  • \$\begingroup\$ I'm not sure that disconnecting power to the ESP is a good idea. It would need to reboot, reconnect to the access point and reauthorize, which may take more energy than staying in sleep mode for a minute. \$\endgroup\$ – Elliot Alderson Jul 31 '18 at 18:43
  • \$\begingroup\$ @ElliotAlderson Who said anything about a minute? I suggested that it can be disconnected all the time, powering up only when break-in detected, i.e. hopefully never \$\endgroup\$ – Maple Jul 31 '18 at 21:16
  • \$\begingroup\$ The OP, in the first scenario, step #4 says: "Wake up from sleep after 1 minute." Perhaps you misunderstood the plan...the OP wants to poll the reed switch in a loop. My comment was with respect to your original answer and the OP's original question. \$\endgroup\$ – Elliot Alderson Jul 31 '18 at 21:30
  • \$\begingroup\$ @ElliotAlderson The second scenario: "Have ATTiny85 check every 30 seconds for window reed switch status." My original answer begins: "If you are using ATTiny...". I believe I understood everything just fine. \$\endgroup\$ – Maple Jul 31 '18 at 21:45
  • \$\begingroup\$ Well I guess 30 seconds is still not "all the time", so my original comment seems to remain valid. Please note that I did not insist that you were incorrect. I said I was "not sure" and "may take more energy". It was an invitation to clarify and discuss your answer. \$\endgroup\$ – Elliot Alderson Jul 31 '18 at 23:13

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.