cborrowman / Napco1632ArduinoMonitor

Arduino Sketch to monitor serial communications from Napco 1632 Panel to keypad
MIT License
6 stars 0 forks source link

Napco1632ArduinoMonitor


April 21, 2023

One day I was looking at other integrated alarm ideas and came across one solution that used keyswitch arming to trigger arming and disarming of the control panel. I wish I had found this earlier because it makes for a much simplier solution. Rather than having to read and write to the panel and also and inject my own commands in bewteen responses from a real keypad, all it has to do is monitor the panel output. Then to trigger arm/disarm it only needs to ground two pins on the panel.

I had an earlier prototype board sitting on the bench that was readonly and used just for monitoring. I experimented with using a simple transistor to pull the keyswitch contacts low it worked, so I turned this board into Schematic 6 and Prototype 6.

All the code I had previouslt could be used, except I didn't need any of the code to write commands back. Triggering the keyswitch just required a one second pulse to low on the digital output driving the transistor.

The last prototype has been very stable and has been running since December. I do seem to go through episodes of rebooting a few times a day, some days more than others. I think the issues are more about sending commands to the azure site recording alarm status. I think the reboots are ocurring because the command cannot be delivered to the azure site within 8 seconds. I don't think it is because the board is crashing and rebooting. I have an 8 second watch dog running, so if any command takes longer than 8 seconds, the board resets. I see 2 or 3 a day.

Prototype6


December 17, 2022

I've been experimenting with ethernet adaptors trying to find a reliable wired ethernet connection. I tried replacing the 7805 power supply with an OKI 78SR5 power convertor. This uses solid state switching to regulate power and won't have the same power usage as the 7805. I thought the 7805 was getting rather hot. I seem to have a problem with bootup power. I ended up just using a USB power supply for the Arduino & ethernet.

This lead to Schematic 5 and Prototype 5 shown below: Prototype2
Prototype2

I had added two LEDs to show a heatbeat blink and a post light. This provided some feedback that the unit was operating. I didn't realize at first that I had a conflict between the Arduino and the ETH shield. I had an LED wired to digital pins 4 & 5. The MKR ETH shield was using pi 4 as CS for the card reader.

I think this was the source of some of my problems. I had code turning the LED on and off and this was likely causing CS signal conflicts.


November 6, 2022

The alarm monitor has been running for several months using WIFI to communicate with the server site. Once I added a routine to reset and restart the WIFI module when it cannot connect, it’s been reliable.

It reports status every 5 minutes if there is no other status to send, so the server will detect if the alarm is offline if it doesn’t hear anything for 6 minutes. I was getting offline reports once or twice a day, but it would always be back online within 1-2 minutes. I’m not sure of the cause of this. It could be WIFI connection, although I’ve got a Google mesh network that seems very reliable.

It could be a bug that prevents it from sending on time. Monitoring the log for extended periods of time I was surprised to see how much time it was taking to send a message via SSL.

WIFI message sends over SSL were taking 3+ seconds, which seems like a very long time. I measured a few that took 4-7 seconds. I had to set the watchdog timer to 8 seconds to avoid resetting the monitor if the send takes too long. I don’t think this was the cause of going offline because the monitor sends a power on message when it boots and there was no log of this.

I figured I would switch to wired ethernet since i already had a network line run to the panel. I purchased an Arduino MKR ETH Shield which plugged directly into the Arduino MKR WIFI 1010 I am using. I thought this would be a simple change to the code.

Although the MKR WIFI 1010 has a special ship to hold certificate secrets, I didn’t find any libraries which could use this for Ethernet. I did eventually find a library that could handle SSL over ethernet. These messages were taking over 7 seconds to make the SSL connection! I’m surprised at the state of SSL. it seems current SSL encryption requires too much computation. Regular HTTP is pretty quick, usually less than one second.

I considered just using HTTP, however the Azure Static Web Site doesn’t accept HTTP connections. I started experimenting with doing some lightweight encryption on the Arduino and found a library that could do AES 128 quickly. This would be good enough for alarm status data. I created an Azure function that accepted an encrypted POST from the Arduino on HTTP and would decrypt and forward to the normal status API.

This allowed posts to occur under one second, typically around 600ms including the encryption. This was good enough.

I plugged in the ethernet shield to the live monitor and updated the software. It was working for for about one hour when it went offline. It didn’t come back online like before. I connected the computer to view the log output and it booted up and started running. I suspect the 7805 voltage regulator powering the Arduino just could not handle both the Arduino and ethernet shield. It got too hot and shutdown.

I plugged in a USB power supply to the usb cable to take the load off the voltage regulator. It ran for about one day and then stopped, and again the Arduino appeared to be hung since it booted when I connected the mac.

I put the WIFI code back in place and proceeded to investigate power and ethernet options.


June 1, 2022

Hit an important milestone today! I can connect to a website that displays the panel buttons virtually. I can enter codes and arm and disarm as needed! Panel responds immediately. Switching hardware is working perfectly.

Here's a couple photos of the website - works on my mac and iphone:

Prototype2 Prototype2

Below is a screenshot of the transmit line and the switching signal. At this point I am transmitting a custom command to the panel from the website. For example, to arm or disarm:

Prototype2

Now I can finish up the reporting side of the software and try to connect a dispatch API.


May 24, 2022

I was thinking about the last prototype and that it is dependent on having the Arduino reliably send the intercepted keypad commands all the time. Only a few missed message ends up showing a system fault on the alarm.

As I thought about it, 99.9% of the time, I want the keypad messages to go straight through. Only once in a while will I want to send my own custom commands, to arm or disarm, for example. What would be really nice is to have some kind of switch that lets the the keypad commands go through to the panel except in the case that I want to send my own custom command, I could flip the switch, send my command, then restore the switch for normal operation.

I researched a little and found what looked like a suitable component, a CMOS analog SPDT switch IC from Vishay DG419: https://www.vishay.com/docs/70051/dg417.pdf

Reading about this chip, it seems to provide what I want. It’s a switch that can work in both directions and is controlled by a digital signal. All I need to do to use it is one more digital output on the Arduino to control this switch.

I ordered a couple of these switches and when they arrived I wired up a breadboard circuit to test it and it seems to work! This lead to a new schematic and prototype #4:

Prototype2

Prototype2

Prototype2

I modified the test software I was using that was passing the keypad commands through to the panel. By default the switch is in its normally closed position and keypad commands go directly to the panel bus. I made it so that every 10th response sent by the keypad, will trigger the switch and the Arduino generated message will be sent to the panel bus.

This can be seen below. This image shows the green RX from the panel with the switch control.

Prototype2

This image shows the TX to the panel with the switch control. You can tell it is sending the Arduino message because it is slightly longer.

Prototype2

I made a combined image below that shows both signals with the switch control. This gives a sense of the overall timing.

Prototype2

Now I can clean up the software to send just the custom commands and remove stuff I don't need. This seems like the ideal solution so far.


May 19, 2022

I had to rework the two way prototype as it didn't seem to reliably be able to send the keypad commands on the bus. The level converter seemed to work fine on the breadboard, but it appears it just couldn't push the output hard enough.

Below shows both the data from the panel and the transmission bus on the bottom. Both keypads output can be seen here. The longer yellow transmission line is second non-intercepted panel and the shorter is the the intercepted panel with the transistor driver. Notice the scope can only decode the non-intercepted panel.

Prototype2

Below is a good send, which is coming from the other non-conncted keypad. It shows 12.6 volts.

Prototype2

Below is a bad send, coming from the level converter. Notice the voltage here is only 9.8 volts. I believe this was the cause - it wasn't driving the output enough to be reliably recognized. Even the scope could not decode the signal.

Prototype2

I ended up adding a darlington transistor pair on the output which seems to fix the drive problem. Now the intercepted panel command seem to have better strength than the second panel. Both the scope and panel can decode both signals.

Prototype2

Here's the new schematic:

Prototype2

Prototype2

This has run for 24 hours without error so it looks like it is time to work on the software for the intercepted version. I'm planning on having the arduino listen for HTTP server requests and return a simple webpage that will allow interaction with the panel, for example sending arm/diarm codes, reset, etc.


May 8, 2022

I've been running the monitoring prototype for about 4 months connected to my live alarm system. Initially I had to make a few adjustments to the code to handle repeated Wifi disconnects. Not exactly sure of the cause, since Wifi environment is pretty stable, but some reconnect code seemed to allow it to cover quickly.

I have Ardino reporting all alarm panel messages to an application running in Azure which collects data to a SQLite database and allows me to review data.

Prototype2

It reports status every 5 minutes even if there are no changes. Timer functions in Azure can detect if panel hasn't reported in and will send Device Offline notice to me. I don't have it connected to a dispatch API yet, but that is about all that is left to complete in the monitoring site. Below is an overview of the architecture:

Prototype2

I'm thinking about building another prototype as I really would like to be able to interact with the alarm panel remotely. Mainly to be able to disable prior to entering the house so as to avoid waking everyone up after early morning outing.

I've been experimenting with a different device from SparcFun which makes the interface to the alarm panel less complex. SparkFun Logic Level Converter - Bi-Directional approx $3.50 each (https://www.sparkfun.com/products/12009)

I will continue testing this device and will post updates shortly when I have it running against the live panel.

Prototype2

Prototype2


December 22, 2021

I wanted to get my prototype into testing and see how reliable it was, but I was reluctant to hook it up to my live alarm panel. Since it depends on intercepting panel messages and resending them on the bus, it seems like any issues could interrupt normal operation and at the very least cause errors. And alarm errors ocurring at 3AM would not be much fun.

So I thought about building a new prototype that worked in listen only mode on the alarm bus. This way there wouldn't be any chance it interfers with normal alarm operation. I modified my design a bit to intercept only, see below:

Prototype2

And built a prototype: Prototype2 Prototype2

I've had this running for a week or so on my test panel with no issues. I was curious how the voltage regulator would work out to power the arduino. So far no problems. When working with my first prototype I actually ordered and experimented with 2 different isolated voltage regulators (RECOM RM-1205S/H and Murata NMA2405S) which were supposed to be able to convert the 12v from the panel to 5v for arduino. I had no luck with either of these. I assume I'm doing something wrong, but they either output more than 5v (like 6-7v) which might fry the arduino, or they output practically nothing. I went back to the non-isolated 7805 for this attempt.

This prototype came together quickly and I soon had it monitoring the alarm bus. This allowed me to work on the server side components, an azure website that would record the alarm events and dispatch messages or alarms if detected.


October 26, 2021

This is my current state. I've built an interface board to go between the napco keypad and the alarm panel that can intercept keyboard commands, forward them to the panel or send alternate commands to the panel, and finally monitor requests from the panel. This doesn't require programming an extra keypad; it can plug into an existing keypad.

Below is a diagram of the intercept concept Intercept

This interface board uses an Arduino MKR 1010 WIFI and 2 optoisolator boards from Sparkfun (https://www.sparkfun.com/products/9118). This Arduino model can program digital pins to be additional serial port, so I have two receive and one send.

I had many previous versions both isolated and non-isolated. The first iteration is at the bottom of this description. My next attempts included isolation using with some 4N35s. This worked but wasn't great. I tried one of the Sparkfun isolator boards and it had much better resulting signals (it uses a ILD213T chip plus transistors). When they sent me an extra one by mistake I decided to go fully isolated in both directions. You can also get chinese versions of this board for less than $1. It took a little more circuitry and a couple transistors and resistors before I could reliably drive the transmission line to the panel.

Below is the interface board prototype Prototype

Below is the interface board breadboard Breadboard

Below is the schematic I'm using currently. I built this on to a breadboard and used a couple ribbon cables to connect to the keypad. Schematic

Below is an example of the signals showing transmission to the panel at the top in purple and data from the panel on the bottom in yellow. Oscilliscope

The yellow line shows data coming from the panel. Requests are identified for each keypad. The keypad will respond to requests identified for the keypad. With the intercept setup, messages from the keypad go through the arduino and are normally just forwarded to the transmit line. If we want to send a message on behalf of a specific keypad, that can be done by sending our own message instead of the one sent by the keypad.

I'm currenty working on software for both the Arduino as well as some cloud services to receive updates and dispatch alarm notifications.

More details to follow...


September 29, 2021

This was my initial attempt at monitoring communications frmo the Napco panel.

Arduino Sketch to monitor serial communications from Napco 1632 Panel to keypad

This effort was inspired by: https://www.wizzycom.net/napco-1632-virtual-keypad-project

Use to analyze data from RX and TX to keyboard from Napco 1632 panel. I used Arduino MKR WIFI 1010 which has separate serial port identified as Serial1. Connect to wiring diagram below and run monitor to see data received. Reconfigure using next wiring to see data sent by keypad. There is a good chance second diagram works for both. I tried the receive voltage divider first and it worked, but did not work for sent data.

Monitoring data received by keypad:

                  1K               300 ohm
KEYPAD GREEN ---/\/\/\/\----.----/\/\/\/\------ ARDUINO GROUND PIN 
                            |
                            |
                   ARDUINO PIN 13 -> RX

Monitoring data sent from keypad:

                    9K               3.1K
KEYPAD YELLOW ---/\/\/\/\----.----/\/\/\/\------ ARDUINO GROUND PIN 
                             |
                             |
                    ARDUINO PIN 13 -> RX

Arduino Sketch: https://github.com/cborrowman/Napco1632ArduinoMonitor/blob/main/ino/SerialPassthrough.ino


All information provided is for entertainment purposes only and you should use at your own risk. Nothing presented here is intended to suggest this could become a reliable life-safety monitoring device.

Hits