The circuit on a breadboard for test. This circuit has the CD4072 Chip included and can be used with touch keypad as well.
Imagine that you sit on your PC desk, you pull the keyboard, the mouse is near by, you click the button and the computer boots. Now imagine the same scene, but instead of pushing just a button, you enter the security code! That was one of my imaginations when i was a kid. Nowadays, i could make a more complex systems, with security code, LCD display and hardware key, but i decided to make a more simple yet secure circuit for the other 'kids' that want to boot with more than just a cold pushbutton.
Here is a video from the circuit in operation!
The Circuit
There are more simple but less secure circuits. This circuit has a 4-digit security code that is hardware selectable. It can have as many 'wrong' digits as you like, but up to 4 'correct' digits. Also, one digit cannot be more than once in the security code. Suppose for example that you choose to have 10 digit keypad with numbers from 0 to 9. One code could be the number 5293, or the 7520, but the code 4429 is wrong! The digit '4' is more than once in the code and that cannot happen.
The schematic digram is as follows:
Each 'correct' key press will SET a flip-flop. When the 4th flip-flop is SET, the relay will be armed through the PNP transistor. Whenever a 'wrong' button is pressed, all 4 flip-flops will be RESET and the code must be entered again from the beginning. Also, if the code must be entered in the correct order. If for example the code is 1234 and instead you press 1 and then 3, the flip-flops will also RESET.
The Keypad
To be more secure, the keypad should be on another remote PCB
The keypad could be normal pushbuttons
The keypad can have as many keys as you like. From the circuit you have 5 inputs, the D1, D2, D3, D4 and the ERR. The 4 D inputs are the 'correct' buttons. Each one must go to one and only key! For example, someone could connect the D1 to key number 4, the D2 to key number 2, the D3 to key number 9 and D4 to key number 5. The code to open the lock would be '4295'.
All the other buttons that will reset the circuit must be connected to the 'ERR' input. So if the keypad had 10 keys and the code was '4295' the keys 1,3,4,6,7,8 and 0 must be connected to the ERR input.
Here is an example of a keypad connection. A ribbon-cable is used to interface the keypad to the PCB. The four wires that correspond to the 4 buttons of the code are separately connected to the 4 D inputs. ll other wires are connected to the ERR input.
The keys can be a push-button with one normal-open contact, connected to the positive (VDD) of the circuit. Also, because i use CMOS, the keys could be touch-plates on the PCB itself. Look at the following PCB layout:
The circuit is designed to operate at any voltage between 5 and 15 volts. The only thing that needs to be changed is the relay. The one that i use is a 5V DPDT, but you can use whatever relay you like.
A nice print-out with some kind of artwork and holes that correspond to the keypad PCB-keys, can mask the keypad and make it more elegance
Bill Of Materials
Resistors
R1-5
Resistor 47 KOhm 1/4 Watt 5% Carbon Film
R6
Resistor 4.7 KOhm 1/4 Watt 5% Carbon Film
Transistors
Q1
2N2907 General purpose amplifier and switching transistor
ICs
IC1
CD 4013 Dual D-Type Flip-Flop
IC2
CD 4013 Dual D-Type Flip-Flop
IC3
CD 4081 Quad 2-input AND buffered B series Gate
IC4
CD 4072 Dual 4-input OR Gate
Misc
RELAY
Relay DSDP miniature 5V relay
A more simple circuit
This circuit does not have the 4072 chip. It has the same functionality, it is simpler, but it cannot be used with touch keypads.
If you will use normal push-buttons for the keypad, i suggest you use the following circuit instead. This is exactly the same circuit as the previous one, with the only difference on the reset. It does NOT use the 4072 CMOS for gathering the reset signals. Instead, it uses diodes connected as OR gates. It has the same operation as the previous one, but it is not recommended to be used with a touch keypad! Only with pushbuttons. This circuit is significantly simpler and equally secure to the previous one. It needs a smaller PCB an one chip less.
Here is the schematic:
Bill Of Materials
Resistors
R1-5
Resistor 47 KOhm 1/4 Watt 5% Carbon Film
R6
Resistor 4.7 KOhm 1/4 Watt 5% Carbon Film
R7
Resistor 22 KOhm 1/4 Watt 5% Carbon Film
Diodes
D1-4
1N4148 Switching Diode
Transistors
Q1
2N2907 General purpose amplifier and switching transistor
hey i want to ask you something about this circuit. what is the Q' output for the 1 to 3 FF suppose to be?
At 14 November 2013, 1:54:54 user J__ wrote: [reply @ J__]
It's more cheap and easy use a CD4017, because the state machine it's already implemented.
At 28 July 2013, 7:27:33 user Fung wrote: [reply @ Fung]
Actually I learned a lot from this circuit...
After testing this circuit on breadboard, I found that it would not reset after pressing the correct key-codes. For example I set the password as "9652", I enter it and the green LED lights up (which means a correct code sequence is entered), but it doesn't reset unless a wrong/reset key is pressed.
May be an auto-reset feature should be added? I referred some resources and found that it can be done by a 555 timer and some parts.
Based on your circuit, I made another version which also include the feature mentioned above and the "disable the keypad when green LED lights" (enables again after 5 seconds).
@ Kammenos
Sir I am sorry I wasted your time ...Actually one of my Ic's Pin was broken..thats why I was Getting the Problem with this ckt....But now its working perfect...Anyways thanx for ur time and help...
It would be a gr8 help indeed If u would provide me with a SINGLE SIDED PCB LAYOUT of this ckt.
As I m not able to make an effecient SINGLE SIDED LAYOUT (using Eagle and Circuit Wizard) by myself..
Thanx in advance
@Suryansh you need to run some tests to see what happens. I opened a forum thread for you to follow. Please continue this conversation there because it may become a long thread:
http://pcbheaven.com/forum/index.php/topic,1300.0.html
Thanks 4 ur response I checked all the connectns r Ok and when I tried this on my breadboard the same happend but to reset ,sometimes I have to hold the reset key ,somtims i have to tap it more than once and sometimes oly one tap,
i m totaly saturated .plz help
IM DOING DIS CKT FOR MY MINI PROJECT iN ENGINEERING(3rd year)
@Suryansh i suppose that either you use the incorrect FF output for the third FF (Q instead of Q-). Or the reset line has a problem. Which circuit are you using? The one with the 4072 or with the diodes?
Hi @Kammenos;
I am following ur projects,crkts.and they are just awesome...At present I am trying ur SimpleKeyCodeLock...I am using CIRCUITWizarad software for making PCB and I feed ur ckt in it and when I simulate the circuit it works fine .BUT......
When I Dirctly
PRESS AND HOLD the 4th(i.e,last FlipFlop)button for a while and then release it(without pressing any of the other Buttons),then my Solenoid i.e; the o/p goes high...WHY???What should I do???
Plz help me its Ergent:-(
Indeed there is a situation where Q' and Q become HIGH, but the circuit only uses the Q' output. So, here is the truth table of the Flip Flop(i use 1 for HIGH and 0 for LOW and x for NO CHANGE)
S R - Q - Q'
0 0 - x - x
0 1 - 0 - 1
1 0 - 1 - 0
1 1 - 1 - 1
So, when S and R are HIGH, the outputs Q and Q' are normally BOTH HIGH.
Suppose now that the code is 1234. I will only talk for the last FLIP FLOP (most right one). The R is LOW. When no key is pressed, the S is also LOW from the pull down resistor. From the truth table, R-0 and S-0 makes no change to the outputs. Now you press the digit 4 first. This makes S HIGH. But from the 3rd FF Q' is also HIGH, so the AND gate (IC3C) becomes HIGH, the OR gate (IC4A) also HIGH, and this makes ALL reset inputs HIGH. As long as you hold the digit 4, the inputs S and R of the flip flop will be simultaneously HIGH. Look what happens at the truth table in this situation. Both Q and Q;' are HIGH!!! When you leave the 4th digit, everything returns to LOW. So, S and R are LOW, and the FF does not change state - this means that it remains to RESET. Ther elay will be armed ONLY when the Q' of the 4th FF is LOW! This can only happen, when S is HIGH (the 4th digit is pressed) and R is LOW (no reset signal comes from another button or the OR gate). Did i solve your problem?
Sir i am having lots of confusion. i mean assuming the code is 1234, then i first press 4, from the circuit, S will be high and R will also be high,so how Q becomes low and Q' becomes high. sir please help me with that, it's urgent
for the first circuit(the one with the 4072 CMOS for gathering the reset signals), if the code is 1234, and assuming i first press 4, the circuit should reset, right? then Q' will be high or low?? can you please help me
Exactly what is it that you do not understand? How the AND gates (IC3) work along with the FLIP-FLOP (IC1-IC2)? You are talking about the first or the second circuit?
To do this, you need to connect all 4 'correct button' inputs to the 4 unused inputs of the 4072 (4072 pins 9-10-11-12). The output of this IC (pin 13) will be connected to the SET of another flip-flop. Then you will connect the RESET of this new flip flop to the output of the 4072 pin 1, that is the reset signal from an error button. The D and CLK inputs of the new flip flop goes to 0V. Now, you connect the RED LED to Q output of the flip flop, and the GREEN LED to the Q minus of the flip flop.
I have not test it but it could work. Test it and post the results.
At 15 January 2010, 16:24:05 user -lanz- wrote: [reply @ -lanz-]
I want to add LED's to this circuit.
Like this:
A red LED ON from the begining.
A green LED ON and the red LED OFF when correct button was pressed.
How to do it?
Exactly Lanz, All other to err. I kept it as simple as possible.
At 29 December 2009, 5:09:07 user -lanz- wrote: [reply @ -lanz-]
Well yeah,its the same.
U mean,all other button except the 4 code button should be connected to ERR?
Simple is nice Kammenos,rather than programming a microcontroller.
Oh, i got it now Lanz. Yes i could do that and it would be the same as i do now. But it would require more cables to draw on the circuit and this makes me sick sometimes. That's why i prefer to have separated connections. It is the same. Sometimes i should use more than i should, like now that i have separated on the top-right corner for the IC power supplies. It could be better with just one, but i think i am used to this way.
As for the code. There are 4 connectors, D1 through D4. Those should be connected to the 4 buttons that you want to have the code. For example, if you want to have the code '4521' you connect D1 to button 4, D2 to button 5, D3 to button 2 and D4 to button 1. All other buttons (as many as you like) should be connected all together to the 5th connector labeled 'ERR'. To change the code, you need to change the wires of the buttons accordingly. I know this is not an elegant way, but i did not want to use a microcontroller for this circuit. By the end of this week i will have prepared the video of this circuit in operation (like we do for all our circuits and experiments).
At 28 December 2009, 15:55:52 user -lanz- wrote: [reply @ -lanz-]
Well abt the picture,now i got it.Thanx
What i meant was to connect all GND connection to 1 GND source and all VCC connection to 1 VCC source.
How to set the desired code we want and how to change it?
click on the schematic and you will get it into full size 1672px x 832px.
"It will be perfect if u could connect the circuit to GND n VCC together."
I do not understand what you mean by this.
Also, please, subscribe to the comments board. If you do, you can edit your previous posts and not need to repost a new comment, if you only want to add something
At 27 December 2009, 15:53:41 user Lanz wrote: [reply @ Lanz]
Ur schematic picture is blur.
It will be perfect if u could connect the circuit to GND n VCC together.
At 27 December 2009, 15:43:14 user Lanz wrote: [reply @ Lanz]