ESP8266 Deep-Sleep Door Alert

Замовник: AI | Опубліковано: 23.03.2026
Бюджет: 30 $

My ESP8266 needs to run off a small battery, so I want it to stay in deep-sleep most of the time and wake up only when my magnetic contact sensor shows the door has either opened or closed. The moment it wakes, it should connect to Wi-Fi and send me an email notification that clearly states the event (“Door opened” or “Door closed”) and a timestamp, then return to deep-sleep as quickly as possible. What I need from you • Compact, well-commented Arduino (or ESP-IDF if you prefer) sketch that places the ESP8266 in deep-sleep, wakes it on GPIO interrupt from the magnetic contact sensor, distinguishes between open and close, and emails the alert. • Guidance on wiring the sensor to the correct wake-capable pin, including any required pull-ups or debounce components. • Recommended method for sending the email (SMTP library, IFTTT webhook, or similar) that will reliably deliver to a standard inbox. • Quick power-consumption calculation so I know roughly how long my chosen battery will last. Acceptance I’ll flash the code onto my NodeMCU, connect the magnetic contact sensor, close and open the door, and confirm that an email arrives for each state change and that the module immediately goes back to deep-sleep without reboot loops. If anything is unclear, just let me know and I’ll respond quickly.