Two-button Digital Lock

Now here’s a digital lock unlike any other, as  it has only two buttons instead of the usual  numeric keypad. The way it works is as simple  as its keypad. Button S1 is used to enter the  digits of the secret code in a pulsed fashion-i.e. the number of times you press the but-ton is determined by the digit to be entered.  A dial telephone uses the same type of coding (now maybe there’s an idea?). Press four  times for a 4, nine times for a 9, etc. Pressing button S2 indicates the end of a digit. 

 

Project Image :

Two-button Digital Lock Project-Image 

 Two-button Digital Lock Project Image

 

For example, to enter the code 4105, press  S1 four times, then press S2, then S1 once, S2  once, then without pressing S1 at all, press S2  again, then finally S1 five times and S2 once  to finish. If the code is correct, the green LED D1 lights for 2 seconds and the relay is energised for 2 seconds. If the code is wrong, the  red LED D2 lights for 2 seconds, and the relay  is not energised. To change the code, fit a jumper to J1 and  enter the current code. When the green LED  D1 has flashed twice, enter the new 4-digit  code. D1 will flash three times and you will  need to confirm the new code. If this confirmation is correct, D1 will flash four times.  If the red LED D2 flashes four times, some-thing’s wrong and you’ll need to start all over  again. To finish the operation, remove the  jumper and turn the power off and on again the digital lock is now ready for use with  the new code.

 

Circuit diagram :

Two-button Digital Lock Circuit-diagram

Two-button Digital Lock Circuit Diagram

 

The software can be found on the webpage for the project [1]. Don’t forget to erase the microcontroller’s EEPROM memory before  programming  it,  so  you  can  be  sure  that  the  default  code  is  1234  and  not  some -thing unknown that was left behind in the  EEPROM. A little exercise for our readers: convert this  project into a single-button digital lock for  example, by using a long press on S1 instead  of pressing S2 to detect the end of a digit.

 

Author : Francis Perrenoud  - Copyright : Elektor

Post a Comment