So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Glorifiedg
#79505 Hi guys, noob here!

I've searched for something like this but didn't found anything exactly like this.

I want to build a mail sensor with esp8266 and a Reed switch that, when the mail door is opened, sends an mqtt message to a broker. I wander of this can use the deepsleep mode everyone is talking while not "open" so I can spare the powerbank battery.

Thanks!
User avatar
By QuickFix
#79526
  • Take a schematic like this
    MomentaryESPSchematic.png
  • Connect switch "SW1" (the reed switch) to the door
  • Write code that does the following:
    • Boot
    • Make GPIO2 LOW to hold the MOSFET
    • Make contact to AP and MQTT broker
    • Send "Door opened"-message to broker
    • Make GPIO2 HIGH to power the circuit off
You do not have the required permissions to view the files attached to this post.
User avatar
By btidey
#79544 My take on this is at https://github.com/roberttidey/SecuritySensor

The Schematic_SecuritySwitchSchematic.png has the hook up.

This uses a normally closed contact. When opened the device wakes up via EN going high. A GPIO is set to maintain the EN. It then performs any actions, releases the GPIO holding EN and returns to deep sleep.

Background current is deep sleep + quiescent of LDO regulator. Although not the zero current obtained by using a MOSFET in power line, it still gives me over a year of operation using a modest LIPO.
User avatar
By QuickFix
#79547
btidey wrote:Although not the zero current obtained by using a MOSFET in power line, it still gives me over a year of operation using a modest LIPO.

I might have interest in this approach for one of my projects.
Do you have an estimate of the quiescent current in sleep mode, I'm assuming the 400mA LiPo in your schematics is not what you mean by "Modest". ;)