Key Code Combination High Security Door Lock

Posted on May 13, 2017

This project is an electronic lock with many combinations that you can easily change and opens only with the correct combination of four consecutive numbers. The big advantage of the electronic lock is that the four numbers must be entered in the correct order one after the other. If a number is wrong then the circuit automatically resets to its resting state and the combination of the 4 numbers must go from the beginning. This is important when one tries to find the combination by doing tests, because the circuit will discourage him because he will return to calm for every wrong number.

Key Code Combination High Security Door Lock
Click here to download the full size of the above Circuit.
Key Code Combination High Security Door Lock - image 1
Click here to download the full size of the above Image.
Key Code Combination High Security Door Lock - image 2
Click here to download the full size of the above Image.
Key Code Combination High Security Door Lock - image 3
Click here to download the full size of the above Image.


  • Power supply: 9 VDC only with 9V battery
  • Current: 0.1mA at rest 40 kA when the relay is closed



  • Thousands of combinations of four-digit numbers
  • Operate only with the correct number and the correct order
  • Ability to use deceptive numbers for reset
  • Collaboration with alarm circuits
  • LED with LED when the combination is correct
  • Device control via built-in relay
  • Low power consumption
  • Built-in touch keyboard

Function of the circuit

Due to the use of integrated circuits, the entire construction becomes simple. With only a few external resistors, capacitors, a transistor and a relay, this electronic lock offers all of the above-mentioned features and only encountered in much more expensive locks. The heart of the electronic lock is the two integrated CMOS 4013 circuits that have two D FLIP-FLOPs each. The FLIP-FLOP function is pretty much known to the electronics. The basic property that we take advantage of in the circuit is that when a FLIP-FLOP receives a pulse or voltage at its input, it changes its output state.

Beginning with the touch switches, we notice that there are 4 separate switches with "A", "B", "C" and "D". These switches, when closed, connect the (+) of the power source (9VDC) via the resistors R1, R3, R7 and R9 corresponding to the clock inputs of the four flipflop. When one of these switches is closed then the corresponding (F-F) changes state to its output (Q).

Starting from the first (F-F) and closing the switch (key "A") (the switch with the number to be pressed first), a voltage is displayed on the clock terminal of the first (F-F).

Automatically changes the Q output of (F-F) and feeds the second (F-F). Then the second (F-F) stays in this state waiting to change its status. This will only be done after the second switch is pressed (key "B"). This will change the status of the second (F-F) and from the output (Q2) the pulse will pass to the 3rd (F-F) (Data input). The third (FF) remains in this state until the number (key "C") is changed to change the status of the third one (FF) to feed the Data 2 input of the fourth (FF) and finally the fourth number Key "D"), so that a voltage will be output at the pin 13 at QF of the fourth (FF) and will feed through the R11 transistor Q1 and then close the relay while the LED D2 will also light up indicating that the The entire placement procedure of the code number was given in the correct order.

In this simple way we can give key C and D switches any number we want by putting our own code number. To make life difficult for anyone who wants the test method to break the lock by testing all possible numbers there are five circuit breakers connected in the circuit parallel to the reset key.

These switches are inserted in the order of 4 real codes and have the property of canceling the whole process of sequential 4 (F-F) activation if one of these switches is accidentally pressed.

That is, if we have given the keys "A" - "D" for example the numbers (6,8,4,3) the relay will only be closed if the number switches (6,8,4,3) And only then. By connecting one or more switches from the series of reset keys to the other numbers from the code that we put them ie 1,2,5,7,9 by pressing code 6,8 after the fifth immediately the circuit will automatically reset will come back Ie in the resting state, and the positioning of the code number 6,8,4,3 should be placed from the beginning in the correct order without another number being inserted.

This is so if someone who does not know the code attempts to open the lock by trying several four digits to be disappointed quickly after the circuit cancels the number each time it has set a number of the reset keys. Finally, capacitors C2 and C1 filter the supply voltage from unwanted buzz and frequencies.


It is a circuit that has two constant states and has the ability to jump from one situation to another when a control signal is applied at the input and remains in this state after the control signal has been applied. So the flip flop can be considered as an elementary memory. D flip flop is a form (F-F) where the letter D defines the Delay word. This means that n output of the DFF is a function of the input that a pulse occurred earlier.

For example, if the logic "1" appears in the input after the next pulse, it will be 1. The DFF changes its state after a pulse, ie when the control pulse is applied to the input, it will not immediately change state to Next input pulse. From this property he was called D (delay) flip-flop.


Use a low power (15-25W) solder earthed. Start building by first attaching the legs to numbers 1 (+) 2 (-) 3,4 and 5 (relay outputs). Then attach the 2 U1 and U2 integrated circuit boards with the notches upward as shown on the board. Then glue the eleven resistors R1-R11, capacitors C1 and C2 (observe its polarity).

Finally, do not overheat the D1 and D2 diodes and observe their polarity by following the circuit board layouts. The diodes D1 and D2 are connected in series. The cathodes of both diodes are points that are not marked.

In Led (D2), the cathode is the notch with the notch while the foot with the coarse line is the cathode of D1. After attaching all the components correctly, glue the 9V battery clips to the points 1 and 2 with the black cable at the (-) point 2 and the red at the (+) point 1.

Now you can place the secret number you only know. Suppose you want to enter code 4253. You will carefully follow the links below. Connect with a piece of wire in turn

  1. point A with the fourth row of holes
  2. point B with the second row of holes
  3. point C with the fifth row of holes
  4. point D with the third row of holes

This is how the 4253 code is placed

If you want to place the misleading numbers from one to five, make the following links:

Below points A, B, C and D there are 5 holes called reset. Attach these five points to the five holes with the remaining rows of holes NOT connected, ie with the numbers 1 (first row) 6 (sixth) 7 (seventh) 8 (eighth) and 9 (ninth) series.

We advise you to place all five misleading numbers because it makes it harder for anyone to try to break the lock by trying different numbers.

Even if it knows that the code is four-digit, the probability of clicking a number of the reset keys is great and so the process is canceled. In this way he is quickly disappointed because the chances of finding the right code are minimal. Finally, place the integrated circuits on their bases taking care not to grasp them too much (it is best not to grab them with bare hands because it is CMOS but if you catch it, be sure to get rid of static loads first by grasping a grounding point such as a water pipe. Their notches look upward as the printed circuit shows. Turn the board toward the side of the welds. Only supply the circuit with a 9V battery and not a power supply. Consumption is minimal. A 9V battery lasts many months.

Tap a random four-digit number. You will see that nothing will happen. Now tap the number you have selected. In this case, if the code is the number of the example, ie 4253, you will see that by first pressing 4 second 2, third 5 and 4, you will immediately hear the relay close and the LED will light up.

This shows that the circuit works. Try the number 4,2,8,5. He will not accept the circuit since the first two numbers 4 and 2 are correct but the third number (8) will reset and cancel the process. If it does not work try to wet your fingertips.

If the circuit does not work

If the circuit does not work then check the following points carefully:

  1. Maybe you have shorted some point on the board mainly the feet of the integrated.
  2. You may have made cold soldering or have used excessive solderin.
  3. Perhaps you have placed a component upside down or someone else's position.
  4. You may have been overheating a sensitive component (diode, transistor or static IC loads because it is a CMOS.
  5. You may have mistaken the code and you have stuck two numbers on the same line.
  6. Maybe your fingers are dry.


  • R1,3,5,7,9 .......... 100KΩ 1/4W
  • R2,4,6,8,10 ........... 4,7MΩ 1/4W
  • R11 .................. 18KΩ 1/4W
  • C1 .................. 100nF Polyester
  • C2 .................. 220μF/16V electrolytic
  • D1 ............... 1N4148 universal passage
  • D2 .................. Led
  • Q1 ................ BC558 PNP transistors
  • Relay ................ 6V one-touch relay
  • U1,2 ............ CD4013 double D flip-flop
  • 2 Bases for CD4013
  • 1 9V battery clip

Leave Comment

characters left:

New Circuits



Popular Circuits

Security Lock with keypad and LCD (PIC16F84A)
Microvolt probe
More DIY IR Jammer
ir volume control
AD1865 based audio DAC with I2S input and voltage output
XTR101 thermocouple input circuit diagram