Does your home have a security system but you don’t subscribe to the monitoring service to make it work? Rip that baby off of the wall and do something with it, or just build your own system around it. If you have a DSC PC1500RK control panel [CaitSith2] shows us how easy it is to control the buttons, LEDs, and buzzer. If you’ve got a different model this is still a good jumping off point to start your own reverse engineering.
There are only four connections that need to be made. [CaitSith2] is using an Arduino for the demonstration. He connected the red wire to voltage, the black wire to ground, the yellow wire (clock) to digital pin 3 and the green wire (data) to digital pin 2. A communication cycle starts by setting the data line high, then clocking out eight bits to capture keypresses. 16-bits are then clocked in to set the LEDs and drive the buzzer. This is shown in the video after the break as well as documented in his sample code. We’ve embedded the sketch after the break to preserve it in case the pastebin code goes missing in the future.
/* The code is to interface a DSC PC1500RK alarm keypad. It has 15 keys, 11 LEDs, and a Beeper that can be controlled. This code cycles through all the LEDs in a top-down fashion. The beeper is used to acknowledge that a key has been pressed. If the key was pressed successfully, its character is output on the serial line, at 115200 bps. Wiring is simple. Red is Vcc, hooked to 5V Black is Gnd. Yellow is the Clock line. In this configuration, it is on Digital Pin 3. Green is Data, and is on Digital Pin 2. */ void setup() { //Pin 2 is Data, and is bidirectional. //Pin 3 is Clock, and is an output. pinMode(2, OUTPUT); pinMode(3, OUTPUT); Serial.begin(115200); } int readdata(int control) { int i,j=0,k=control; int bitcount=0; for(i=0;i<8;i++) { j<<=1; digitalWrite(2,HIGH); digitalWrite(3,LOW); delay(2); if(digitalRead(2)==HIGH) j|=1; digitalWrite(3,HIGH); delay(2); } for(i=0;i<16;i++) { if(k&0x8000) digitalWrite(2,HIGH); else digitalWrite(2,LOW); digitalWrite(3,LOW); delay(2); digitalWrite(3,HIGH); delay(2); k<<=1; } j^=0xFF; switch(j&0x70) { case 0x10: case 0x20: case 0x40: switch(j&0x8F) { case 0x80: case 0x08: case 0x04: case 0x02: case 0x01: return j; default: return 0; } default: return 0; } return 0; } void printchar(char A, char B, char C, int D) { switch(D) { case 1: Serial.println(C); break; case 2: Serial.println(B); break; case 4: Serial.println(A); break; } } void loop() { int i; static unsigned int j=0x80; static int k=0,l; static int m=0; digitalWrite(13, HIGH); // set the LED on i=readdata(j | l); m++; if(m==4) { m=0; j>>=1; if(j==4) j=0x8000; if(j==0x0200) j=0x80; } if(k==0) { switch(i&0x8F) { case 0x80: printchar('F','E','P',(i&0x70)>>4); break; case 0x08: printchar('*','0','#',(i&0x70)>>4); break; case 0x04: printchar('7','8','9',(i&0x70)>>4); break; case 0x02: printchar('4','5','6',(i&0x70)>>4); break; case 0x01: printchar('1','2','3',(i&0x70)>>4); break; } } if((k!=i)&&(k==0)) l=1; else l=0; k=i; delay(20); } /* if(Serial.available()) { int inByte = Serial.read(); if(inByte == 'H') { digitalWrite(2,HIGH); digitalWrite(3,LOW); delay(3); } else { digitalWrite(2,LOW); digitalWrite(3,LOW); delay(3); } if(digitalRead(2)==LOW) Serial.println("LOW"); else Serial.println("HIGH"); digitalWrite(3,HIGH); delay(3); } */
Filed under: arduino hacks, home hacks, security hacks
SOURCE Hack a Day
Recent Comments