Here’s a fairly simple project: we have a standard home alarm system, and I wanted Home Assistant to know when it was armed.
I discovered that one of the several programmable outputs inside its control box is configured by default to show when the system is armed. Another shows whether an intruder is detected, and I thought it would be fun to add that as well. These are the kinds of outputs designed to flash lights, ring bells or lock doors, not really to be connected to home automation systems.
So I made up a little board, which eventually I’m going to package up properly! At the moment, the components are just bolted to a bit of artist’s mounting board.
The basic idea is that an ESP8266 (in the form of a NodeMCU in the top right corner) will read the outputs from the alarm. These normally float at 12v or so, and are pulled low when there’s an output, so I needed to convert those into values the ESP8266 could read, and I wanted to keep reasonable isolation between the two systems to avoid either one doing something unfortunate to the other!
My friendly alarm guy pointed out, on his last visit, that the controller box has a 12v supply for auxiliary devices, so you can connect a relay between this and one of the outputs, and the relay will close when there’s a signal. OK - I had a couple of ideal small relay boards (the green things at the bottom), and, sure enough, they seemed to work fine.
Now, I also had to power the NodeMCU, and I wanted to do that from the alarm’s aux supply as well. I measured the supply, and it was giving more like 13V. The NodeMCU has a voltage regulator on board which can, in theory, take up to 20V, but they don’t recommend you run it at more than 12V, so I thought I’d put a regulator in so as not to stress anything. I already had some little LM2596-based voltage step-down modules, which I bought once because they were cheap (about £1.30) and looked as if they might be useful. I adjusted one to give about 6V, and that’s in the top-left, powering the NodeMCU.
Finally, I needed the signal inputs to the NodeMCU board to be at 3.3V. Fortunately, when you give the NodeMCU power, its on-board regulator will produce this on one of the pins. So each of the relays has its normally-open terminal connected to 3.3V and its normally-closed terminal connected to ground. The ‘common’ terminal of the relay switch therefore gets 3.3V when the alarm outputs a signal, and 0V when it doesn’t.
I then just used ESPHome to program the NodeMCU and sure enough, everything worked beautifully. This was my first experiment with ESPHome and I was thoroughly impressed. It won’t be my last!
Now when my wife asks, “Did you remember to set the alarm?”, I can reply with confidence!
Hope that’s useful to someone!
Quentin