Page 1 of 1

DYI Xiaomi Binary Contact Sensor

Posted: Tuesday 30 October 2018 11:31
by ben53252642
My DYI Xiaomi Binary Contact Sensor using an off the shelf Xiaomi Aqara Door Sensor

Final product, when wires touch contact is reported as "true" by the sensor, when wires are not touching it reports "false".

Photos go over a few posts due to the attachments limit.

1) Open Case
20181030_204026.jpg
20181030_204026.jpg (310.34 KiB) Viewed 2885 times
2) Remove the sensor from case
20181030_204107.jpg
20181030_204107.jpg (331.12 KiB) Viewed 2885 times
3) Remove the magnet sensor from the board
20181030_204153.jpg
20181030_204153.jpg (328.67 KiB) Viewed 2885 times

Re: DYI Xiaomi Binary Contact Sensor

Posted: Tuesday 30 October 2018 11:32
by ben53252642
4) Solder wires to each terminal the magnet sensor was attached to (remove the battery first for safety)
20181030_205838.jpg
20181030_205838.jpg (279.3 KiB) Viewed 2883 times
5) Drill holes for the wires on the side of the case
20181030_210825.jpg
20181030_210825.jpg (219.33 KiB) Viewed 2883 times
6) Re-assemble case and install the battery
20181030_211628.jpg
20181030_211628.jpg (245.48 KiB) Viewed 2883 times

Re: DYI Xiaomi Binary Contact Sensor

Posted: Tuesday 30 October 2018 11:37
by ben53252642
7) Product re-assembled ready for use, looking very professional! 8-)
20181030_213617.jpg
20181030_213617.jpg (257.14 KiB) Viewed 2878 times
8) Connected it to a magnetic reed switch, working nicely
20181030_214641.jpg
20181030_214641.jpg (321.84 KiB) Viewed 2865 times
9) I'm using Zigbee2MQTT and Node-Red to use the sensor with Domoticz via MQTT, here is a screenshot of Node-Red output when I move the magnet to and away from the switch.
node-red zigbee2mqtt output.JPG
node-red zigbee2mqtt output.JPG (73.75 KiB) Viewed 2864 times

After some time (about an hour for me) sensor also start reporting battery level which is nice feature.

Code: Select all

payload: "{"contact":true,"linkquality":70,"battery":"100.00","voltage":3055}"

Re: DYI Xiaomi Binary Contact Sensor

Posted: Thursday 04 April 2019 13:26
by Thuis
I'm curious, what is the purpose of doing this ? You take the functionality of the sensor put wires on it and have the same functionality.

Re: DYI Xiaomi Binary Contact Sensor

Posted: Thursday 04 April 2019 13:33
by LouiS22
Thuis wrote: Thursday 04 April 2019 13:26 I'm curious, what is the purpose of doing this ? You take the functionality of the sensor put wires on it and have the same functionality.
+1, really don't understand this :)

Re: DYI Xiaomi Binary Contact Sensor

Posted: Thursday 04 April 2019 14:05
by ben53252642
My application has 6 binary sensors in a series circuit. If any of the 6 cupboard doors are opened the circuit breaks and the binary switch is triggered.

It just turns on a light in the cupboards so makes no sense to use 6 separate battery powered sensors.

Re: DYI Xiaomi Binary Contact Sensor

Posted: Thursday 04 April 2019 18:13
by hoeby
Maybe his example is not the best. To modify it and an other door sensor.

But this is a nice example how to make an input device which could be connected to do domiticz.
Maybe jou have a device with an output which couldn't be connected to domoticz. Using this modified door sensor, it could be possible