Connect wired alarm system sensors to SmartThings with a NodeMCU ESP8266 [deprecated]

403 error usually means a problem with your OAuth token. Check that you’ve upload the OAuth token correctly in credentials.lua.

My relay just came in the mail, I was going to hook it up, but am having a little difficulty understanding how it gets hooked up.

I’ve totally removed my alarm panel PCB and just have the esp8266 set up, powered by a 12v 800ma wall wart. It would be awesome to be able to run the alarm right off the base, but in case I can’t do that, I do have another 12v 1a wall wart that is currently powering the alarm (using a wemo).

So, VCC goes to 3v3 on base, IN goes to the GPIO pin, and GND goes to ground. Here’s where I need some help. What goes into NO, NC, and COM? I’m guessing that NO goes to red and COM goes to black? Could my alarm hook right into the base? Thanks!

Hey @Sparticuz yes, you can hook it all to the base. Your siren/alarm likely requires 12V of power, which you are providing to the NodeMCU base via your wall-wart. The pins on the bottom left of the NodeMCU base labeled VI near where your wall-wart is plugged in will output 12V.

You’ll connect a wire from VI-GND directly to the black wire of your siren/alarm.
Then connect a wire from VI (12V+) to COM on the relay.
Connect a wire from NO on the relay to the red wire of your siren/alarm.
NC is not used.

The way this works, when the relay is triggered, a circuit is completed between COM and NO, allowing the 12V+ power to travel through to the siren.

1 Like

Ahh, my siren went off at 1 in the morning after a power outage. It’s hooked to D8. Should I switch it with a contact sensor so the alarm doesn’t go off? Of course, then a door might look open and SHM would set off the siren anyways. I’m also looking into 12v battery backups to keep the esp running during outages.

According to a link by @ogiewon in another thread, D8 looks to have some output constraints.

1 Like

D8 is known to have some issues on boot. Take a look at the research @ogiewon published over in the newer thread: Convert Your Wired Alarm System into a SmartThings Smart Home Monitor System for Under $25 with NodeMCU ESP8266 (2017)

1 Like

@heythisisnate Firstly i wanted to say think you as well for your guide, it is exactly what i want to do, i will be following it i hope this week-end to get my alarm all set up. I have a quick question though, the resistors you mention for the siren, are 3V resistors, i cant find them anywhere (I live in Mexico) apart from China, and they would never arrive here (or if they did would take like 3 months, trust me, talking form experience) but i have found some 5v ones, (https://http2.mlstatic.com/modulo-relevador-de-1-canal-5v-10a-robotica-arduino-pic-avr-D_NQ_NP_818815-MLM25329232504_022017-O.jpg) would that work in any way? Thank you again.

@MexicoMatt First of all, I think you meant relay instead of resistor. The 5V relay probably will work, but you need to power it with 5V to the VCC pin. If you have the “LoLin version” NodeMCU board with base, you can get 5V power from the base (the pins labeled U3). If not, you’ll need to find another 5V power source.

Alternatively, you can order one of my kits that I’m preparing to ship soon with a new version of the software, and it comes with everything you need. Ships from California so you should have no problem receiving it in Mexico: https://nodemcu-smartthings.com/collections/wired-alarm-system-smartthings-connection-kits-and-accessories/products/wired-alarm-system-complete-kit

@heythisisnate Thanks for getting back to me, and yes, i meant relay!

I actually have / can get everything here, and to be honest shipping anything international to Mexico is a pain, it isn’t so much the getting to Mexico, its the part of then arriving to me. I don’t have the base, although i can get it, but i was thinking to just start with using a breadboard setup.

Again thank you for your response, and all the effort and work you have put into your guides etc.

OK, so if I understand that table correctly, I could move my relay/siren from D8 to D0 and it should work? @ogiewon has a Yes for Digital Output on D0. I don’t necessarily want to get a second esp8266 just for a single gpio, but of course, I may need to if I want to wire in my Smoke Detectors.

I would try it, and if that doesn’t work then try this - disconnect the siren pins, fire up your Node and let it connect to WiFi, and then reconnect them. My siren is on D5 and it only works when I connect the pins after the Node is already turned on.

I’ve searched this thread so I apologize if this is already posted and I can’t find it. My wired contact switches for windows and doors have 2 twisted pair wires. I’m unclear where I attach these wires to on my Adruino MEGA board. On the contact itself they are attached to 2 terminals but not sure where I connect these on the board. Sorry for the basic question this is my first attempt with the boards. I’m a software engineer but the wiring part is new to me. When I had my house built I had it wired but I’ve never put in an alarm system so I don’t have an existing alarm panel to look at for reference.

Hi with the set up you have are you only using the sensors with smartthings or are you still using the alarm panel as and alarm interested with smartthings?
Thankyou

I don’t have an alarm panel just the wires. I had it prewired when I built it but didn’t put an alarm panel in. I will only be using it with SmartThings.

So is yours not used for security or can you still use it for security?

Eric,

Just trying to help from afar… Your door/window magnetic reed switch has four wires attached to it. I have not seen this before. Are there actually four screw terminals on the contact switch, one for each wire? Or are some of the wires doubled up? Can you take a picture of the side of the switch where the wires attach?

At the point in your house where all of the wires come out of the wall (i.e. where your alarm panel would be installed, if you had one), do you have 4 wires per sensor? In other words, do you have 1 gray cable (with 4 wires inside, white, red, green, black) for every contact sensor? I am curious if the pre-wiring was done in a “zone configuration” with only one set of wires coming back to the alarm panel area per a gorup/zone of doors/windows.

Usually a magnetic contact sensor, like the one you have pictured above, is simply a single pair of normally open contacts. When a magnet is placed near it, these contacts are closed, completing the circuit. In this way, if a wire is cut (intentionally or accidentally) the alarm will be triggered, the same as if the door/window was opened causing the magnet to move away from the switch.

You should only need to use 1 pair of wires per door/window switch, attached to whatever processor you choose to use. You mention using an Arduino, however this discussion thread is specific to using an NodeMCU ESP8266 board. Which processor are you planning on using? If you’re using an Arduino, you may want to look at my ST_Anything project. ST_Anything works with both Arduino’s as well as ESP8266 based boards.

Regardless of the processor you choose, typically you will wire one side of the contact door/window contact switch to the GND terminal on your Arduino/ESP8266. The other side is wired to one of the digital input pins on your board. By using the “Internal Pullup” feature, the board will send a +5v or +3.3v out the digital input pin to the switch. If the door/window is closed, the switch will be closed, thereby connected GND to the corresponding pin on your board. This will be detected as a “LOW” state of the pin by the software. When the door/window is opened, the circuit opens up, causing the Internal Pullup feature to put 5v or 3.3v on the pin, resulting in a HIGH condition being seen by the software.

Hopefully this helps explain the wiring. I am still confused by your contact sensors having 4 wires attached to them, though…

Dan

Dan,

I should have taken the picture of the other side of the sensor so you could see the terminals but I think I can easily explain. Each pair of wires are twisted together at the ends and there are 2 terminals on the contact switch like it sounds like you expect. So each terminal has two wires connected to it because they are twisted together. I read somewhere that installers will do this (use 4 wire) for future expansion (but for what I don’t know).

On the other end where they came out of the wall and where my alarm panel would be I do have 4 wires per sensor so I doubt they are setup in a zone configuration. I think it’s a case of them using more wire to do the job than is actually required. Maybe on some alarm systems there is a use for the 4 wires but your explanation actually helps and I think it answers my question on how to wire it to the board. I can probably just twist the pairs together like they are at the contact and effectively use it like it’s two wires and connect it as you have described in your last paragraph and I should be fine.

Thanks for providing the link to your ST_Anything project and I see there are sketches for the Arduino Mega board there. I did order a NodeMCU ESP8266 as well because they are so cheap and I’m sure I’ll find a use for both of them in my security setup as I have many sensors. I will probably continue with the Arduino at this point mostly because it seems like I can connect more sensors to it than the ESP8266. If that’s the way I go I’ll post in the other thread you gave me instead.

It’s nice that everything is pre-wired but having an existing panel would have been nice too so I could see how things were terminated at the panel. I have to use a line toner to figure out every wire, which I’d never done before. I built my house 5 years ago and am just now getting around to this and finding out that the guys who did my low voltage structured wiring really didn’t do that great of a job. They didn’t wire at least one door. They didn’t put both sides of the contact switch in (the non-wired magnet side) and a few that are just placed wrong. I will have to end up also using some wireless sensors in a few places because of this, which irritates me. The upside is that I will probably learn more this way but will take me a little longer.

Did I answer all the questions you had for me? If you still need a picture let me know but thought I could explain it just as easy.

Thank you for your reply! I think based on what you told me I can get it wired up and try it out.

Eric,

It sounds like you’ve got a good starting point. I also had a home that was pre-wired for an alarm, and I also used a toner to figure out my wiring. You should label each cable as you figure them out to make sure you know what’s what later on should you ever need to rewire the controller.

Good luck and have fun!

Dan

I was looking at passive monitoring of my alarm panel also and ran across this video … https://www.youtube.com/watch?v=4zM6cMby_QQ.

A bit painful to watch in its entirety but around the 12 minute mark you will see an implementation of the 4 wire interface. Basically your 4-wire contact gives you the best option for EOL resistor configuration: the convenience of being able to place the EOL resistor at the panel while giving you the best troubleshooting visibility into the physical wiring.

I thought it interesting as I’ve never seen this before you posted the photo.

Hi Nate, I am still working away at this, I finally have my relay now (ordered two for good measure) they are the 5V ones, but you said they should work fine, although i have a doubt. I have tested the relay with the blink example code ,and connecting a light socket & bulb, and it switches on and off fine. So i know the really is working. However i think i am missing something on the alarm side. So i have everything uploaded to the NodeMCU, i have all my sensors setup on ST (only contact, no motion), I also have my ALARM setup on ST. For testing purposes I have only one contact sensor in the variables code, and the details for the strobe. (I want to test with the light bulb, as not to upset the neighbors with my siren!). So i connect everything, ( just breadboard testing, not actually connected to the alarm system yet). Upon “plugging in” the blue light flashes on the NodeMCU, it connects to wifi (viewing Esplorer window) and on the relay, the red led comes on. If i disconnect the wire connected to D6 (Front Door) it reflects in ST saying OPEN. I am assuming, if i turn the ALARM button on in ST, then upon disconnecting D6, the siren / strobe / light should come on, right? How can i test the siren part is working correctly?. Cheers in advance.
FYI: i have the strobe pin set as 1, the port as 8100 and the deviceID from ST.