SOLVED : Home Security System Tapping with Arduino

Hi Guys,

I recently moved into a new house which came with a security system installed. It’s an older system, but fortunately the previous owner kept all of the documentation that came with it. I am attempting to detect when each “zone” is violated via an Arduino.

For each “zone,” there is a positive and negative screw terminal. The two are connected by a 2200 Ohm End Of Line resistor with a Normally Closed switch in series and a Normally Open switch in parallel. (See Attachment.) Not sure if it matters, but two “zones” share a negative screw terminal. Note that the NC and NO distinction is taken from the manual - I’m not sure if Normally Open means open when the zone is closed or open when the zone is open … It’s entirely possible that it doesn’t even matter given my questions.

I measured the voltage by placing the prongs of the multimeter directly on the screw terminals. When the “zone”/backdoor was closed, the voltage was ~12/13V. When the door was open, the voltage was ~30V.

Question One: Is it safe to read voltage directly off the screw terminals long term, or do I need to connect wires somewhere else?

Question Two: My understanding is the Arduino analog input pins detect voltage between 0V and 5V. How do I drop the voltage so that the Arduino can still detect the difference between 12/13V and 30V without frying the board?

Thanks for your help!

no, keep the input voltage to a microprocessor in the specs for that chip - typ. 3.3V or 5V.

Lots of ways to interface this to the microprocessor. Simplest is an optoisolator chip and a proper sized resistor.

stevech:
no, keep the input voltage to a microprocessor in the specs for that chip - typ. 3.3V or 5V.

Lots of ways to interface this to the microprocessor. Simplest is an optoisolator chip and a proper sized resistor.

Thank you for your feedback stevech!

I haven’t much experience with optoisolation, but have done a bit of research on how it works. I found [this Opto-isolator Breakout Board, but it seems to operate in the opposite direction (that is, low voltage to high). I found [the chip itself, but without any experience with them, I’m a little in the dark about hooking them up.

In regards to the resistor, I’m confused about the voltage and current values I would need to use to determine the resistor value. I figure using the low voltage in Ohms Law would fry the chip when it jumped up to the higher value. I’m assuming I need to use the higher ~30V correct?

What current value do I need to use? Is this the current that the Arduino uses when detecting on the analog pin? Any idea what that is?](https://www.sparkfun.com/products/314)](SparkFun Opto-isolator Breakout - BOB-09118 - SparkFun Electronics)

There’s something I don’t grok about your (sensor) schematic above and the behavior you’ve noticed. From the behavior it sounds like the sensor resistor is in series when the alarm is NOT activated. Then when the alarm is activated the reistance goes away and you measure the full scale, open circuit voltage (30V) at the - terminal of the sensor. I’d expect the switches in your diagram would be magnetic reed switches and so operate in conjunction with each other. That is when the NO becomes closed, the NC becomes open.

The only way I can make sense of this all is :

  • When the “Zone” is not in alarmed state, your schematic depicts the sensor circuit state and the 2200 ohm R is in series with another R, perhaps 3300 ohms (internal to the alarm box). The 2200 is tied to a 30V supply (internal to the alarm box) via the + terminal of the sensor and then to one end of the 3300 ohm R. This other R is then also tied to ground, making a resistor divider witht the sensor R and setting the sensor - terminal at about 13V. All very odd voltages to my thinking.

  • When the Zone is alarmed, the NC opens and the NO closes and the internal 3300 R is now tied directly to 30V.

  • When the Zone is not used (or the wire broken) the state of the Zone does not matter and the internal circuitry is pulled down to ground via the internal 3300 R. This allows the detection of an open or unused line.

While the above is a nice theory, I shake my head at the voltages involved. Maybe that’s what was needed to drive relays ??? In any case since you have a volt meter (and ohmeter ?) can you measure the voltage at both terminals of the sensor, whose schematic you’ve posted above, in the not alarmed and alarmed states ? We know the - terminal is either 12-13V or 30V depending on alarm state but let’s get the whole picture. Also can you measure the voltage at the - terminal (actually the wire going to the alarm) with the sensor disconnected. If this measures 0 volts (wrt ground at the alarm), then measure the resistance to alarm ground for that pin. See if it’s my predicted 3300 ohms.

Then we can give you a good idea of what to do.

BTW upon rereading I think I should ask to be sure … when you measured the voltages cited above, were those with the sensor (as depicted in the schematic) attached to some alarm box ? Or were those were for the sensor, measured all by itself, no connection to anything else ?

Let us know, thx.

Hi, Mee_n_Mac!

I’m eager to make the measurements that you have requested, but I’m afraid that I’m not entirely sure what it is that you are describing. Are you asking that I cut the cables running to and from one of the sensor (and yes, they are reed switches) and measure the voltage there? To be honest, I don’t have confidence in my ability to patch those back together after cutting and stripping them. I could perhaps measure them elsewhere, maybe where the connections are made to the control box…

I measured voltages at the screw terminals on the control box.

This is no doubt difficult to visualize without a proper picture. Page 22 of [this manual shows what I’m working with.

Note that zones without a sensor are connected to their respective ground with a 2200 Ohm resistor. The voltage at those zones is 12.7V according to my measurements - same as the others that I rounded to 13V. I agree that they seems to be strange voltages…

Thanks for your interest and help!](http://www.ies-co.com/html/files/moosez1100i.pdf)

Give me some time to peruse the manual, it seems to have the info needed to figure out what to do. The ~13V makes sense as there seems to be an 18V transformer whose output is rectified and regulated to 13.8V which in turn is used to charge some backup SLAs. I don’t know how you’ve measured 30V ??? The wiring of the sensors is detailed in the manual and the 2200 R is only there to terminate the zone. Again let me read and then recommend any other desired measurements (at the control box).

BTW : Are you looking to replace the control box with the Arduino or use the Arduino in parallel ?

I’ve just realized a mistake I made… After checking the voltage of a 12V battery and getting a value of 20 something volts, I realized that I had my meter set to AC instead of DC. I certainly hope that I haven’t harmed anything in the process…

That said, the new measurements make a bit more sense. When a zone is violated - that is, the door is open - the voltage sits at 13.8V (which you called!). When the door is closed, 6V … those seem like nicer numbers.

At the current time, I’m not planning on replacing the system fully with an Arduino/PC setup - though I might in the future. Right now, I hope to merely detect when a zone is violated (there’s a nice pin that simply goes high when the alarm goes off) and which zone was violated - then pass this to a computer via serial.

OK, those measurements make more sense. From the manual it seems you can setup the system to use 2200 ohm EOL Rs or not to. For the former case, the “sensor” can be either a normal closed switch (when there’s no alarm/intrusion/violation) that can be connected in series with other sensor/switches to form a long, unbroken continuity loop … or the sensor can be a normally open switch which can then be connected in parallel with other such sensors/switches in a zone. In the first case this loop basically connects the 2200 ohm EOL R between the zone input terminal and ground (when there’s no violation, the term used in the manual). When any switch is opened, the loop is “broken”, the 2200 ohms to ground is removed and the violation is detected. In the second case the sensors/switches are all nomally open and are all wired in parallel to each other and the 2200 ohm EOL R. As before, the no violation case has the 2200 ohm EOL R btw the zone input terminal and ground. Now when a violation occurs, a sensor/switch applies a direct short to ground, effectively removing the 2200 ohm EOL R. The manual says you can even mix the 2 types of sensors (as shown in your schematic above). I infer from this, and your measurement above confirms it, that there’s a voltage divider implemented in the control box and when either a open or short is applied to the zone input terminal, that voltage divider is “upset” and a violation detected/declared. I expect this is done with a window comparator but that’s not important to your goal.

Now the manual also says you can eliminate the 2200 ohm EOL R and just use a continuity loop of NC sensors (as I described above). But if this is done, you need to cut some jumper wires inside the control box. So the first thing to do is figure out what sensors you have wired up and whether those internal jumpers have been cut or not.

So first note which of the 8 zones are wired up. Then measure the voltage (no violation) between it’s input terminal (#1, 3, 4, 6, 7, 9, 10, 12) and the ground terminal (# 2, 5, 8 and 11 and they’re all probably tied to terminal #13 too, so you can pick any one and use it as the ground for all the measurements). For each zone that is wired, trip the sensor(s) for that zone and for each sensor note what the voltage does. It’ll either go 13+ V or to 0 V (depending on the sensor type).

With that data in hand, we can choose what method is the best to implement to tie the sensors into your Arduino.

PS - there are other inputs for connections to a fire alarm/smoke detectors. Do you want these monitored by the Arduino ?

I was able to measure voltages of each zone except for one. Of those tested, they all returned 6V closed/secured and 13.8V violated - give or take a tenth of a volt. I was unable to measure the upstairs window sensors. They’re wireless sensors that operate off of a 9V battery so I suspect that the signal that they send to the receiver only causes a quick zone violation - certainly not quick enough for me to run down stairs and measure.

Currently, the smoke detectors are not hooked up on my system, so I have no need to capture those with the Arduino.

Thank you for your detailed postings - I’m learning much more than I though I would with this project!

ipndrmath:
I was able to measure voltages of each zone except for one. Of those tested, they all returned 6V closed/secured and 13.8V violated - give or take a tenth of a volt.

Excellent ! Can I assume that you won't be changing any of the sensors and that if you add some more sensors (for another zone) they will be of the same type and so act in the same way ?

I was unable to measure the upstairs window sensors. They’re wireless sensors that operate off of a 9V battery so I suspect that the signal that they send to the receiver only causes a quick zone violation - certainly not quick enough for me to run down stairs and measure.

Hmmmm, time to give one of the kids something to do. You may be correct, the wireless system probably only sends a pulse ... but the wireless receiver, attached to the control box, may latch this pulse into a constant state. Worth a quick test in any case. I assume you want the Arduino to detect these violations as well ?

Now as to how to tie these signals into your Arduino … how familiar are you with circuits ? One possible way is to replicate what I guess is in the control box. The trick is not to affect the existing sensor output levels so as to cause the existing alarm control to no longer work. That means a high input impedance (resistance) buffer of some sort and then some circuit to translate the 6V and 13+V levels into the 0 - 5 V levels your Arduino can tolerate (a similar thing is no doubt done in the control box to interface to it’s microcontroller).

Another possible way is to “hack” the controller box, to find where those zone inputs have already been translated into 0 - 5 V signals used internally, and add wiring to bring those signals to the Arduino. No new circuitry needed but you will need to solder onto the existing PCB and do some more probing and detective work to figure out what signal is on what pin. This will be something of a PITA as there’s no schematic available (I’ve looked) for the obvious reasons.

BTW if you want to do 1 more test, to put the nail in the coffin as it were, you could disconnect one of the wired inputs from it’s + terminal at the control box. Then, with an ohmmeter, measure the resistance between the wire going to the sensor and the wire left attached to the control box ground terminal. You should see the 2200 ohm EOL resistance. For extra credit, then “violate” the zone and measure an open circuit (a very high resistance, >> 1 Mohm).

Just to give you an idea of what the circuit would be …

An LM339 is a (4) comparator IC. It can handle 4 zones so to do all 8 zones, you’d need 2 ICs. You set up a threshold (at 75% of the supply voltage) using 2 resistors, making a voltage divider for one of the comparator inputs. The other input would be tied to the + terminal for the zone. The output of the comparator would be sent to your Arduino* input. That’s 2 ICs and 16 resistors which could be assembled on a solderless breadboard (at least initially) and powered from the Aux power terminals (#29, #28) on the alarm control box. Just to aid in debugging any problems I’d also tie an LED and current limiting resistor to each comparator output. Then you can see that each zones signal is being properly detected and sent to the Arduino.

*Which Arduino are you using ? An Uno has 14 digital I/O lines. Assuming you’re doing nothing else with your Uno, using 8 would leave you with 6, which in reality is only 4, as 2 of the lines are the Tx/Rx signals needed to communicate with the Uno (to D/L code, etc).

Datasheet …

http://www.ti.com/lit/ds/symlink/lm2901.pdf

And some LM339 circuits …

http://www.bristolwatch.com/ele/vc.htm

I am all for the circuit building as I’m not particularly comfortable with probing and soldering on the actual security system board. :slight_smile:

I’ve done a bit of reading on comparator ICs as I haven’t any prior experience with them. So that I understand:

  • - I place the PLUS input at some value between 6V and 13.8V.
  • - When the zone is secured, the voltage at the MINUS input will sit at 6v.
  • - Because the MINUS input is less than the PLUS input, the respective output will go LOW.
  • - When the zone is violated, the voltage at the MINUS input will sit at 13.8V.
  • - Because the MINUS input is greater than the PLUS input, the respective output will go HIGH.
  • This should mean - when a zone is secure, there is no voltage on the pin; when the zone is violated, there is 5V on the pin.

    Assuming my above is correct, there are a few things that I don’t follow:

  • - I do not know how to reduce the voltage of the PLUS input to a voltage between 13.8V and 6V. Is this what you were describing with the two resistors?
  • - What is the voltage of each output? All I could find in the datasheet was that the MAX V is 36V. Is the output V equal to the Supply Voltage?
  • At the time, I haven’t any intentions of adding additional sensors through the security system. Furthermore, I haven’t given much thought to which Arduino. I’ve yet to find my two Arduinos amongst the endless moving boxes so I will likely purchase another. Probably an UNO or DUE when it comes out in the next few weeks. Either way, I’m not too concerned about input at this time - If I did run out of inputs, I figure I could use a [shift register. Right?

    Shame TI doesn’t have free samples of their DIP form LM339, only their surface mount chips. :P](8-Bit Parallel-In/Serial-Out Shift Register - 74HC165N - COM-09519 - SparkFun Electronics)

    To answer this …

    •I do not know how to reduce the voltage of the PLUS input to a voltage between 13.8V and 6V. Is this what you were describing with the two resistors?
    •What is the voltage of each output? All I could find in the datasheet was that the MAX V is 36V. Is the output V equal to the Supply Voltage?

    … the output of an LM339 is what’s known as an open collector. That means that the '339 doesn’t supply a voltage but rather supplies an open or a short to the - supply, and in your case the - supply would be ground. Effectively the '339 is a switch to ground … or not … depending on the sensor state. The 2 resistors set the reference voltage. I chose 75% of Vsupply, that being halfway btw 6V and 13+V. Given inputs above or below this reference voltage, the '339 will supply an open or short to ground.

    What you would do is tie the Arduino ground to the controller box ground, and then connect the comparator output(s) to the Arduino input pin(s) … and then do 1 of 2 things. Either enable the Arduino’s internal pull-up resistor to it’s 5V source (via software) or use the external LED + pull-up I mentioned above, tying them to the Arduino’s 5v supply. In either case the supply to the pull-up would be the Arduino’s 5V source. Thus the Arduino senses either a ground or a 5v signal, a logic 0 or a logic 1.

    You can configure the + and - inputs to the '339 so you get a either logic state for a violation (and of course the opposite state for no violation). My personal preference is to have a violation result in a logic 0 (comparator output = 0V). If you decide to have LEDs attached to the '339 outputs then it ill be easy to see as an LED on when a violation occurs. Plus I think there’s marginal power savings this way.

    I’m going to go about ordering some parts and playing around with what you have described. Thank you for all of your help! It would have taken much more time for me to get to this point without you!

    No problem ! Let me just suggest you play around with the design on paper, asking about and figuring out all the details. As it is … tying the 8 zones into an Arduino is not that hard, what you’re doing after that is up to you.

    Post again when you’re having the “fun” of making it all work.

    I’m extremely interested in this project, and am attempting to do the same thing. How are things working out for you?

    Here are my goals:

    Somehow “read” the condition of each loop from my security system (a Honeywell Vista 20P, self-installed) to detect if loop is faulted or not.

    Upon identification of fault, send e-mail to phone.

    I’m hoping to use Arduino to do this (Uno, or Mega if necessary). I have an Uno, and am trying to tackle the first mini-project involved here: “Reading” a security system loop for faults.

    My security system uses the “zone doubling” feature of the Vista 20P. A brief overview. In a standard zone (non-zone doubled) you run a wire from an input terminal on the security system board to a string of serially-connected, normally-closed sensors (mine included magnetic reed switches, or motion detectors). Each loop is terminated with a 2K resistor. When a sensor “opens”, the loop opens, and a fault occurs (and alarm sounds, if system is armed).

    When zone doubling, you run two loops in parallel to a single pair of input terminals on the panel, terminating one with a 3.2K resistor, and the other with a 6K resistor. The panel can discern which loop is faulted by observing the voltage across the input pins. I’ve measured the resulting voltages under each permutation, and here’s what I get (two doors, each wired on their own loop, using the zone-doubling feature):

    Door 1 closed, Door 2 closed: 4.9V (no fault)

    Door 1 open, Door 2 closed: 5.9V (would cause fault for Door 1 zone)

    Door 1 closed, Door 2 open: 7.6V (would cause fault for Door 2 zone)

    Door 1 open, Door 2 open: 10.3V (would cause fault for both Door 1 zone and Door 2 zone)

    I need to somehow read these voltages with an Arduino … as you can see, the max voltage exceeds Arduino’s built-in analogread() max of 5VDC, so I need to seek an off-Arduino solution. Assuming I can figure out how to read the voltages, with some simple logic I can detect the appropriate fault condition (and later, if / when I figure out how to get Arduino to send e-mails, send appropriate notification to my phone). (insert wise-crack about underestimating complexity of Arduino e-mail project)

    My worry about “reading” voltage from the board is that my detection circuitry will somehow interfere, negatively influencing the ability of my Vista 20P to operate normally. My options for reading voltage, as I understand them include:

    Voltage comparator (bought some LM339 chips to play around with … but they seem to require 18VDC or 36VDC to operate … my security panel can provide 13.7VDC of auxiliary power … I’d like to keep it simple and leverage this if possible) … I may have misunderstood the LM339 spec sheet too (been a looooonnnnggg time since my electrical engineering classes). If I can get the chip powered, I’d still need to provide reliable “reference” voltages to the device (which I could easily do using some resistors and the on-board auxiliary power from my security panel) … but the LM339 seems to require 1.5VDC of “space” between the reference voltage, and the voltage which is being tested (before the output will go from high to low). As you can see, I only have ~1VDC between two of my voltages. I’m sure it can be done, but it leaves little room for error.

    Voltage divider: If I put two very large, serially-connected resistors in a parallel loop to the alarm loop (to get the voltage down below Arduino’s 5VDC maximum), I should be able to do an analogread() of the voltage drop across one of those resistors, then compute the voltage drop across the entire loop, and thereby identify the state of each loop, right? I’m not sure I could do this without interfering with my panel’s performance though …

    Does anyone have any ideas on a simple, but robust way to use Arduino to unobtrusively read / sniff the voltage of a secondary circuit?

    Looking forward to working this through … I know it can be done … many many thanks in advance. This is a very cool forum!

    ***UPDATE: 3/28/2013 - I managed to get the LM339 chips wired and running last night (I guess you need to connect ALL of the pins in order for it work?) And I was way off on the 18VDC / 36VDC input requirement … I fed 5VDC in from the Arduino’s power supply, and things worked perfectly. Anyway, I followed the tutorial http://www.ehow.com/how_12044471_diy-pr … cator.html, and it did the trick to prove basic functionality … I modified the tutorial’s intent a bit to feed variable voltage into the “-” pins via a potentiometer, which allows me to spin the rheostat and sequentially light up each of four LEDs attached to the outputs of the four comparators … pretty cool.

    With that proof of concept tackled, I will now identify the resistor values required to knock down the 13.7VDC auxiliary voltage (from my security panel) to the appropriate reference voltages corresponding to each state (referenced above). These reference voltages will be fed into the LM339 comparators in a live test on my actual security panel … not sure how this will go, but if I understand the LM339 chips correctly, they will not interfere with the circuitry they will be “observing”. I’ll start by using potentiometers (instead of hard-value resistors) and LEDs to literally “dial in” the resistance value that will split the four states I want to “flag” on each security system loop. It will look something like this:

    Open both doors: Dial in potentiometer 1 (increasing resistance from zero) until comparator 1 output goes high (as evidenced by LED lighting up)

    Close door 1, open door 2: Dial in pot 2 (increasing resistance from zero) until comparator 2 output goes high

    Etc.

    Etc.

    I’ll read the resistance values of each pot at this point, and then replace the pots with appropriately sized resistors.

    Then I’ll move on to exploring the e-mail capabilities of Arduino. Leaning towards utilizing my HP Mediasmart server to run a Python program to send an e-mail … but ideally, I’d rely only on the Arduino (LOTS to learn here yet).

    Cool thing about the comparator approach is that I don’t need to worry about damaging the Arduino analog inputs as the highest voltage Arduino will ever see is the voltage that I’ve sourced to the LM339 chips (which comes from the Arduino’s onboard 5VDC power supply). Cool stuff.

    Hey, so … uh … better late than never, right? Right?

    I finally got around to working further on this project and I’ve an Arduino successfully reading values off from my Z1100 security system and then sending state changes to a Raspberry Pi running EasyIOT via an NRF24L01+ with the MySensors library. I’m using the voltage divider method and there does not appear to be any negative impact regarding the Z1100’s ability to still function. A voltage divider is an easy enough idea, but it took me some time to understand what exactly was happening…

    I’ve attached a Fritzing diagram below of my hookup. This is the first time I’ve ever used Fritzing so hopefully it’s sufficiently legible.

    This isn’t yet a finish product. Things that still need to be done:

  • - Code is clunky in spots and needs to be optimized.
  • - It's possible for the Arduino and RPI to get desynced if a zone state is changed during a reboot. This is, in part, because the Arduino assumes that all the zones are closed at boot. It syncs back up after opening and closing the affected zone, but the RBI will not see that first open/close cycle - not great for a security system! To fix this, the Arduino should check the current values of all the zone states when it reboots.
  • - Additional zones on the Z1100 still need to be connected.
  • - Detect if the Z1100 is ARMED. Pretty sure there's a pin for this on the Z1100 and I should be able to tap it just as I have for the zones.
  • - Detect if the Z1100 is actuating the siren. As with the ARMED state, I think there's a pin for that too, but I haven't dug too deeply.
  • - I'd really like to do something with the data - like send a text if a zone is opened while the Z1100 is ARMED ... I'm always in search of better home automation controllers. EasyIOT is the best I've found for my needs so far, but it's still a work in progress. I'm thinking I might just parse the data into Splunk for more advance analytics.
  • At any rate, here’s my code :

    /*
     *
     * Multimeter Code taken from : https://blog.udemy.com/arduino-voltmeter/
     * Thanks, Jennifer Marsh!
     *
     * Communication of the zone states is handled by the very cool MySensors library : http://www.mysensors.org/
     * Thanks to all the contributors to that project!
     * 
     * Thanks, Mee_n_Mac for your help!
     * 
     * Notes :
     * ~6V Closed; ~13V Open
     * Pin A* = Sensor * (Pins and Sensors start at 1, not 0)
     */
     
    #include <MySensor.h>
    #include <SPI.h>
    
    #define CHILD_ID_ZONE_1 1
    #define CHILD_ID_ZONE_2 2
    #define CHILD_ID_ZONE_3 3
    #define CHILD_ID_ZONE_4 4
    
    MySensor gw;
    MyMessage msg_Zone_1(CHILD_ID_ZONE_1,V_TRIPPED);
    MyMessage msg_Zone_2(CHILD_ID_ZONE_2,V_TRIPPED);
    MyMessage msg_Zone_3(CHILD_ID_ZONE_3,V_TRIPPED);
    MyMessage msg_Zone_4(CHILD_ID_ZONE_4,V_TRIPPED);
    
    // Variables for reading voltage
    // These resistors should make it safe to read up to ~55VDC)
    float vPow = 4.7;
    float r1 = 100000;
    float r2 = 10000;
    
    // Number of zones to check 
    int numZones = 4;
    
    // Last Known State variables
    char* lkstate[]={"Closed", "Closed", "Closed", "Closed"};
    
    void setup() {
      
      // Spin up MySensors
      gw.begin();
      
      // Let the controller know about our children
      gw.present(CHILD_ID_ZONE_1, S_DOOR);
      gw.present(CHILD_ID_ZONE_2, S_DOOR);
      gw.present(CHILD_ID_ZONE_3, S_DOOR);
      gw.present(CHILD_ID_ZONE_4, S_DOOR);
      
      // Sensor is on wall power, so peg battery level at 100%
      gw.sendBatteryLevel(100);
    }
    
    void loop() {
      
      for (int child = 1; child < numZones + 1; child++) {
        Serial.println("\n\n\n");
        // Let Serial know which sensor we're checking.
        Serial.println("Checking child: " + String(child));
        
        // Let Serial know what the last known state was.
        Serial.println("Last Known State of child: " + String(lkstate[child-1]));
        
        // Check the voltage into the Analog Input.
        int voltage = (int)((analogRead(child) * vPow) / 1024)/(r2 / ( r1 + r2));
            
        // Let Serial know what voltage we detected on the sensor.
        Serial.println("Voltage is measured at: " + String(voltage));
        
        // If the voltage is detected at below 9DCV, probably ~6DCV, the zone is Closed.    
        if (voltage <= 9) {
          if (lkstate[child-1]=="Open") {   // If the Last Known State was Open,
            lkstate[child-1]="Closed";      // Change it to Closed and ...
            sendUpdate(child);              // Send an update to the Controller and ...
            Serial.println("Last Known State of sensor changed. Now: " + String(lkstate[child-1]));  // Let Serial know of the state change.
          }
        }
        
        // If the voltage is detected at above 9DCV, probably ~13DCV, the zone is Open.
        else if (voltage > 9) {
          if (lkstate[child-1]=="Closed") {  // If the Last Known State was Closed,
            lkstate[child-1]="Open";         // Change it to Open and ...
            sendUpdate(child);               // Send an update to the Controller and ...
            Serial.println("Last Known State of child changed. Now: " + String(lkstate[child-1]));  // Let Serial know of the state change.        
          }
        }      
        delay(250);
      }
    }
    
    void sendUpdate(int child){
      
      //Switch on the child value
      switch (child) {
        
        case 1:
          if (lkstate[child-1]=="Open") {
            gw.send(msg_Zone_1.set(1));
          } else if (lkstate[child-1]=="Closed") {
            gw.send(msg_Zone_1.set(0));
          }
          break;
        
        case 2:
          if (lkstate[child-1]=="Open") {
            gw.send(msg_Zone_2.set(1));
          } else if (lkstate[child-1]=="Closed") {
            gw.send(msg_Zone_2.set(0));
          }
          break;
          
        case 3:
          if (lkstate[child-1]=="Open") {
            gw.send(msg_Zone_3.set(1));
          } else if (lkstate[child-1]=="Closed") {
            gw.send(msg_Zone_3.set(0));
          }
          break;
    
        case 4:
          if (lkstate[child-1]=="Open") {
            gw.send(msg_Zone_4.set(1));
          } else if (lkstate[child-1]=="Closed") {
            gw.send(msg_Zone_4.set(0));
          }
          break;
          
      }
    }
    

    This is part of a larger home automation project, but it’s unlikely I’ll make any additional progress on it for a good number of months. My hope is to put some documentation together of the whole project upon its completion … but let’s be honest … it took me two and half years to get around to this, so I wouldn’t hold my breath. :stuck_out_tongue: That said, I wanted to get this out less some poor reader experience this : https://xkcd.com/979/

    Thanks again, @Mee_n_Mac. Apologies I wasn’t around to see your post, @derkosjo. I hope you’ve made some good progress on your project!