This project modifies a DSC Home Security system to be internet enabled and self-monitored using a Raspberry Pi 3 Model B+ and an EnvisaLink add-on card.
Here are some added features:
Send security alerts to a mobile phone
No monthly fees - self-monitored security system
Provide a simple, secure website for remote or local access to check or arm the system
A Raspberry Pi 4 can be used, but the additional processing power is not required.
A self-monitored system eliminates monthly costs. In addition, if a security monitoring company calls the police and nothing is wrong, then the homeowner must pay a false alert fee. With a self-monitored system, the homeowner decides if a call to the police is warranted.
Security alerts are audible in the home, and are sent to one or more mobile phones.
I did the original version of this project in 2015.
My DSC security system was very good for its time in 2008, but since then security systems have advanced to include many more components. Basically, the DSC system covers windows, doors and motion sensors. It doesn't include: smoke alarms, carbon monoxide detectors, doorbells, garage doors, security cameras and so on. This is a reason to redo this project using only a Raspberry Pi.
A really nice feature is all of the DSC sensors are all wired and powered from a central location. So, there are no batteries to replace.
The sensor security system is a complex project and it took me several weekends to get running. So, I split the project steps into Parts.
Because this implementation may not work for everyone, I pushed the required tools and required parts to Part 2. In Part 1, Step 3 you will know whether or not you can continue and if the parts and tools are actually needed.
The diagram on the left shows the main hardware components and how the hook together. The sensors and the keypads are not shown.
The diagram illustrates why the security system should be redone using just a Raspberry Pi. The security system is unnecessarily complex.
Step 1.1: Find Your Keypad Model Numbers
Find keypad model number. The DSC keypad is near a door (see image below). In my house, there is one keypad by the garage door and one by the front door.
Find control panel model number. The keypad has a sticker on the top, and the model number is in the middle. Mine is a PK5501 .
Another way to do this is:
On a computer, open a browser
Step 1.2: Find Your Control Panel Model Numbers
My control panel is located in a metal box in a closet. Open the metal box and in the center of the control panel is a sticker with the model number. My control panel model number is PC1616.
Step 1.3. Check If EnvisaLink Is Compatible With Your Security System
Click on the eyezon.com. Or google with:
envisalink compatibility inurl:eyezon.com
Search the site to see if your system is compatible. If not check with EyezOn.
If your system is not compatible then stop.
The current EnvisaLink is 4. This guide uses an EnvisaLink 3.
Step 1.4: Gather Necessary Documentation and Understand How Your System Is Configured
Complete or Find your Home's Programming Worksheet
The Programming Worksheet is a place to record your system’s configuration.
I wanted to understand how to control the security system and spent a lot of time reading through the References at the end.
The previous homeowner did not leave a completed Programming Worksheet. I had to fill this out myself. Basically, I used the keypad to enter commands until I had everything figured out. Okay, I lied. Use the worksheet as a guide, but record your system’s config in a normal sized document.
Step 1.5. Take photos of everything
In the future, you may want to restore the system back to the way it was. So, take photos of everything before making any changes.
Step 1.6: PC1616 wiring diagram
My PC1616 Wiring Diagram is on the inside of the DSC case.
My security sensor wiring is a mess.
Door contacts and window contacts use a red and black wire.
Normally, the red goes to either the Z (zone) or COM (common) inputs. And the black wire goes to the other. As you can see red wires go into both Z and COM.
It doesn't matter which wire goes to which input because the sensors are normally closed circuits.
Motion sensors require power and use 4 wires. Traditional electrical wiring has black as hot (aux +) and white (red as aux -). The other two wires which are either: white and green, or yellow and green I tie into the Z and Com.
Zone 1&2 go with first COM port; Zone 3&4 go with 2nd; and Zone 5&6 go with 3rd. Since the sensors are normally closed, if EOL is set then a 5.6K ohm resistor is required on each zone input. However, my board does not have EOL and so there are no resistors.
My sensor wiring diagram, as best as I can unravel it.
None of the recommended witing standards seems to have been followed.
The orange line is red in real life, but should be a black wire.
The blue line is black, but should be a red wire.
The grey wire in the image is actually white.
The little blue boxes are the white b-connectors, which splice wires together by inserting the wires and then crimping.
Below is a table showing how my sensors are wired. The table below shows one reason to build a security system using only a Raspberry Pi. The reason is there aren't enough zones to uniquely identify windows by room.
Required Parts:
EnvisaLink 3 - $119 + S&H. www.eyezon.com. I think this guide and the code should work with the EnvisaLink 4
PoE switch (any PoE switch will work. I am using a NetGear 24-port PoE Managed switch)
Invisible Dog Fence or Thermostat wire - must be solid wire
Four 18-22 gauge AWG wires about 6 inches long (red, black yellow, green)
CAT5E or CAT6 Ethernet cable
SPST Mini Momentary Push Button Switch, normally closed
Small plastic case (dental floss case from dentist's office)
Raspberry Pi 3B+
Nylon M2.5 nuts, standoffs and screws
Required Tools:
Wired DSC Security system with PK5501 Keypads, PC1616 control panel and multiple sensors (windows, doors, and motion). The security system came with the home.
My Internet Service Provider (ISP) is AT&T GigaPower, which comes with a gateway. Any ISP can be used. Speed doesn't matter.
Needle nose pliers
Drill and 3/16” metal drill bit and very small drill bit
Black electrician’s tape
Very small flat head screwdriver (I have one to fix my eyeglasses when the screw falls out)
Exacto knife
MacBook (but a PC can be used)
Step 2.1: EnvisaLink Mounting
My PC1616 is enclosed in a metal case. Locate your security system and the PC1616 board shown above. Depending on your Security System's box, your mounting may be different. You'll need enough room to connect wires and an ethernet cable.
Use the EnvisaLink 3 to create a paper template for the offset holes. The template is used to mark holes on the metal case. Because it was easier to screw from the outside of the box to the inside, I had to reverse the template.
Scotch tape the template to the outside of the metal box containing the PC1616. Pick a spot that has enough room to accommodate the EnvisaLink 3.
Very slowly, using a 3/16" metal drill bit and the template, drill 3 holes in the side of the metal box.
From the inside of the metal case, push in the plastic offsets into the holes
Install the EnviaLink 3 board in the metal box on the plastic offsets (see image below).
Use M2.5 screws, standoffs and nuts to mount the board
Step 2.2: Powering the EnvisaLink
I should not have followed the instructions that came with the EnvisaLink 3.
The first step in the instructions is to disconnect power from the PC1616. I assumed this meant both the AC power and the battery backup power. I disconnected both, and then had to make a call to a technician get the keypads back on-line. The service call was $135.
Disconnect the AC power black wire from the DSC Controller. This is the second wire(s) from the left. Be careful not to let the exposed end of the black wire(s) touch anything. I wrapped the end in electrical tape until I finished the next steps. If the black wire(s) touches anything, the transformer will short and you will have to call a service company to replace.
Strip 1/4" from both ends of the red, black, green and yellow wires (or you can cut an RJ11 cable and use the wires inside). While either will work, solid thermostat wire is better than twisted wire because the on-board connectors grip the solid wire more firmly. If using twisted wire, then twist ends tightly, which will make it easier to install.
Using a very small flat head screwdriver, install colored wires into appropriate slots on EnviaLink 3.
One-by-one, loosen red, green, yellow, and black screws on DSC controller but ONLY enough to slide new wires in. Insert appropriately colored wire and tighten.
Reinsert AC power (removed in first bullet) to the DSC controller.
Using a CAT5e or CAT6 cable connect EnvisaLink 3 to router.
Step 2.3: Install a Momentary Power Push Button Toggle
This step is optional.
I had many issues programming the Envisalink and DSC Controller. I found toggling the power off and on got the system back to a known good state. Later, I added a momentary push button toggle. There are many types of toggles. Normally closed is the one needed.
Get a small plastic box. I used a dental floss case, which is the kind a dentist might give you during an appointment. Remove the floss and the metal clips.
Drill two small holes for the AC wire
Drill or cut a hole for the momentary toggle. I found it was easier to use an exacto knife then drill a hole. Open the case and cut half the hole on one side of the opening and the other half on the adjacent side. So, when the momentary toggle slides in one side and when the case is closed the momentary toggle is firmly attached. If the toggle is not firmly attached, add some hot glue on the inside of the case to hold the toggle in place.
Remove AC power from Envisalink. Run AC power wire through one of the small holes and connect to lead on momentary power switch. Wrap in electrician’s tape.
Strip ends of a 3-4 inch piece of wire. Run one end through the other small hole in the case and connect to the other lead on momentary switch. Wrap in electrical tape.
Connect 2nd wire from momentary switch to Envisalink AC power slot
Use scotch tape to seal case
Check if toggle works. The system should normally be on. When the toggle is pressed the lights on the Envisalink will go off.
Step 2.4: Check EnvisaLink 3 Installation
Open a browser and go to your router’s home page.
Open a browser
Enter [Router IP Address]
On Home tab scroll down to Home Network Devices
My Gateway (or router) shows something like the image above.
Scroll down to the device, and it should look like the image below.
An Active Status means the board is installed and operating.
The gateway should also show the ♣envislink-ip-address♣
Step 2.5: Login to EnvisaLink 3
Click on Details to get the IP address of the EnvisaLink. The IP address can change from time-to-time.
Open a browser and enter one of the following
♣envisalink-ip-address♣
♣envisalink-ip-address♣:80
Enter user name and password:
default username = user
default password = user
Step 2.6: Change EnvisaLink 3 Password
Change the user password. Click on Network in the upper right. The screen should look like the image below.
Enter a new password in Change User Password text box. Click Change. Record the new password
envisalink username] = user
envislink password = ♣envisalink-password♣
A simplified software block diagram shows the major components of the security system. The red items run on the Raspberry Pi.
Step 3.1: Setup Raspberry Pi
In Step 3.1, don't put the Raspberry Pi in a case.
Since the code is in python and not dependent on the OS, the latest version of Raspbian can be installed
This application runs headless, which means it does not have a display or a desktop. So, use the Raspbian Lite download
After set up, you should know
♣raspberry-pi-ip-address♣
♣hostname♣
♣raspberry-pi-password♣
Step 3.2: Raspberry Pi Mounting
Measure, measure, measure, ...
I am putting the Raspberry Pi (RPi) inside DSC's security system box. I am sure this voids all kinds of warranties. So, don't do it!
Since it is inside a grounded metal box, the Raspberry Pi needs an ethernet cable, and the RPi needs power. I am using PoE. So, I only need an ethernet cable to the PoE switch, which supplies both an internet connection and power.
The RPi must slide in between the battery and the EnvisaLink board (image below. left side is door), and there must be enough room to remove the microSD card if it needs to be reflashed
I took the front cover off the box to drill the holes (image above). I used a 3/32" metal drill bit. The RPi has M2.5 mounting holes. #/32 ~= M2.5.
Mount the RPi using 4x M2.5 nuts, offsets (hex nut with bolt) and bolts.
Step 3.3 Update and Upgrade
Step 3.4: Disable Wi-Fi and Bluetooth
Step 3.5: Install SQLite on Raspberry Pi
Step 3.6: Add ssmtp email support
Step 3.7: Install Apache2 and supporting packages
then install other packages
$ sudo apt-get -y install php php-gd sqlite php-sqlite3 php-curl php-zip php-xml php-mbstring libapache2-mod-php -y
Step 3.8: To Communicate Between the EnvisaLink 3 and Raspberry Pi Load Mod_wsgi
Need mod_wsgi to get it to work on Raspberry Pi.
Open a terminal window on MacBook, and login to Raspberry Pi:
Download a script:
$ wget "https://raw.githubusercontent.com/dumbo25/ev3_cmd/master/ev3pi.py"
Edit the file, and enter your password
$ nano ev3pi.py
Replace <password> with your password and save (Use CTRL-w to find password). Do the same for <master code> and <installer code>
self.password = <password>
self.masterCode = <master code>
self.installersCode = <installer code>
self.host = 192.168.1.92 change to your envisalink's IP address
Temporarily, change these as well, to be as shown:
self.file_log = sys.stderr
self.file_logging = True
self.input_db = False
Save the file and exit (CTRL-o, ENTER, CTRL-x)
To run ev3pi.py on Raspberry Pi command line:
$ sudo python ev3pi.py
The first time the script runs, it will initialize the database
Type [return] to see valid commands.
Type in panic to start the alarm, and then disarm to stop it:
panic
disarm
To stop ev3pi.py, type CTRL-c
Edit ev3pi.py, and restore the defaults:
self.file_log = open('/tmp/envisalink.log', 'w')
# self.file_log = sys.stderr
self.file_logging = False
self.input_db = True
Change permissions on the following:
$ sudo chmod og+rw /tmp
$ sudo chmod og+rw /tmp/envisalink.log
Step 3.9: Move the script and Change privileges
Open a terminal window and ssh into Raspberry Pi
Move script to /usr/local/bin and change privileges
$ sudo mv ev3pi.py /usr/local/bin
$ sudo chmod ug+x /usr/local/bin/ev3pi.py
Change the script so it runs on Raspberry Pi with no display or command line. The comments in the script explain what must be done. Be sure to use the db in /var/www/db/security.db
Step 3.10: Get a Web Page running
The website display the status of the script and Arms and Disarms the system (see image above)
This is a pretty simple webpage.
ssh into the Raspberry Pi and install php, download the index.php code and move things about:
$ wget "https://raw.githubusercontent.com/dumbo25/ev3_cmd/master/index.php"
$ sudo mv /var/www/html/index.html /var/www/html/index.backup
$ sudo mv index.php /var/www//html/index.php
$ sudo chown -R pi:www-data /var/www/html/
$ sudo chmod -R 770 /var/www/html/
$ sudo reboot
In a browser, enter the ♣raspberry-pi-ip-address♣ and you should be able to see the web page
Clicking on a security command on the website, writes the command to the database.
On the next pass through the main loop, the command should be read and executed.
Step 3.11: Add a bash script that checks whether or not ev3pi.py is running
If ev3pi.py stops running for some reason, then it should start running automatically. This script attempts to restart the script.
Download the ev3chk.sh using this command on the Raspberry Pi:
$ wget "https://raw.githubusercontent.com/dumbo25/ev3_cmd/master/ev3chk.sh"
Move the script and change its access
$ sudo mv ev3chk.sh /usr/local/bin
$ sudo chmod ug+x /usr/local/bin/ev3chk.sh
Step 3.12: Python script that automatically arms and disarms the security system using a schedule
This script uses a schedule to arm and disarm the security system based on user entered time of day and day of week. If the vacation field is set, then arming and disarming will be ignored.
Download the ev3auto.py code using this command
$ wget "https://raw.githubusercontent.com/dumbo25/ev3_cmd/master/ev3auto.py"
Move the script and change its access
$ sudo mv ev3auto.py /usr/local/bin
$ sudo chmod ug+x /usr/local/bin/ev3auto.py
Step 3.13. crontab to check if script is running
Edit the Crontab to ensure the scripts are running.
Login to Raspberry Pi
$ sudo crontab -e
#
# check every 5 minutes if security system is running
*/5 * * * * /usr/local/bin/ev3chk.sh >/dev/null 2>&1
#
# check every 15 minutes if security system is in good state
*/15 * * * * python /usr/local/bin/ev3auto.py >/dev/null 2>&1
Check if the main script is running:
$ ps aux | grep ev3pi.py
Step 3.13. Check that website is working
Open a browser and go to either:
♣raspberry-pi-ip-address♣
♣hostname♣.local
both should open the window on the left
Click on Panic Alarm
Click on Disarm
Step 3.14: Control Security System with Alexa or Echo
Step 3.15: Restrict Access to Web Server (certs)
The webserver can be accessed from your mobile phone when you are away from home securely if
certificates are installed on both your mobile phone on the Raspberry Pi,
your gateway port forwards https requests to your Raspberry Pi
port 80 (http) is disabled on your Raspberry Pi Apache web server
Notes:
As of 11APR2020, Eyez-On currently sells an EnvisaLink4. This project uses the EnvisaLink3
If a thief cuts the ISP's cable or internet service is lost, then monitoring from the Internet is disabled
Future: The work-around for this issue is to use a low-cost LTE backup-only service
DSC sensors do not indicate if the doors are locked, only that they are closed
Added August Door Locks, which can determine if the door is closed and locked.
DSC sensors do not indicate if the windows are locked, only that they are closed
DSC supports integration of fire alarm. However, my home’s fire alarm is not integrated
Future: integrate fire alarm into DSC control panel
The installed DSC system does not have a sensor for the overhead garage door
Added MyQ, which can open and close the door, and determine if the door is opened or closed
References:
How to Program a DSC System – A Tutorial - required for me to understand the TPI document
EnvisaLink TM TPI Programmer’s Document, version 1.04 – describes the TPI command set
Programming Worksheet – a horrible, poorly named document, which describes your security system’s configuration
Security System Support - Implementing this project was quite complex. However, if you are just trying to get your system running using this guide then you don't need to go through all those steps. I moved all of those extraneous steps to this link.