Ultra Low Power Trigger Sensor Using ESP8266

by MrDIYLab in Circuits > Sensors

11087 Views, 56 Favorites, 0 Comments

Ultra Low Power Trigger Sensor Using ESP8266

trigger sensor Copy.png

In this project, I will show you how you can use an ESP8266, ATtiny and ESPNOW to build battery-based, low-cost, real-time, ultra-low-power trigger sensor to monitor doors and motion or make it act as a wall switch. It uses microAmps while in standby and has a trigger time of 240ms.

Part 2: The Build - https://youtu.be/LbGGeREwECc

Part 3: The Hub - https://youtu.be/VyVaxvgBpEU

New to ESP8266? Watch my Introduction to ESP8266 video.

Watch the Video

Ultra Low Power WiFi Trigger Sensor using ESP8266 - Introduction (DIY Project #6)

The video has step-by-step instructions that will guide you through the design. Feel free to add your questions in the comment section of the YouTube video if you need any futher assistance.

Order the Components

Amazon.com:

- Wemos d1 mini (4M version) - https://amzn.to/3bqzb2c
- ESP-01 module - https://amzn.to/356vxb1
- ESP-12F module - https://amzn.to/2GZUEVf
- ATtiny13a - https://amzn.to/2GYKXGx
- NPN kit - https://amzn.to/37eclLb

AliExpress:

- Wemos d1 mini (4M version) - https://s.click.aliexpress.com/e/_dXcNTYU
- ESP-01 module with programmer - https://s.click.aliexpress.com/e/_eNOrzT
- ESP-12F module - https://s.click.aliexpress.com/e/_etRdC1
- ATtiny13a (DIP) - https://s.click.aliexpress.com/e/_ePqoLb
- ATtiny13a (SMD) - https://s.click.aliexpress.com/e/_eO8tTP
- NPN kit - https://s.click.aliexpress.com/e/_eOhevR

Amazon.ca:

- Wemos d1 mini (4M version) - https://amzn.to/3fx28Lq
- ESP-01 module with programmer - https://amzn.to/3kaGfnh
- ESP-12F module - https://amzn.to/356vewT
- ATtiny13a - https://amzn.to/37epB2t
- NPN kit - https://amzn.to/3dALmuH

-- LINKS -- (When available, I use affiliate links and may earn a commission)

The Sensor

schematic.png
sensor-1.png
snesor-2.png
sensor-parts.png
power consp.png

The sensor contains an ATtiny that listens to interrupts from an external device like a reed switch, a motion sensor or a toggle switch.

After an interrupt, it wakes up and powers up the ESP8266. The ESP8266 reads the new switch state and the battery voltage and sends them over to the hub using ESPNOW. When it is done, it signals the attiny. The ATtiny then turns off the ESP8266 and goes back to sleep.

While in standby mode, the ATtiny is in power-down mode consuming around 0.15 uA and the ESP8266 is off.

In active mode, the ATtiny consumes 1.2mA and the ESP8266 averaging around 50mA with a very short 400mA spike. The active mode lasts for 240ms.

The PCB version, made using a pcb manufactorer in China called PCBWay, turns out pretty good and is very compact.

The Hub

hub.png
sensors.png
ui.png

Inside the hub, there are 2 Wemos D1 minis. The first one acts as a receiver for ESPNOW. It passes the information it receives to the second D1 mini.

The second D1 mini uses this information to push the sensor's data to an MQTT server over a unique topic per sensor. This unique topic is created using the sensor MAC address.

The Code

code.png

All my work has been published on my GitLab repo:

If you are interested in building this, you can watch my video here.

I plan on revisiting the power management for the ESP8266 as I have been using a Lipo battery directly. So stay tuned!

Done

That is all! You can now build an ultra low power trigger sensor using common components and integrate it with your favorite home automation system. The common 3.7 Lipo battery should last you months if not years.

If you found this useful, please consider subscribing to my YouTube channel and if you are interested in supporting my work, you can check my Patreon page. Follow me on Twitter.

** Much of the information contained is based on personal knowledge and experience. It is the responsibility of the viewer to independently verify all information.