The main goal for this project: never leave my flat while a window is opened
I started with a reed contact switch installed on a side of my window with a Atmel 328p and a RFM69 433 Mhz chip. After some time I had the idea to read the state of the window directly on the handle. Also the 433 Mhz was not reliable and I wanted to switch to wifi. After picking a ESP32-WROOM I discovered the brand new ESP32-S2.
This project has two pcbs. The "sensor" pcb is installed into the case. This sensor pcb has only a thickness of 0.6 mm. These sensor pcb is only equipped with three Infineon TLE4913 hall sensors.
The square bolt of the handle has a inlay with three magnets:
The magnets drive over the three hall sensors if the handle (square bolt) moves. The TLE4913 hall sensors have a open drain output which is connected to the controller pcb.
The controller pcb has a ESP32-S2-WROOM, three LEDs to display the state of the window. If the sensor does not identify a known position (e.g. the handle is between open and closed) a blue LED will light up and inform the user.
The controller pcb has also a voltage divider to check the battery. On every change of the window the battery voltage will be measured and send via MQTT.
If the window was not used within 24 hours the ESP32-S2 will wake up and send the battery voltage and the state of the window via MQTT and go back to sleep.
This feature allows your home automation software to inform you, if the sensor has not reported within 24 hours.
The controller pcb is also equipped with a XC6220 LDO with 3.0 volts, currently I'm using a 800mAh LiPo. While in deep sleep the devices consumes 100 µA.
My first sensor is conncted to my OpenHAB installation. I'm providing configuration examples in the GitHub repository.
The case was designed using OpenSCAD. A stl is available inside the GitHub.
Comments