Ultra Low Power Contact Sensor Using ESP8266 (Version 3)

by MrDIYLab in Circuits > Wireless

1763 Views, 2 Favorites, 0 Comments

Ultra Low Power Contact Sensor Using ESP8266 (Version 3)

version3.png

This is an overview article about version 3 of my ultra-low power battery-based door/window sensor.

New to ESP8266? Watch my Introduction to ESP8266 video.

Watch the Video

Contact Sensor 3 - my ultra-low power wireless sensor

The video walks through the changes from version 3. Feel free to add your questions in the comment section of the YouTube video if you need any further assistance.

Contact Sensor

verionss.png

This sensor came a long way. It started out as prototype on a perf board and slowly got improved, optimized and made more efficient. And for the first time, following your requests, I am making it available on my shop.
So what is it and what is new to version 3?

The wireless contact sensor is an ultra-low power ESP8266-based door and window sensor. It is capable of reporting the status of a door, for example, to an MQTT server in real time, using a hub. This allows for instant reaction like turning on a light as soon as a door is open. A small battery can last for years and allows for tens of thousands of status updates on a single charge.

Built-in Battery Charger

schematic.png

So what is new to V3? To start, it has a brand new built-in battery charging circuitry. The battery can be left in the sensor and charged using a USB cable. A new LED is used to show the charging status. It stays on while charging and goes off when it is fully charged.

Shopping for the battery charger IC?


The links above are usually affiliate links that support this publication (no additional cost for you).

JST PH2.0 Plug

PH20.png
battery.png
battery wires both ways.png
battery standards.png

A second change, also related to the battery, is the plug. I switched from using two pin headers to a proper battery plug - the PH2.0. This allows for a more secure connection to a Lipo battery. As a bonus, it is non-reversable, so in theory, it should provide reverse polarity protection but I will come back to this a little later.

I was surprised when I started buying the batteries for the sensor. I was under the impression that whole point of creating a non-reversible port is to force the polarity but to my surprise I found the batteries don’t have wiring standards. There are batteries that have the red wire on the left and others on the right. So pay attention to the polarity of the battery before you plug it in. Luckily, the plug is easy to modify so swaping the wires was simple.

USB-C Port

usbc.png

The third change was adding a USB-C port for power. I initially wanted to use a USB micro, but with the increased popularity of the USB-C, I went ahead with it - even though it has a bigger footprint.

Programmer Header

programmer.png
rts dtr.png

The fourth change was the introduction of a new programming header. A not very commonly known fact about these FTDI adaptors is if you use the side pins, which include the DTR and RST pins, you can automate the process of putting the ESP in programming mode and flashing it without pressing any buttons. This simple PCB can be soldered to an FTDI adaptor eliminating manual wiring and making flashing the sensor simple. And since this is an incremental upgrade, I carried over the rest of the design elements from version 2 like the microswitch , the detachable battery and the LDO.

I’m happy to report that with the added hardware, the battery life stayed the same. The new sensor still idles at a single digit uA and the trigger time is still pretty fast.

The Hub

espnow code.png
hub.png

If you are using my hub or at least my hub code, then this sensor should work right out of the box. However, I made a small modification I want to mention. I changed how the EPSNow messages are sent. I used to simply broadcast the packages but now I am using an emulated address. This has the extra benefits of using the built-in acknowledgements and retries in the ESPNow protocol while keeping the sensor auto-discoverable by the hub.

pcb.png

A shoutout to PCBWay for sponsoring this article. If you are a hobbyist and in the market for PCBs, I highly encourage you to give them a visit. Get 10 PCBs for $5 USD at https://www.pcbway.com

Conclusion

This wraps up the new contact sensor and its new design elements. In future articles, I will dig a bit more into the sensor, introduce a minimalistic hub and show how the sensor can be used without a hub.

Links:

If you found this useful, maybe consider visiting my YouTube channel and say hello. I will be posting future updates about this project.