This is a simple body for a DIY sensor to detect the presence/absence of AC 220V.
- It uses one OP22B01 5V board and one Zigbee door sensor.
- It is designed to be used on a DIN rail.
- Sizes: 20mm x ~56mm x ~78mm.
Be careful while working with high voltage!
Components:
- OP22B01 5V board.
- Tuya ZigBee door and window magnetic sensor (iH-F001).
- Two wires.
How it works:
Whenever AC 220V is present between L and N on the OP22B01 board, the resistance between GND and OUT will change from infinity to ~120Ω.
The ZigBee door sensor (iH-F001) has a magnetic reed switch inside, which can be bypassed by connecting any other switch to its contacts.
- By connecting GND and OUT from the OP22B01 board to the contacts of the magnetic reed switch inside the door sensor, we can detect the presence/absence of AC 220V.
How to build it:
- Print all parts.
- Glue the back part (AC_sensor_back) to the main part (AC_sensor).
- Open the door sensor, solder wires to the magnetic reed switch, drill a hole for the wires, assemble it, and check if it works correctly.
- Guide the wires through the hole from the compartment for the door sensor to the compartment for the OP22B01.
- Put the door sensor inside and close the compartment.
- Connect the wires to GND and OUT on the OP22B01 board and place the board inside the compartment. Close the compartment.
- Done.
Notes:
- It was created to be used with Home Assistant to detect the presence/absence of AC 220V on the main power line, allowing smart sockets to be turned ON/OFF when the home is using a backup power source.
- Why? To have two or more devices that can detect a power blackout event and help me save my batteries and inverter.
- There is also a ZigBee smart circuit breaker (TO-Q-SY2-163JZT) configured to update voltage information as soon as possible. It updates this information even after it loses power because ZigBee is a low-power device, and there is enough charge on the capacitors to send the info.
- The 120Ω resistance creates no issues for the door sensor, and it works fine with it.