Do it yourself !
Zedomax Alarm System -
1 Magnetic Contact Switch
Available at RadioShack
1 CB280 Start Kit
Available at Comfile
Okay, today I was thinking that I needed an alarm system for my dog, so I decided to make a doggy door alarm system. Since my dog sleeps w/ me, I needed to make an alarm system for the night, to protect my apartment from other intruding dogs...
Anways, you might think I am crazy making an alarm system for furry people...
Before I made the actual system, I decided to do it with a study board that has a little breadboard.
You can get a 12VDC Piezzo Buzzer from your local Radio Shack for about 10 bucks and magnetic contact switches w/ screws for about 5 bucks.
These magnetic contact switches are neat, they are the same ones used for a lot of residential and commercial door sensors.
They are simply magnetic switches. If door is closed, the contact is open and if door is open, the contact is closed.
You can screw them into door and the wall using the holes on the switch ends.
Yes, if you got that and some CUBLOC or any type of microcontroller w/ i/o ports, you should be ready to go.
Here, we will use Comfile's CB280 embedded computer module and a 4x4 keypad and keypad controller, which will make things easier for us since we won't have to build from scratch.
You will need to solder on your Keypad to the Keypad Controller first.
Then plug in black wire to GND, red wire to 5V, and rest of the pins to ports P0, P1, P2, and P3. (labeled 0, 1, 2, and 3 on the black IDC headers)
Once you are done connecting the Keypad Controller to your study board, connect the LCD to connector labeled, "CuNET".
Yes, now you have a keypad and an LCD.
Now connect the black wire of the piezo to GND and red wire to the left side of the 3904 transistor.
Connect 5V to the right side of the 3904 transistor.
Connect the middle pin of the transistor to P5 of the CUBLOC Study Board (labeled "5").
Now why are we using a transistor?
So when the I/O port goes on, the transistor will simply connect power from 5V pin to the red wire of the piezo.
Okay, now we have 1 more item, yes, that's right, we can put the magnetic contact switch.
Connect one end of the Contact switch to 5V pin and the other end to port P20, labeled "20" on the study board.
Now connect a wire from P20 to an LED on the study board.
This is to do a pull-down and we should be able to check the status of the contact switch using the LED.
All right, now you are done, you should have something like this:
Now download this source file diy100.zip and uncompress it.
You will find HomeAutomation001.cul and HomeAutomation001.cub.
Open HomeAutomation001.cul file in your CublocStudio.
Download the program to CB280 module.
When you move the bottom part of the magnetic contact switch, you should see the LCD displaying "open" and "close" while the piezo beeps.
Now enter "1234" as password on the keypad controller.
If you mess up, you can press "CNCL" button, which will clear the password.
You should see the Alarm Status on the LCD go ON.
Now when the door is open, you will hear the alarm go off.
Video of Alarm System in 3 minutes:
Const Device = CB280
#define MyPass 1234
Set Pad 0,1,5
Const Byte KEY_TABLE=(0,0,14,16,0,15,0,0,0,0,13,9,8,7,0,0,0,0,12,6,5,4,0,0,0,0,11,3,2,1)
'Key table if Keypad inserted backwards to the Keypad Controller
'Const Byte KEY_TABLE=(0,0,1,4,7,10,0,0,0,0,2,5,8,11,0,0,0,0,3,6,9,12,0,0,0,0,13,14,15,16)
Dim X As Byte
'Status of Alarm
Dim AlarmON As Byte
'Status of Door
Dim Door As Byte
Dim Password As Long
'Set port P5 to output
'Set Magnetic Switch to input
On INT0 Gosub GETINT
Set int0 2
On Pad Gosub PAD_RTN
Set Ladder Off
Set Display 2,0,0,128
Print "Zedomax Alarm System"
Print "Door is: "
If In(20)=1 Then
If AlarmON=1 Then
Print "Alarm Status is ON"
Print "Alarm Status is OFF"
If AlarmON=1 And Door=1 Then
Debug "Door: ",Dec Door,Cr
If Door=0 Then
Print "closed "
Debug "door closed",Cr
Print "open "
Debug "door open",Cr
If X>29 Then Return
Debug "Key Pressed: ", Dec X,Cr
If X < 10 Then
If Password > 9999 Then Password=X
Debug "Password: ", Dec Password,Cr
If Password = MyPass Then
AlarmON=AlarmON Xor 1
If AlarmON=1 Then
Print "Alarm Status is ON "
Print "Alarm Status is OFF"
'If ENTR pressed
Elseif X=11 Then
'If CNCL pressed
Elseif X=15 Then
Taking it Further...
You can modify the source code to change the alarm times, scheduling,
The CB280 module supports up to 49 I/Os, so you can add up to 49
The CB220 and CB220 Proto Board can be substituted for cheaper
The CLCD420B can be substituted for smaller LCD such as the CLCD216G
I will try to update w/ a touch screen alarm system for more high
Check out PartII - adding a motion sensor!
If you have any cool apps you'd like to share, please e-mail to email@example.com
Back to DIY Blog!