Smart Home & Building Mechatronics · Intermediate · Low power

ESP8266 Deep-Sleep Mailbox Notifier

A battery node that reports only when a switch closes, and sleeps the rest of the time.

Firmware status: Generated from this project's own pin map and compiled with arduino-cli for esp8266:esp8266:nodemcuv2 before publication; bench validation on your hardware is still required.

Board: ESP8266 (NodeMCU v3 / Wemos D1 mini) · ESP8266EX @ 80 MHz · 3.3 V logic · build for esp8266:esp8266:nodemcuv2.

What you will build

An ESP8266 woken by a reed switch on a mailbox door, reporting the event and sleeping until the next one.

Components

  • ESP8266 board with RST wired to GPIO16 for deep sleep
  • Reed switch and magnet
  • 18650 cell with a protection board
  • Jumper wire from GPIO16 to RST

Pin map for this build

Sketch constantPinWhat it is
PIN_SENSEA0Sensor — analog output, 3.3 V maximum
PIN_STATUS_LED5Status LED — with 220 Ω series resistor

Tools

  • USB programming cable
  • Multimeter
  • Current-limited bench supply (for anything that switches a load)
  • Small screwdriver and wire cutters

Build sequence

  1. Wire GPIO16 to RST — without it the board cannot wake itself.
  2. Test the reed switch with a multimeter before trusting it.
  3. Flash, close the switch, and watch one report appear.
  4. Leave it overnight and count the reports against how many times the door actually opened.

Test and expected result

One report per event, no reports while the door is closed, and the board survives a week on the cell.

Acceptance checks

one report per event, no false reports, survives unattended

Safety and limits

The 3.7 V cell must go through a regulator to the board, and the board needs its deep-sleep wiring correct or it will never wake.

Hardware scope

Deep sleep on ESP8266, GPIO16 wake, event-driven reporting.

Connection diagram

Connection diagram for ESP8266 Deep-Sleep Mailbox Notifier

Download the connection diagram (SVG)

Download the Arduino sketch (E16_esp8266_deep_sleep_mailbox_notifier.ino)

Guide source: the sketch on this page was generated from the pin map above and compiled for esp8266:esp8266:nodemcuv2 before publication.

Related projects

Back to all project guides · Study the course