Did I close the gate?
Two reed switches and a magnet on the gate give you four states, not two: closed (the closed switch is active), open (the open switch is active), moving or in between (neither), and a fault if it stays in between longer than the gate needs to travel. The ESP32 reports them and tells you when the gate has been open for ten minutes.
The relay and the security
Most openers have a low-voltage input for a push button. A relay in parallel with that button, pulsed for a few hundred milliseconds, is all it takes. Never connect it to the mains side of the opener. But a remote "open" command is an access control system, so treat it as one: strong authentication, no direct exposure to the internet, preferably through a VPN or a platform with two-factor sign-in.
- Report the status before acting, so you never open a gate that you cannot see.
- Use a separate "close" pulse if your opener supports it; a single toggle button does the opposite of what you expect half the time.
- Fix magnets firmly and leave a few millimetres of gap; gates shake, and misaligned reeds produce false states.
Components
- ESP32-C3 SuperMini
- Reed switch + magnet (door sensor) × 2
- Relay module 1-channel 5V (opto-isolated)
- USB charger 5V 2A
- Dupont jumper wires (M-F, M-M)
Comments
No comments yet. Share your experience or ask a question.