Skip to content

Commit

Permalink
KeypadInterface - add Classic series keypad support (PC1500RK) #200
Browse files Browse the repository at this point in the history
  • Loading branch information
taligentx committed Feb 9, 2021
1 parent 7d0ee63 commit 7b24fed
Show file tree
Hide file tree
Showing 12 changed files with 664 additions and 33 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ This library uses a combination of hardware and timer interrupts to accurately c
* Virtual keypad:
- Write keys to the panel for all partitions
* Keypad interface:
- Use DSC keypads as physical input devices for any general purpose without needing a DSC panel.
- Use DSC PowerSeries and Classic series keypads as physical input devices for any general purpose without needing a DSC panel.
* Panel time - retrieve current panel date/time and set a new date/time (including an example with NTP sync)
* Panel installer code unlocking - determine the 4-digit panel installer code
* Direct Keybus interface:
Expand Down Expand Up @@ -105,7 +105,7 @@ This library uses a combination of hardware and timer interrupts to accurately c
## Release notes
* develop
- New: DSC Classic series panel support: PC1500, PC1550
- New: `KeypadInterface` example sketch - interfaces with DSC keypads as physical input devices for any general purpose without needing a DSC panel.
- New: `KeypadInterface` and `KeypadInterface-MQTT` example sketches - interface with DSC PowerSeries and Classic keypads as physical input devices for any general purpose without needing a DSC panel.
- New: esp32-s2 microcontroller support
* 2.0
- New: [Telegram](https://www.telegram.org) bot example sketch
Expand Down Expand Up @@ -239,7 +239,7 @@ The included examples demonstrate how to use the library and can be used as-is o

* **Unlocker**: Checks all possible 4-digit installer codes until a valid code is found, including handling keypad lockout if enabled. The valid code is output to serial as well as repeatedly flashed with the built-in LED.

* **KeypadInterface**: Interfaces directly to a DSC PowerSeries keypad (without a DSC panel) to enable use of DSC keypads as physical inputs for any general purpose. Note that this uses a different wiring setup from the standard Keybus interface, refer to the wiring diagram in the sketch.
* **KeypadInterface**: Interfaces directly to DSC PowerSeries and Classic series (tested with PC1500RK) keypads (without a DSC panel) to enable using these as physical inputs for any general purpose. Examples included for interfacing via serial and MQTT. Note that this uses a different wiring setup from the standard Keybus interface, refer to the wiring diagram in the example sketch.

* **KeybusReader**: Decodes and prints data from the Keybus to a serial interface, including reading from serial for the virtual keypad. This can be used to help decode the Keybus protocol and is also handy as a troubleshooting tool to verify that data is displayed without errors. For esp8266/esp32, `KeybusReaderIP` enables connectivity over WiFi.

Expand Down
20 changes: 16 additions & 4 deletions examples/Arduino/KeypadInterface-MQTT/KeypadInterface-MQTT.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* DSC Keypad Interface-MQTT 1.1 (Arduino with Ethernet)
* DSC Keypad Interface-MQTT 1.2 (Arduino with Ethernet)
*
* Interfaces directly to a DSC PowerSeries keypad (without a DSC panel) to enable use of
* DSC keypads as physical inputs for any general purpose.
* Interfaces directly to a DSC PowerSeries or Classic series keypad (without a DSC panel) to
* enable use of DSC keypads as physical inputs for any general purpose.
*
* This interface uses a different wiring setup from the standard Keybus interface, adding
* an NPN transistor on dscClockPin. The DSC keypads require a 12v DC power source, though
* lower voltages down to 7v may work for key presses (the LEDs will be dim).
*
* Supported features:
* PowerSeries keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Fire, Program, Backlight, Zones 1-8: dsc.lightReady, dsc.lightZone1, etc
* - Set keypad beeps, 1-128: dsc.beep(3)
Expand All @@ -18,7 +18,12 @@
* 3 beeps, constant tone, 2 second interval: dsc.tone(3, true, 2)
* Disable the tone: dsc.tone() or dsc.tone(0, false, 0)
*
* Classic keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Zones 1-6: dsc.lightReady, dsc.lightZone1, etc
*
* Release notes:
* 1.2 - Add Classic keypad support - PC1500RK
* 1.1 - Add keypad beep, buzzer, constant tone
* 1.0 - Initial release
*
Expand Down Expand Up @@ -53,7 +58,10 @@
*
* This example code is in the public domain.
*/

// Set the keypad type
#define dscKeypad
//#define dscClassicKeypad

#include <SPI.h>
#include <Ethernet.h>
Expand All @@ -78,7 +86,11 @@ const char* mqttSubscribeTopic = "dsc/Set"; // Receives messages to send
#define dscWritePin 6 // Arduino Uno: 2-12

// Initialize components
#ifdef dscKeypad
dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#else
dscClassicKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#endif
bool lightOff, lightBlink, inputReceived;
const byte inputLimit = 50;
char input[inputLimit];
Expand Down
23 changes: 17 additions & 6 deletions examples/Arduino/KeypadInterface/KeypadInterface.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* DSC Keypad Interface 1.1 (Arduino)
* DSC Keypad Interface 1.2 (Arduino)
*
* Interfaces directly to a DSC PowerSeries keypad (without a DSC panel) to enable use of
* DSC keypads as physical inputs for any general purpose.
* Interfaces directly to a DSC PowerSeries or Classic series keypad (without a DSC panel) to
* enable use of DSC keypads as physical inputs for any general purpose.
*
* This interface uses a different wiring setup from the standard Keybus interface, adding
* an NPN transistor on dscClockPin. The DSC keypads require a 12v DC power source, though
* lower voltages down to 7v may work for key presses (the LEDs will be dim).
*
* Supported features:
* PowerSeries keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Fire, Program, Backlight, Zones 1-8: dsc.lightReady, dsc.lightZone1, etc
* - Set keypad beeps, 1-128: dsc.beep(3)
Expand All @@ -18,7 +18,12 @@
* 3 beeps, constant tone, 2 second interval: dsc.tone(3, true, 2)
* Disable the tone: dsc.tone() or dsc.tone(0, false, 0)
*
* Classic keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Zones 1-6: dsc.lightReady, dsc.lightZone1, etc
*
* Release notes:
* 1.2 - Add Classic keypad support - PC1500RK
* 1.1 - Add keypad beep, buzzer, constant tone
* 1.0 - Initial release
*
Expand Down Expand Up @@ -53,7 +58,10 @@
*
* This example code is in the public domain.
*/

// Set the keypad type
#define dscKeypad
//#define dscClassicKeypad

#include <dscKeybusInterface.h>

Expand All @@ -62,9 +70,12 @@
#define dscReadPin 5 // Arduino Uno: 2-12
#define dscWritePin 6 // Arduino Uno: 2-12

dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);

// Initialize components
#ifdef dscKeypad
dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#else
dscClassicKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#endif
bool lightOff, lightBlink, inputReceived;
const byte inputLimit = 50;
char input[inputLimit];
Expand Down
20 changes: 16 additions & 4 deletions examples/esp32/KeypadInterface-MQTT/KeypadInterface-MQTT.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* DSC Keypad Interface-MQTT 1.1 (esp32)
* DSC Keypad Interface-MQTT 1.2 (esp32)
*
* Interfaces directly to a DSC PowerSeries keypad (without a DSC panel) to enable use of
* DSC keypads as physical inputs for any general purpose.
* Interfaces directly to a DSC PowerSeries or Classic series keypad (without a DSC panel) to
* enable use of DSC keypads as physical inputs for any general purpose.
*
* This interface uses a different wiring setup from the standard Keybus interface, adding
* an NPN transistor on dscClockPin. The DSC keypads require a 12v DC power source, though
* lower voltages down to 7v may work for key presses (the LEDs will be dim).
*
* Supported features:
* PowerSeries keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Fire, Program, Backlight, Zones 1-8: dsc.lightReady, dsc.lightZone1, etc
* - Set keypad beeps, 1-128: dsc.beep(3)
Expand All @@ -18,7 +18,12 @@
* 3 beeps, constant tone, 2 second interval: dsc.tone(3, true, 2)
* Disable the tone: dsc.tone() or dsc.tone(0, false, 0)
*
* Classic keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Zones 1-6: dsc.lightReady, dsc.lightZone1, etc
*
* Release notes:
* 1.2 - Add Classic keypad support - PC1500RK
* 1.1 - Add keypad beep, buzzer, constant tone
* 1.0 - Initial release
*
Expand Down Expand Up @@ -53,7 +58,10 @@
*
* This example code is in the public domain.
*/

// Set the keypad type
#define dscKeypad
//#define dscClassicKeypad

#include <WiFi.h>
#include <PubSubClient.h>
Expand All @@ -78,7 +86,11 @@ const char* mqttSubscribeTopic = "dsc/Set"; // Receives messages to send
#define dscWritePin 21 // 4,13,16-33

// Initialize components
#ifdef dscKeypad
dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#else
dscClassicKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#endif
bool lightOff, lightBlink, inputReceived;
const byte inputLimit = 255;
char input[inputLimit];
Expand Down
23 changes: 17 additions & 6 deletions examples/esp32/KeypadInterface/KeypadInterface.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* DSC Keypad Interface 1.1 (esp32)
* DSC Keypad Interface 1.2 (esp32)
*
* Interfaces directly to a DSC PowerSeries keypad (without a DSC panel) to enable use of
* DSC keypads as physical inputs for any general purpose.
* Interfaces directly to a DSC PowerSeries or Classic series keypad (without a DSC panel) to
* enable use of DSC keypads as physical inputs for any general purpose.
*
* This interface uses a different wiring setup from the standard Keybus interface, adding
* an NPN transistor on dscClockPin. The DSC keypads require a 12v DC power source, though
* lower voltages down to 7v may work for key presses (the LEDs will be dim).
*
* Supported features:
* PowerSeries keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Fire, Program, Backlight, Zones 1-8: dsc.lightReady, dsc.lightZone1, etc
* - Set keypad beeps, 1-128: dsc.beep(3)
Expand All @@ -18,7 +18,12 @@
* 3 beeps, constant tone, 2 second interval: dsc.tone(3, true, 2)
* Disable the tone: dsc.tone() or dsc.tone(0, false, 0)
*
* Classic keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Zones 1-6: dsc.lightReady, dsc.lightZone1, etc
*
* Release notes:
* 1.2 - Add Classic keypad support - PC1500RK
* 1.1 - Add keypad beep, buzzer, constant tone
* 1.0 - Initial release
*
Expand Down Expand Up @@ -53,7 +58,10 @@
*
* This example code is in the public domain.
*/

// Set the keypad type
#define dscKeypad
//#define dscClassicKeypad

#include <dscKeybusInterface.h>

Expand All @@ -62,9 +70,12 @@
#define dscReadPin 19 // 4,13,16-39
#define dscWritePin 21 // 4,13,16-33

dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);

// Initialize components
#ifdef dscKeypad
dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#else
dscClassicKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#endif
bool lightOff, lightBlink, inputReceived;
const byte inputLimit = 50;
char input[inputLimit];
Expand Down
20 changes: 16 additions & 4 deletions examples/esp8266/KeypadInterface-MQTT/KeypadInterface-MQTT.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* DSC Keypad Interface-MQTT 1.1 (esp8266)
* DSC Keypad Interface-MQTT 1.2 (esp8266)
*
* Interfaces directly to a DSC PowerSeries keypad (without a DSC panel) to enable use of
* DSC keypads as physical inputs for any general purpose.
* Interfaces directly to a DSC PowerSeries or Classic series keypad (without a DSC panel) to
* enable use of DSC keypads as physical inputs for any general purpose.
*
* This interface uses a different wiring setup from the standard Keybus interface, adding
* an NPN transistor on dscClockPin. The DSC keypads require a 12v DC power source, though
* lower voltages down to 7v may work for key presses (the LEDs will be dim).
*
* Supported features:
* PowerSeries keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Fire, Program, Backlight, Zones 1-8: dsc.lightReady, dsc.lightZone1, etc
* - Set keypad beeps, 1-128: dsc.beep(3)
Expand All @@ -18,7 +18,12 @@
* 3 beeps, constant tone, 2 second interval: dsc.tone(3, true, 2)
* Disable the tone: dsc.tone() or dsc.tone(0, false, 0)
*
* Classic keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Zones 1-6: dsc.lightReady, dsc.lightZone1, etc
*
* Release notes:
* 1.2 - Add Classic keypad support - PC1500RK
* 1.1 - Add keypad beep, buzzer, constant tone
* 1.0 - Initial release
*
Expand Down Expand Up @@ -53,7 +58,10 @@
*
* This example code is in the public domain.
*/

// Set the keypad type
#define dscKeypad
//#define dscClassicKeypad

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
Expand All @@ -78,7 +86,11 @@ const char* mqttSubscribeTopic = "dsc/Set"; // Receives messages to send
#define dscWritePin D8 // GPIO 15

// Initialize components
#ifdef dscKeypad
dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#else
dscClassicKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#endif
bool lightOff, lightBlink, inputReceived;
const byte inputLimit = 255;
char input[inputLimit];
Expand Down
23 changes: 17 additions & 6 deletions examples/esp8266/KeypadInterface/KeypadInterface.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* DSC Keypad Interface 1.1 (esp8266)
* DSC Keypad Interface 1.2 (esp8266)
*
* Interfaces directly to a DSC PowerSeries keypad (without a DSC panel) to enable use of
* DSC keypads as physical inputs for any general purpose.
* Interfaces directly to a DSC PowerSeries or Classic series keypad (without a DSC panel) to
* enable use of DSC keypads as physical inputs for any general purpose.
*
* This interface uses a different wiring setup from the standard Keybus interface, adding
* an NPN transistor on dscClockPin. The DSC keypads require a 12v DC power source, though
* lower voltages down to 7v may work for key presses (the LEDs will be dim).
*
* Supported features:
* PowerSeries keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Fire, Program, Backlight, Zones 1-8: dsc.lightReady, dsc.lightZone1, etc
* - Set keypad beeps, 1-128: dsc.beep(3)
Expand All @@ -18,7 +18,12 @@
* 3 beeps, constant tone, 2 second interval: dsc.tone(3, true, 2)
* Disable the tone: dsc.tone() or dsc.tone(0, false, 0)
*
* Classic keypad features:
* - Read keypad key button presses, including fire/aux/panic alarm keys: dsc.key
* - Set keypad lights: Ready, Armed, Trouble, Memory, Bypass, Zones 1-6: dsc.lightReady, dsc.lightZone1, etc
*
* Release notes:
* 1.2 - Add Classic keypad support - PC1500RK
* 1.1 - Add keypad beep, buzzer, constant tone
* 1.0 - Initial release
*
Expand Down Expand Up @@ -53,7 +58,10 @@
*
* This example code is in the public domain.
*/

// Set the keypad type
#define dscKeypad
//#define dscClassicKeypad

#include <dscKeybusInterface.h>

Expand All @@ -62,9 +70,12 @@
#define dscReadPin D2 // GPIO 4
#define dscWritePin D8 // GPIO 15

dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);

// Initialize components
#ifdef dscKeypad
dscKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#else
dscClassicKeypadInterface dsc(dscClockPin, dscReadPin, dscWritePin);
#endif
bool lightOff, lightBlink, inputReceived;
const byte inputLimit = 50;
char input[inputLimit];
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dscKeybusInterface KEYWORD1
dscClassicInterface KEYWORD1
dscKeypadInterface KEYWORD1
dscClassicKeypadInterface KEYWORD1
dsc KEYWORD1

dscClockPin LITERAL1
Expand Down
Loading

0 comments on commit 7b24fed

Please sign in to comment.