Advanced 4 Digit Keypad Entry Alarm.
Posted: Sun Aug 02, 2009 2:40 am
For this alarm, Credit to Benj for original coding which I have modified with added features.
Also Credit to Sean for the graphics.
Features of alarm:
1) Four digit password is changeable and stored in EEPROM. If password is changed, and power is lost, then when power is restored, changed password is read from EEPROM and stored in password string.
2) There are thee zones. Zone 1 has exit and entry delay of 1 minute. during that 60 seconds an internal sounder is activated and time left in seconds is displayed on LCD. Zone 2 and 3 instantly trigger alarm. If zone 1 is triggered after initial 60 second time out, then count down is started for another 60seconds. If alarm is not deactivated by time 60 seconds has elapsed then main alarm is triggered
seconds count down is achieved using timer0 and not delay icon. that way time can be counting down whist waiting to press a key.
3) Alarm will not be enabled if A) wrong password entered to enable, or B) if there is a fault in any of the three zones. This fault could be due to a window/door left open.
4) When alarm is disabled and correct password is entered, there are two choices. press 1 will enable alarm, press 3 to change password.
Note, not sure if bug in V4 or is normal, but if you open V4_alarm1.fcf (even after saving) , the EEPROM contents will be random. So Either enter your code in EEPROM within programing software or you can save the correct password word to Hex file can be done as follows: With V4_alarm1.fcf loaded, the 1st digit of each location of EEPROM on panel 0 - 3 will be password. E.g. 0=431, 1=261, 2=5 & 3=74. Password = 4257. Make a note of pass word then program can then be run and enter current password and press 3 to change to your own password. After you have entered new password, EEPROM is automatically updated with new password.
Press # to accept 4 digit, press * to clear and re-enter password
I have not yet tried this on real hardware. I will be adding improvements over time. The improvements already added may not be best way of coding, but I don't claim to be an expert. I'm sure there could be better ways.
I was going to have a 30 second delay for zone 1 originally, so I know the macro name has only 30seconds instead of 60.
I will update with improvements/features when I get the chance. All new versions will be on one separate new post. So you can tell from date post added if new version or not.
Maybe this could be a community forum project, and anyone could post their version with improvements. feel free to download this version, alter and upload - stating improvements made.
Would someone mind testing on real hardware please and feed back.
Improvements:
V2. 1) Remembers status of alarm on power failure. If alarm was triggered, then power failed/restored. Alarm will continue when power is restored. If alarm is not set, then Alarm will stay off on power restore.
2)Added function when alarm is 1st disarmed to display zone which initially triggered alarm. This is also save to EEPROM and restored when power is restored. No zone is shown if alarm not triggered.
3)Zone inputs changed from port C to port B with weak pull-ups enabled. Eliminates pull-up resistor requirements. If zone is not used e.g zone 3 then there must be a pull down shorting link from port B3 to ground.
LCD shows current status of alarm. E.g Alarm On Code: or Alarm off Code:
V3.
1) Changed LCD message so β€Input Code:’ is on line 2. Freeing up line 1 for more text.
2) Added Address 6 EEPROM function to remember if alarm is set or not in event of power failure. Pre V3 if alarm was set, but not triggered and power failed/restored, then alarm would be in disabled mode. (not good news if burglars who disconnect power 1st :p )
3) Minor LCD message tweeks.
4) Removed β€Alarm Disabled!’ message on initial 60 seconds count down mode.
Also Credit to Sean for the graphics.
Features of alarm:
1) Four digit password is changeable and stored in EEPROM. If password is changed, and power is lost, then when power is restored, changed password is read from EEPROM and stored in password string.
2) There are thee zones. Zone 1 has exit and entry delay of 1 minute. during that 60 seconds an internal sounder is activated and time left in seconds is displayed on LCD. Zone 2 and 3 instantly trigger alarm. If zone 1 is triggered after initial 60 second time out, then count down is started for another 60seconds. If alarm is not deactivated by time 60 seconds has elapsed then main alarm is triggered
seconds count down is achieved using timer0 and not delay icon. that way time can be counting down whist waiting to press a key.
3) Alarm will not be enabled if A) wrong password entered to enable, or B) if there is a fault in any of the three zones. This fault could be due to a window/door left open.
4) When alarm is disabled and correct password is entered, there are two choices. press 1 will enable alarm, press 3 to change password.
Note, not sure if bug in V4 or is normal, but if you open V4_alarm1.fcf (even after saving) , the EEPROM contents will be random. So Either enter your code in EEPROM within programing software or you can save the correct password word to Hex file can be done as follows: With V4_alarm1.fcf loaded, the 1st digit of each location of EEPROM on panel 0 - 3 will be password. E.g. 0=431, 1=261, 2=5 & 3=74. Password = 4257. Make a note of pass word then program can then be run and enter current password and press 3 to change to your own password. After you have entered new password, EEPROM is automatically updated with new password.
Press # to accept 4 digit, press * to clear and re-enter password
I have not yet tried this on real hardware. I will be adding improvements over time. The improvements already added may not be best way of coding, but I don't claim to be an expert. I'm sure there could be better ways.
I was going to have a 30 second delay for zone 1 originally, so I know the macro name has only 30seconds instead of 60.
I will update with improvements/features when I get the chance. All new versions will be on one separate new post. So you can tell from date post added if new version or not.
Maybe this could be a community forum project, and anyone could post their version with improvements. feel free to download this version, alter and upload - stating improvements made.
Would someone mind testing on real hardware please and feed back.
Improvements:
V2. 1) Remembers status of alarm on power failure. If alarm was triggered, then power failed/restored. Alarm will continue when power is restored. If alarm is not set, then Alarm will stay off on power restore.
2)Added function when alarm is 1st disarmed to display zone which initially triggered alarm. This is also save to EEPROM and restored when power is restored. No zone is shown if alarm not triggered.
3)Zone inputs changed from port C to port B with weak pull-ups enabled. Eliminates pull-up resistor requirements. If zone is not used e.g zone 3 then there must be a pull down shorting link from port B3 to ground.
LCD shows current status of alarm. E.g Alarm On Code: or Alarm off Code:
V3.
1) Changed LCD message so β€Input Code:’ is on line 2. Freeing up line 1 for more text.
2) Added Address 6 EEPROM function to remember if alarm is set or not in event of power failure. Pre V3 if alarm was set, but not triggered and power failed/restored, then alarm would be in disabled mode. (not good news if burglars who disconnect power 1st :p )
3) Minor LCD message tweeks.
4) Removed β€Alarm Disabled!’ message on initial 60 seconds count down mode.