Alarm

GoControl GC2E Alarm

If you don't want to pay a monthly monitoring fee, I could not find an easy way to monitor a GC2E alarm panel.

So I made this project to connect to the alarm output from a GC2E through an optocoupler to an ESP32 to send an email or text if the alarm is active



Alarm output diagram

Run wires to pins  4/5, 14VDC, 500 mA output alarm output

Based on a 14VDC level, I picked a 1.2k resistor for the opto circuit.

14V/1.2k = 11.7 mA

2.21v/1.2k=1.84 mA 

Optocoupler

Circuit

4n26 optocoupler vishay datasheet

1/2 input

4/5 output

For high going Alarm out

Alarm out + (alarm pin 4) to 1.2k resistor to pin 1 opto

Alarm out - (alarm pin 5) to pin 2 opto

3.3V to 10k to pin 5 to gpio32

ground to pin 4

Added diode across pins 1 and 2, pointing at 1, for protection.  


If you apply 12-18 VDC to 1.2k resistor (other resistor end to pin 1), pin 5 will go low.  Otherwise pin 5 is high so opto is inverting the signal.


Actual Measurements

Alarm output:
2.21V = off
13.8V = on

I think the 2.21 is caused by leakage voltage.  The alarm disconnects the ground side when off.

With 1.2k resistor, 2.21 V is enough to make pin 5 low, so can't use a GPIO to read the opto.

Connnected opto output to a ESP32 ADC input.  Reading as an analog voltage to determine state.

ESP32 Analog Input

https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/ 

ADC Pins 

    pin: 32, 33, 34, 35 From a previous project, only these four ADCs work on a mini D1 ESP32 board.  Others have conflicts with Wi-Fi radio.

Connected GPIO32 to output from opto (pin 5)


Measurements/trigger

ADC reading from ESP32 is around 130 when alarm is not tripped, and goes to 0 or very close to 0 when alarm is on/active.

Used 60 as limit in code to decide if alarm was active.

Note:  Based on graph in random nerd tutorial link above, 130 is a low voltage, but it still provides enough of a difference between to get a reliable trigger point.

Software


Pinout for reference

// Opto output (reading alarm output is connected to GPIO 34 (Analog ADC1_CH6) 

const int AnalogPin = 32;

const int AlarmLimit = 60;  


// variable for storing the alarm output value

int AlarmValue = 0;


void loop() {

  // Reading potentiometer value

  AlarmValue = analogRead(AlarmPin);

  Serial.println(AlarmValue);

  if   (AlarmValue < AlarmLimit) {   //send alarm text. }


https://www.alarmgrid.com/faq/how-do-i-use-a-qolsys-iq-siren-with-a-2gig-gc2-system 

1. Enroll the siren. The first step is to enroll the siren. Whenever you are adding a Z-Wave device, you must first clear it from the network. This will remove any existing network information from the device and ensure that it can enroll successfully. Start by plugging the Qolsys IQ Siren into a wall outlet located nearby the GC2 System. This will ensure that the device is receiving power.

Now turn your attention to the GC2 System. On the main screen, choose Services. Then choose Z-Wave. Then click on the Wrench icon in the bottom-right corner. You will then need to provide the system's Installer Code. This code is 1561 by default, but it may have been changed. Then click on Remove Devices. The system will begin looking for devices to clear from the network. Then press the button on the top of the IQ Siren. The GC2 System should display that a device has been removed from the network. Press OK in the bottom-right corner. Then press the Back button in the bottom-left corner.

You will now enroll the IQ Siren with the system. On the GC2 System, click on Add Devices in the same sub-menu. Press the button on the top of the IQ Siren. The GC2 System should show that a device has been added. It will be listed as a Binary Switch from AEON Labs. You can then click the Back button in the bottom-left corner. The IQ Siren is now enrolled with the GC2 System. You can then press the Back button in the bottom-left corner to exit the Z-Wave Toolbox Menu and return to the main Z-Wave Menu.


2. Create siren scenes. Now that you have returned to the main Z-Wave Menu, you can create the two (2) scenes needed for the siren to operate properly. One scene will tell the siren to activate, and the other scene will tell the siren to stop sounding. Start by clicking on Scenes. Then choose Add Scene in the bottom-right corner.


We will first create the scene that will tell the siren to activate. For our purposes, we are calling this scene "Trigger Siren". Click the OK button in the bottom-right corner after you have entered the desired name. After naming the scene, click Add Action in the bottom-right corner. You will then be presented with various device types. Since the 2GIG GC2 sees the IQ Siren as a Z-Wave Switch, choose Z-Wave Switch. You should see the Binary Switch by AEON Labs. Set it to ON. Then press OK in the bottom-right corner. Then press back in the bottom-left corner to return to the Z-Wave Scenes Menu.

Now you must create the scene that will tell the siren to stop sounding. For our demonstration, we are calling this scene "Stop Siren". Click the OK button in the bottom-right corner after entering the name you want. After providing a name, click the Add Action button in the bottom-right corner. Just like when creating the first scene, you will select Z-Wave Switch. The Binary Switch by AEON Labs should be displayed. Make sure that it is set to OFF. Then press the OK button in the bottom-right. Lastly, click the back button in the bottom-left corner to return to the Z-Wave Scenes Menu.

You should now see the two (2) scenes you created. You can press the back button in the bottom-left corner to return to the main Z-Wave menu.


3. Create siren rules. You now have a scene to activate the siren and a scene to stop the siren. However, the system doesn't know when to trigger these scenes. You need to create two (2) rules associated with these scenes. One rule will tell the system to trigger the first scene so that the siren activates during alarm events. Remember, we named this scene "Trigger Siren". The other rule will tell the system to trigger the second scene so that the siren stops sounding when the system is disarmed and an alarm is cleared. We named that scene "Stop Siren".


To get started, click on the Rules option in the upper-right corner of the Z-Wave Menu. Choose Add Rule in the bottom-right corner. You will have two fields that you can scroll through. The top field is called "When this Event Occurs". For that top field, choose the option "Audible Alarm". The bottom field is called "Run this Scene". For the bottom field, choose the scene that you made to activate the siren. In our example, this scene is called "Trigger Siren". Then press OK in the bottom-right corner to finish creating the rule.

You will now create the rule that tells the other scene to activate so that the siren stops sounding when the system is disarmed and an alarm is cleared. Click the Add Rule button in the bottom-right corner. You will see the same two (2) fields that you had before when creating the other rule. This time, choose the option "System Disarmed" for the top field. For the bottom field, choose the scene you made to stop the siren. Remember, we named that scene "Stop Siren". Press the OK button in the bottom-right corner after making the appropriate selections.

You should then see the two (2) rules that you created. You can then press the green picture of the house on the panel itself to return to the system home screen.


4. Test the siren. It is important to test the siren to make sure that it activates when an alarm occurs and that it stops when an alarm is cleared. Make sure to put your system on test mode before performing this test. The easiest way to put your system into alarm is to first press the panic button on the front of the panel. This is the blue button with a cross (+). Then press and hold the Fire button for two (2) seconds. The system should go into alarm, and the Qolsys IQ Siren should activate. You can then clear the alarm by providing the Master Code for your system (default 1111, but usually changed). If everything was set up correctly, the siren should stop sounding once the alarm is cleared.


Note: The IQ Siren will not produce a Temporal 3 sound for fire alarms or a Temporal 4 sound for CO alarms. It produces the same constant alarm tone regardless of the alarm type that has occurred.



Reference information

https://randomnerdtutorials.com/esp32-cam-send-photos-email/ 

Need to create app password for gmail to work.


https://www.zdnet.com/article/gmail-app-passwords-what-they-are-how-to-create-one-and-why-to-use-them/ 

Point your web browser to https://myaccount.google.com/apppasswords. Even though you just logged in to your account, you'll most likely be prompted to type your account password again. 

Relay

Built but didn't use, used the optocoupler version documented above.

This should have worked, it was plan b.

Songle Relay

SRD-12VDC-SL-C

Connect 1&2 to alarm output

Connect 3 to ground

Connect 4 (NO) to GPIO23

GPIO with Pullups 


GPIO0, GPIO2, GPIO4, GPIO5, GPIO12, GPIO13, GPIO14, GPIO15, GPIO25, GPIO26, GPIO27, GPIO32, GPIO33

Connect relay NO pin to GPIO27.

Setup with internal pullup so normally high, goes low when relay closes as relay pin 3 tied to ground.

10% = 1.2V to turn off

130%= 15.6V max voltage

75%=9V to turn of