Modify an existing DSC Home Security system to be internet enabled and self-monitored.
This instructable assumes you have a working Raspberry Pi.
Please note this implementation has the following shortcomings:
- If a thief cuts the in-coming DSL 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 or windows are locked, only that they are closed
- Future: Add a push button toggle that is activated by the door lock’s bolt. This will take significant work to run the wiring without destroying the door jamb
- 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
- Earlier, I created a Garage Door Opener instructable and I can read the door is open or closed
The goals of this project are to:
- Send security system alerts to my mobile phone
- Check or set the security system status from a secure-web page
- Run the solution on a secure raspberry pi (https and certs)
- Use the existing DSC system to self-monitor
- Add EnvisaLink 3 to add Ethernet support to the DSC system
- Write self-monitoring software
- Create an instructable for this effort
Please Note: In this document, text enclosed in [square brackets] should be replaced with an actual value
My family has never had our home robbed, and we live in a low-crime area. There is no compelling reason to do this project, except it was interesting and fun.
Please note there is an excellent short cut to this instructable. Once the Envisalink 3 is up and running, you can use the off-the-shelf solution provided by Eyes-On called EnvisAlerts and EnvisAlarm, which sends alerts and monitors your home and/or a very cool cell phone mobile app called DSC Security Server by Mike P. I signed up for EnvisAlerts, and bought Mike P’s DSC Security Server. I was very pleased with both, but wanted my own version.
Step 1: Troubleshooting and Unique Data
There are certain data that I refer to often and I like to include this data in the front.
Alarm – enable and disable
Ensure all doors and windows are closed. On the control panel, enter the master code:
[master code] = [your master code]
Disable phone line
My house has a telephone land line, but I do not have land line service. Around 11pm every night the system beeps. If the system loses power, then this has to be re-entered. To disable this beeping, on the keypad enter the following:
- Disable the phone line: *8 5555 015 7 ##
- Turn off phone line test transmissions *8 5555 371 9999 ##
- Turn off the phone dialer: *8 5555 380 1 ##
Envisalink Alert Server
Login to Envisaiink
Get Envisalerts Server: 184.108.40.206
Open U-verse router: 192.168.1.254
Go to Settings, Firewall
Enter Envisalink IP address: http://192.168.1.92/3
[envisalink username] = user
[envislink password] = [enter your password]Envisalink IP Address
[Envisalink IP address] = 192.168.1.92
Eyes-on Username and Password
[eyes-on username] = [your envisalink username]
[eyes-on password] = [your envisalink password]
[Installer’s Code] = [Enter your Installer's Code]
5555 is the default code. You can ask your installer for the code, or you can do a factory reset, which puts it back to 5555. I do not recommend doing a factory reset because there is a significant possibility of damaging the system.
[MasterCode] = [enter your master code]Raspberry Pi IP
[Raspberry Pi IP] = [enter your Raspberry Pi IP address, something like 192.168.1.57]
Raspberry Pi login from Mac Book
On Mac Book, open terminal
ssh pi@[Raspberry Pi IP]
Raspberry Pi password
Password = [your Raspberry Pi password]
Router IP Address =[enter your router's IP address]Set DSC Time and Date
hh are in military time, for pm add 12. So, 4pm is 16
Zone Alarm Type
01 - Alarm after providing a delay (default 60 seconds) in Stay or Away mode
03 – Alarm instantly if violated when in Stay or Away mode
05 – Interior motion sensor. Alarm instantly if violated only when the Away mode (bypasses when in Stay)
On keypad, enter:
*8 [Installer Code] 001 01 03 05 05 87 # #
Explanation of above code sequence:
- *8 [Installer's Code]
- 001 – This gets you into zone programming for zones
- 01 03 05 05 87 – This is my sequence of zone alarm types, in zone order from 1 to 5.
- All zones must be properly set.
- # # – This saves what you’ve done and gets you back out of programming mode.
Step 2: Find Your Keypad and Control Panel Model Numbers
Find keypad model number. The DSC keypad is near a door (image 1 & 2). 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 (image 3 & 4).
Another way to do this is:
- On a computer, open a browser
- Go to http://www.dsc.com/index.php?n=enduser&o=identify
My control panel is located in a metal box in a closet (image 3). 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 (image 4).
Step 3: Check If EnvisaLink 3 Is Compatible With Your Security System
Click on the eyeson.com link.
Scroll down to panel compatibility and see if yours is listed. If not check with EyesOn.
Step 4: Get DSC Documentation
DSC offers a User Manual, but most of the other documents require you to be an installer
- For the control panel, find the Installer’s Manual, User Manual, Reference Manual, and Programming Worksheet.
- For the keypad, find the Installation Manual. The manual’s I found were all PDF files.
Several non-DSC sources of DSC manuals are available on-line. DSC manuals are not required for this instructable. These are merely references if you want to extend the instructable or if your system uses different parts.
LiveWatch.com is the best source of DSC manuals. LiveWatch was also very helpful in answering questions and getting me unstuck. I could not have completed this instructable without help from LiveWatch.
Step 5: Buy or Gather Parts and Tools
A) DSC Security system with PK5501 Keypads, PC1616 control panel and multiple sensors (windows, doors, and motion). The security system came with the home.
B) Order EnvisaLink 3 - $119 + S&H. www.eyezon.com
C) AT&T U-verse internet provider, DSL Gateway
D) 24-port NetGear Managed switch
E) Invisible Dog Fence or Thermostat wire
F) CAT5E Ethernet cable
G) Four 18-22 gauge AWG wires about 6 inches long (red, black yellow, green)
H) Needle nose pliers
I) Drill and 3/16” metal drill bit and very small drill bit
J) Black electrician’s tape
K) Very small flathead screwdriver (I have one to fix my eyeglasses when the screw falls out)
L) SPST Mini Momentary Pushbutton Switch, normally closed
M) Small plastic case (dental floss)
N) Exacto knife
Step 6: EnvisaLink 3 Installation
I should not have followed the instructions that came with the EnvisLink 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.
- My PC1616 is enclosed in a metal case. Locate your security system PC1616 board.
- Use the EV3 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 EV3 board in the metal box on the plastic offsets.
- 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.
- Disconnect the AC power black wire from the DSC Controller. This is 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.
Using a very small flat head screwdriver, install colored wires into appropriate slots on EV3.
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 G) to the DSC controller.
Using a CAT5e or CAT6 cable connect EnvisaLink 3 to router.
Step 7: Install Momentary Power Push Button Toggle
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 toggle. The normally closed is the one needed.
A) Get a small plastic box. I used a dental floss case, which is the kind a dentist might give you after an appointment. Remove the floss and the metal clips.
B) Drill two small holes for the AC wire
C) 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.
D) 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.
E) 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.
F) Connect 2nd wire from momentary switch to Envisalink AC power slot
G) Use scotch tape to seal case
H) Check if toggle works. The system should normally be on. When the toggle is pressed the lights on the Envisalink will go off.
Step 8: Register EnvisaLink 3
Once registered, you cannot unregister. EyesOn collects your data and may upgrade your board’s software at any time, without any notification. If I were to do this again, I would not do this step.
A) Open a browser and go to www.eyezon.com, Support drop down and select EnvisaLink 3 Primer Guide
B) Follow the directions in the Primer (Register, Login, Add New Device, etc,)
C) Username = [eyes-on username]
D) Password = [eyes-on password]
Step 9: 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 U-verse Residenial Gateway (or router) shows something like the Image 1.
Scroll down to the device, and it should look like image 2.
An Active Status means the board is installed and operating.
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
[Envisalink IP address]
Enter user name and password:
Enter username and password from installation guide. The browser should show something like image 3.
Step 10: Change Default Password on Envisalink 3
A) Open browser
B) Go to [Envisalink IP Address] /:80
An example is 192.168.1.34/:80. The /:80 is the port.
C) In Change User Password” change password. Note: default username and password is user
D) Record [envisalink password]
Step 11: (short-cut) Generate Mobile Link [optional]
You don’t need to do this step or the next, but if you want to be done, then this is a good option.
Eyez-On offers a complete monitoring service. It is easy to use and works well. If you want to do use this service then follow the instructions in step 10 and 11. Otherwise skip ahead to step 12. Please note, I did both 10 and 11 and then had to disable them. Both services worked fine and I had no issues, I just wanted to do it myself.
A) Open browser and go to Eyez-On
B) Login (in an earlier step you should have created an account)
C) Select Mobile Portal Link
D) Click generate mobile link
E) The link is long. Email it to your mobile device.
F) Open the link on your mobile device
G) Open another browser window or tab and go to Eyez-On, select support and select EnvisAlarms Monitoring Primer from drop down
H) Follow directions to download EV3 self-monitoring software
I) Follow the directions to set-up how you want to monitor
Step 12: Install DSC Server App on You Smart Phone [optional]
You don’t need to do this step or the previous one, but if you want to be done, then this is a good option.
A) Go to the Android or Apple store and buy the DSC Security Server app from Mike P.
If you did the two previous steps, then you are done! You should be able to monitor and control your security system remotely.
Step 13: Important Notes About Envisalink 3 and PC1616
Communication from Envisalink 3 to EnvisAlerts uses UDP. Communication from Envisalink 3 to script uses TCP/IP.
The Envisalink 3 Ethernet port only communicates at 10Mbps. Most 1Gb or 100Mb Ethernet routers and switches will auto-negotiate down to 10Mbps.
In section 022 of the PC1616, option 1 cannot be enabled. This option requires a user access code to access user functions like bypassing zones, etc. The option is off by default.
Keypad Blanking and Zone Bypassing must be off for the Envisalink to work.
Step 14: Undo the Work in Previous Two Steps
Initially, I signed up for Envisalerts and for Mike P’s app.
Since I don’t want to send my security information sent to the internet, and I don’t want the Envisalink 3 software updated without my okay, I needed to block the Envisalink 3’s access to the internet.
A) Open browser
B) Go to AT&T U-verse 3801HGV gateway. Enter in browser’s URL Box: 192.168.1.254
C) Login into gateway
D) Go to Home
E) Scroll down to Envisalink
F) Click on details
- Save MAC Address (aka Hardware address) = [Envisalink MAC address]
- [Envisalink MAC Address] = 00:1c:2a:00:9d:07
G) Go to Settings >> LAN >> Wireless
H) Scroll down to enable MAC Filtering
I) Click on MAC filtering
- Click on Edit Blocked/Allowed Device List
- Click Enable MAC filtering
- Scroll down to Enter MAC Address
J) Paste MAC Address of Envisalink
K) Click add to list
L) Click >> to move to Blocked Devices
M) Scroll up and make sure MAC Filtering check box is checked
N) And Envisalink should be blocked
Step 15: Gather Necessary Documentation and Understand How Your System Is Configured
I wanted to understand how to control the security system. The best sources are:
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
The previous owner 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. The worksheet is a place to record your system’s configuration. Okay, I lied. Use the worksheet as a guide, but record your system’s config in a normal sized document.
Step 16: Third Party Interface (TPI) Programmer’s Document
The Third Party Interface (TPI) is a set of commands, responses and error codes allowing third-party applications to interface with the EnvisaLink 3 over a TCP/IP connection. I found this document very confusing. I hope this explanation helps explain the document a bit better.
In general, all TPI Commands, Responses and Error Codes are three digits:
- Commands are greater than or equal to 500
- Responses are less than or equal to 200
- Error Codes are between 000 and 027, but responses are also in this range
Data is appended to the end of a Command or Response. For example, a login command might be:
- pswd = is data, in this case, your password
The following are required:
- CS = checksum
- \n = newline character
- \r = carriage return character
On the web, I found many implementations for calculating the checksum. The checksum is required, and many implementations didn’t work. I am not sure why so many didn’t work for me. It may be bad code, or it may be different versions of the board or firmware versions running on the board. My checksum code works for my board and firmware.
The EnvisaLink acts as a server for a TCP connection to a Client application. The Client should only run on a secure server that can communicate with the EnvisaLink 3. The Client’s server should be on your home network, but should not be open to the internet. A self-signed cert is required (see my other instructable for a Garage Door Opener).
The EnvisaLink listens on port 4025 and will only accept one client connection. Subsequent connections will be denied. The EnvisaLink will close the connection if the client closes its side.
To initiate a connection:
- Client starts a TCP session by establishing a TCP socket.
- Client sends a login command 
- EnvisaLink responds with one or more 
- If  command’s data is a 3, then within 10 seconds respond with a login command 
- If  data contains a 1, then login is successful
The login command’s data is a password up to six characters in length, which is the same password to log into the EnvisaLink's local web page.
See 505 command description in the TPI manual for a description of all data.
Once the password is accepted, the session is created and will continue until the TCP connection is dropped.
Step 17: Command Line Control Script
I used documents from the previous step to develop an interactive python script that could be run from a command line on a Mac Book Terminal window. Here are some clarifying comments:
- I may have gone a bit overboard, but I think all the commands are in the script.
- The command-line python script, ev3.py, can be downloaded from this link: GitHub. Download ev3.py.
- Copy the script to a directory [directory].
- Open a terminal window (Click on MacBook disk, Applications, Utilities, Terminal).
- I use a terminal window often. So, I have the terminal app pinned to the dock.
- If running from a computer, change self.file_log = sys.stderr, as indicated in the script.
- In the terminal window, change to the directory and execute the script:
$ cd [directory]
$ python envisalink.py
- Type [return] to see valid commands.
- Type [ctrl-c] to exit the program.
Step 18: Brief Explanation
I want to set or monitor the security system from a smart phone, tablet or PC. A simple solution is to develop a website.
The command line python script monitors the security system, and can change the system’s state. However, it doesn’t provide good remote viewing capability.
A website provides an excellent interface for monitoring and changing the security system. However, the website is only “running” when it is being viewed. Whereas, the command line script should be running all the time. When the script is running, no one may be looking at the website. So, the data collected by the script should be stored in a database until someone wants to view it.
Also, a user should be able to change the security system’s state (arm, disarm). When state changes occur, the changes should be made quickly.
Both the script and database are potential points of failure, another script is needed that periodically checks if everything is working and restarts the script if necessary.
You will need to do these steps (see the Garage Door Opener instructable for some of these steps)
A) Setup Raspberry Pi – actually you can run this on any server
B) Install python
C) Create a self-signed cert and install on the Raspberry Pi and any devices you want to access the website
D) Block people without your self-signed certificate from accessing your security system
Step 19: Install SQLite
The usual DB choices are MySQL or postgres. This app needs something simple like a file. I knew SQLite was the correct choice when I read,
- http://sqlite.org/ is smaller than MySQL or postgres
- SQLite competes with fopen. and
- SQLite is not directly comparable to MySQL, or postgres because it is trying o solve a different problem.
Here is a great source for setting up SQLite: Install SQLite on a Raspberry Pi
Login in to the raspberry and run the command:
$ sudo apt-get install sqlite3
$ sudo apt-get install php5-sqlite
Create the database:
$ sqlite3 security.db
Create a table
sqlite > BEGIN;
sqlite > CREATE TABLE status (tdate DATE, ttime TIME, name TEXT, value TEXT);
sqlite > COMMIT;
Check the table was created correctly:
sqlite > .schema status
The table status will contain:
system: armed, disarmed
alarm: none, fire, panic, alert
zones[1-6]: open, closed
script: connected, logged-in, running
Insert some data into the table
sqlite > BEGIN;
sqlite > INSERT INTO status values(date('now'), time('now'), "system", "disarmed");
sqlite > INSERT INTO status values(date('now'), time('now'), "alarm", "none");
sqlite > INSERT INTO status values(date('now'), time('now'), "zone", "closed");
sqlite > INSERT INTO status values(date('now'), time('now'), "script", "running");
sqlite > INSERT INTO status values(date('now'), time('now'), "command", "");
sqlite > COMMIT;
Check values where entered correctly
sqlite > SELECT * FROM status WHERE name="zone";
sqlite > .quit
Move the db and change access:
$ mv security.db /var/www/db/security.db
$ chmod og+rw /var/www/
$ chmod og+rw /var/www/db/security.db
Step 20: Install SQLite on MacBook [optional]
I like to develop on the Mac and then move the results to the Raspberry Pi.
Go to download page on sqlite.org and download sqlite-autoconf-*.tar.gz from source code section
On MacBook open downloads from your account
Click on downloaded tar.gx file
Open terminal window
$ cd Downloads
$ cd sqlite-autoconf-[latest version number]
$ ./configure --prefix=/usr/local
The make takes a few minutes, be patient.
$ sudo make install
Confirm it works:
$ which sqlite3
Redo steps in previous step to setup database, table and enter data on MacBook (or use the script. If db doesn't exist it will create and populate).
Step 21: To Communicate Between the EnvisaLink 3 and Raspberry Pi Load Mod_wsgi
Need mod_wsgi to get it to work on Raspberry Pi.
Login to Raspberry Pi:
$ ssh pi@[Raspberry Pi IP Address]
then get mod-wsgi
$ sudo apt-get install libapache2-mod-wsgi
To run ev3pi.py on Raspberry Pi command line:
$ sudo python ev3pi.py
Step 22: Download Software From GitHub
Modify the command line script to write to the DB.
These are good explanations for connecting a python script to SQLite:
I modified the code to talk with SQLite. You can download the code here: GitHub. Download ev3pi.py.
Open a terminal window and copy command line python script to raspberry pi
$ scp ev3pi.py pi@:/home/pi
Login to pi
$ ssh pi@
Move script to /usr/local/bin and change privileges
$ ssh pi@
$ sudo mv ev3pi.py /usr/local/bin
$ sudo chmod ug+x /usr/local/bin/ev3pi.py
$ sudo chmod 0755 /usr/local/bin/ ev3pi.py
Change the script so it runs on Raspberry Pi. See comments in code. Be sure to use the db in /var/www/db/security.db
Update website to write commands to DB
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.
Download the security.php code here: GitHub. Download security.php.
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 code here: GitHub. Download ev3chk.sh.
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 here: GitHub. Download ev3auto.py.
Web Page to display status and Arm and Disarm the system
This is a pretty simple webpage, connected to a larger Home Automation System. Rename this script to index, and place in /var/www on your Raspberry Pi.
Download the security.php code here: GitHub. Download security.php.
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 * * * * /usr/local/bin/ev3auto.chk >/dev/null 2>&1
You can download the crontab here: GitHub. Download crontab.