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

Brought the internal pullup setting back and switched to D1. The door sensors and motion seem to be reverse. When nothing is plugged in, door sensors are open and motion sensors are active.

There is also some back and forward switching between open and close or motion and inactive very quickly when I initially plug something in. I suppose this won’t be a super big deal as it only occurs for a few seconds during the connection.

Both of these issues are reflected on the computer and smart things app.

Brought the internal pullup setting back and switched to D1. The door sensors and motion seem to be reverse. When nothing is plugged in, door sensors are open and motion sensors are active.

It sounds like your sensors are the normally closed (NC) type instead of normally open (NO) which I think is more typical of home security systems. That’s ok, it’s a simple fix. You can just reverse the logic in the SmartApp code here: https://github.com/heythisisnate/nodemcu-smartthings-sensors/blob/master/SmartThings/cloud-sensor.groovy#L58-L59 and re-publish. You’ll want to just swap the 0 and 1 mapping 0 to open() and 1 to close().

There is also some back and forward switching between open and close or motion and inactive very quickly when I initially plug something in.

Probably just due to a loose connection while you’re moving it around. Make sure the pins are good and tight on the jumper cables and it shouldn’t be a problem.

I am simply just connecting the wire from the ground of the board to the pin, I didn’t even connect to my alarm system yet. Just testing the connectors. Should I still reverse them? Or do I have a problem somewhere?

Currently: The door appears as close on SmartThing’s when I close the circuit and open when O open it.

Thanks!

Oh, nevermind then. I think I misread your previous comment. It does sound like it’s working correctly to me.
Yes, when nothing is connected, the door sensors should show as open and the motion sensor shows active. When you complete the circuit by connecting each pin to ground, the doors should indicate closed and motion inactive.

I believe that most home security systems use normally open (NO) type sensors (not an expert on this, so I could be wrong). That means 0 == closed/inactive and 1 == open/active.

Sounds good! I will leave it like it is until the install which I will do in a few days. Then I will just have to change the pullup setting.
I will leave the unit running on my desk for a few days and regularly test it until the install so I know everything works.

Thanks again for your help!!! I appreciate your time and personal guidance throughout my entire setup process. And I would like to apologize for all of these posts.

I was building the breadboard that @ogiewon provided for my setup a few weeks ago.


However, I decided to check the voltage before and after the resistor. Previously, I was getting 0V & 13V in this location but now I am only getting 0V & 5V.

0V – Door Open
5V – Door Close

Any reason why this voltage change occurred? Obviously 0V and 5V is more favorable oppose to 13V.

I added the resistor in between the circuit when checking voltage but it didn’t drop it at all. The voltage stayed the same. Basically put it between the wire before it hit the multimeter but no change. How do I wire the resistor?

Thanks

I didn’t mount the NodeMCU yet, as I am still checking voltage.

1 Like

Not sure why the voltage is:
0V: Door Open
5V (previously 13V): when closed.

But I need some advice on how to lower the 5V to 3.14 (the voltage of my NodeMCU). I manipulated @ogiewon’s config a bit as my voltage is now 5V (instead of 13V) as he designed. Please see last post. So I switched R2 and R1 around so 3.3 resistor on top and 10k on the bottom and got the voltage to 3.88.

So now I just need to lower the voltage a little bit more, like half a volt. Any config ideas on how to do that? I have no idea how this wiring works so any advice on how I should manipulate the setup that @ogiewon provided for the new voltage will be much appreciated. Perhaps I can do it now with just one resistor??

Thanks

Btw: It seems that the open/close settings are reversed so I will have to manipulate it on the settings as I have a voltage when the door is closed but not open. (unlike the NodeMCU). @heythisisnate already provided me with info on doing that yesterday so I will do that next and hook everything up after I figure out how to configure the resistors.

Thanks, I am almost finish with this. (:

So, if you’re scaling 0 to 5 volts down to 0 to 3.3v, the two resistor values would be R1 = 5KOhm and R2 = 10KOhm.

You can calculate the values online using an voltage divider calculator web site, such as http://www.raltron.com/cust/tools/voltage_divider.asp

Personally, I believe your inputs on the NodeMCU ESP8266 board can probably handle the 0 to 3.7v without any harm (i.e. just use the 3.3K and 10K resistors that you have on hand.) I drive a digital input pin on one of my ESP8266 bards at 5V with no ill effects. Of course, your mileage may vary. Getting some 5K resistors would be the safest approach.

I am curious how the voltage mysteriously changed on your alarm panel though? You must be measuring the voltage differently. Are you using the same voltmeter? With the same DC Voltage settings?

Before you hook up the NodeMCU to the panel’s wiring, check the voltage between the BLUE and YELLOW wires in my wiring diagram with a door open and closed. Hopefully you get values between 0 and 3.x volts. If so, you should be safe to connect the NodeMCU board…

Appreciate it! Gonna hook things up with the 3.3K and 10K.

Not sure how the voltage changed, same multimeter on the same setting. The voltage is still 0 and 13V with the other config so not sure what happened after 1 month.

To be safe, and if you have enough resistors, you could make R1 = 6.6K by wiring two 3.3K resistors in SERIES.

So, you’d have (all text below should be black… forum software is messing with it.)

----R1 (3.3K)
     |
    R1 (3.3K)
     |---------------NodeMCU
    R2 (10K)            |
-----|------------------|

You’d still pull the signal between R2 and the R1 immediately adjoining it. This would scale you 0 to 5V to 0 to 3V. I believe it will still trigger the digital input correctly.

Yea, I have plenty of 3.3k and 10k resistors. I am a little confused on the wiring though and how to add it.

Last try… :wink:

1 Like

Just double checked, the voltage is 4.14 in that config so its actually higher than using the 3.3k and 10k which is just 3.8k. So should I just go with that??

Thanks @ogiewon

Also, what is the supported voltage. If I were to power directly from the panel??

Thanks

You can easily power the NodeMCU directly from the panel. It will adjust the voltage internally. Connect the + to one of the U1 pins on the base and ground to GND. The power input pins are illustrated here: http://img.banggood.com/thumb/water/oaupload/banggood/images/A8/91/a7082e87-4965-49c2-aa16-8e7217cc4a2b.jpg

Thanks, what voltage will it accept?

Look on the back of the base. It’s printed right there 6V - 24V.

Hooked up one of the motion sensors and it works great. I just had to swap the 0 and 1 in the smart app.
I am using the panel to power the system right now, I connected the GND (for the sensor) to the comm and the positive to the positive terminal on the panel and the unit turned on before I even connected the negative terminal. Should I even keep the negative power terminal connected? As the unit functions without it?

Thanks

But I just realized, I forgot to add a motion sensor!!! Do I need to do it all again??

In case anyone is still reading this, I wanted to announce a small feature release: https://github.com/heythisisnate/nodemcu-smartthings-sensors/releases/tag/1.3

The main feature that some of you have asked for is the addition of “reliable polling”. You can configure an interval (in seconds) and the program will poll the sensors periodically and update SmartThings if needed. This shouldn’t really be needed 99% of the time, but I have seen occasions where a door is actually closed and shows as open in ST. In addition to this, the app always updates its initial state on startup now, so together these features make the system much more reliable.

Also, for fun and debugging, you can now (optionally) blink the onboard LED every time a successful update to SmartThings is done.

1 Like