In this post we are going to construct a general purpose password based electronic lock circuit without any involvement of microcontroller. You can use this circuit for numerous applications where a basic level of security is required for turning a circuit ON.
The proposed project is built using an IC 4017 and the circuit requires a 5 digit pin number. The relay gets activated when you enter the correct pin and the relay gets deactivated when you press the reset button or turn off the circuit.
Default Password: 21345
The proposed electronic lock circuit consists of just few components; an IC 4017 which is the heart of the circuit, 11 push buttons for entering the pin number, 5 diodes to prevent short-circuit between output pins, couple of LEDs for indicating the status whether the circuit is locked or unlocked, couple of pull-down resistors, couple of current limiting resistors and a low power NPN transistor for triggering the 5V relay. The whole circuit operates on 5V supply.
The relay we are going to use in the circuit comes in a breakout board and the input of the relay is active low, meaning if we apply GND signal to the input terminal the relay gets activated.
How the circuit works:
To understand how the circuit functions, we need to know the pin configuration of IC 4017 and how the IC functions:
- Pin 16: Vdd or 5V.
- Pin 8: GND.
- Pin 15: Reset pin, during normal operation the pin must be grounded, when this pin connected to high the count of the IC will get reset.
- Pin 14: Clock input – we need to apply a clock pulse to this pin to make the IC count from 0 to 9.
- Pin 13: Clock enable – when this pin is connected to ground, the clock pin #14 accepts clock signal. When pin #13 is connected to high, the clock pulse applied on pin #14 gets ignored by the IC.
- Pin 12: Carry out – This pin is used for cascading two or more IC 4017, this pin turns high if the count of the IC exceeds 9.
- Pins 1 to 7 and 9 to 11 are outputs: There are 10 output pins which turn high one by one sequentially (reset of the output stays low). When no clock pulse is applied initially, output Q0 will stay high, when you apply one clock pulse, output Q1 turns high and output Q0 turns low. When you apply another clock pulse Q2 turns high and Q1 turns low. This is true for outputs from Q0 to Q9 and repeats.
- The output from Q0 to Q9 is in the sequence (pin number): 3, 2, 4, 7, 10, 1, 5, 6, 9 and 11 respectively.
By now you should have some understanding how IC 4017 functions, now let’s see how the sequential output can be developed into an electronic password lock circuit.
- When the circuit is turned ON, the output pin #3 (Q0) will be high initially. When we press the button connected at pin #3 which is the first digit of the password, sends a high signal to clock pin #14.
- Once the high signal reaches pin #14, the output Q0 – pin #3 turns low and output Q1 – pin #2 turns high, now we need to press the 2nd digit of the password, which is the button connected to pin #2.
- As soon as you press the button at pin #2, high signal reaches the clock pin, which makes output Q1 – pin #2 low and Q2 – pin #4 high.
- The above mentioned process continues till output Q4 – pin #10 turns high. When you press the button connected to pin #10, which is the last digit of your password, the output Q5 – pin #1 turns high which turns on the transistor and triggers the relay ON.
The above mentioned process works only if the correct buttons are pressed in the correct sequence, otherwise the relay will not turn ON.
In the circuit diagram all the buttons present at the left hand side are real where we need to enter the correct pin number. The buttons present at the right hand side are decoys and are electrically connected to reset pin.
When an unauthorized person tries to guess the password there is a very high probability that he / she may press one of the decoy buttons while guessing which will reset the IC.
In conclusion there are two layers of security, the first one is password that must be entered in the correct sequence only then the relay gets activated, the other layer is decoy buttons.
Even when someone is able to guess the first few numbers correctly, pressing any one decoy button will reset the IC which makes the first few correct pin numbers useless.
How to set a new password / change password:
To change the password, you need to make changes to your circuit setup physically, since there no involvement of microcontroller or software.
The default password is “21345” only if you match the push button’s number on the circuit diagram with the keypad layout’s number.
You can rearrange the wiring of the buttons at pin numbers 3, 2, 4, 7 and 10 of IC 4017 and don’t change the number order on the keypad which is illustrated on the keypad layout diagram.
- Pin number 3 is your 1st digit.
- Pin number 2 is your 2nd digit.
- Pin number 4 is your 3rd digit.
- Pin number 7 is your 4th digit.
- Pin number 10 is your 5th digit.
Note: Use button “R” (Reset) for deactivating the relay or to re-enter the password in case you entered an incorrect password.