10 Key Code Lock Switch Circuit

This is a key code lock switch circuit, type of electronic circuit. To replace a conventional normal key switch, without inserts keys. But you can press the number code instead of unlocking keys. We do not need to carry a load key, and do not worry about your keys are lost. We just must remember to commit to code only.

10 Key Code Lock Switch Circuit

The feature of this circuit

  1. Using a four numeric code number and can change one thousand numbers.
  2. The case of other people to know our original code. The code can be changed easily.
  3.  It is a simple digital circuit that without a microcontroller. Thus it is no programming, easiest, and cheaper.

The circuit is designed to have the reset system, immediately enter the wrong code. So can prevent pressing a random numeric code. Because in this circuit the switches are set to the ten numbers, be the code switch 4 pcs. and be reset switches 6 pcs.

The advantages of having a system reset. Suppose we set the code number is 6583. If people do not know the code, they will press random from 0 to 9.  It will have one correct number is 6.

But we press randomly in second, that is not 5. Then, the circuit will reset number 6 that last remember go away.

Thus, we will enter a correct code, just the first digit only.  However, if it is without the reset system. Even those who do not know the code, it can press random in a fourth only.

When we hit 0-9 from the first round, we will correctly hit to the No.6.  Then we hit the second round will correctly is one of No.5 as well. When the full four rounds, it will have a four code so the circuit is working.

This difference is quite obvious.

We have talked about its advantage and disadvantages for enough.  Then to look at the circuit and how it works really well.

How it works

This circuit uses a 74HC4017 or CD4017 IC  number that is DECODE Counter model. It serves to change the code.

In normal conditions, when we provide a power supply to this circuit. Then, there is a positive voltage at the output, pin 3 of IC1.

When you press the switch A, S1. The positive voltage from pin 3 via it to the pin 14 of IC1, input pin.

Key Code Lock Switch Circuit Using IC-4017
Key code lock switch circuit diagram

Next, when IC1 has the input is a positive voltage. It will move the output from pin 3 to pin 2.

So the next switch that we must press to be switch B, S2. It causes the positive voltage at the input of IC1, in next step.

As you can see, if we do not press the switch B, it will not change any more of IC.

And if we push a wrong switch in one of six options on the left-hand side of this circuit.

It is the positive voltage to pass through this switch to the input pin 15, reset pin of IC1. When the pin 15 is the positive voltage, IC1 will change the output to at pin 3.

Thus it is resetting switch A to restart new again.

If we press these switches in the correct ways from A, B, C and D in order. IC will move output to pin 10. Which it connects through a diode, and R-10K to pin B of the Q1-2SC1815.

Then, Q1 conducts power to relay-RY1 and LED1, they work together. the LED lights up.

Let us know, for the 5 diodes that connected to the out of IC1. They protect a collision of the output. For example, the two codes are the same as 5385 code.

How to set the code on button keys

When we need any code, we can connect the code number to switch positions.

The order of the codes is not the order of the switches.

For example, we need code is 5387. We have to connect as follows.

  1. First, CODE 5 to Switch 1 (A) at pin 3  of IC1
  2. Second, CODE 3 to Switch 2 (B) at pin 2 of IC1
  3. Third, CODE 8 to Switch 3 (C) at pin  4 of IC1
  4. Fourth, CODE 7 to Switch 4 (D) at pin  7 of IC1
  5. Fifth, other CODEs to Switch 5 to 10, to connect to pins of IC1

Look at setting code diagram below.
block diagram of Code setting

Parts List
IC1_74HC4017 or CD4017 —DECODE Counter model
Q1_2SC1815 or 2SC828 —45V 0.1A NPN Transistor
RY1_Relay 9V—One contact 5A
C1_100uF 25V—Electrolytic
0.25W, 5% Resistor
D1-D5_1N4148—0.4A 200V Diodes
D6_1N4002—1A 200V Diode
LED1_LED any color 3mm.
S1-S10_Switch Tactile ON OFF Single Pole, Single Throw Round Button

Keep reading: ‘16 key encoder using IC 74C922N’ »

How it builds
If you want to build this project, can assemble them on universal PCB. Because of fast and saving.

But you need to make the general PCB,
Component-layout-of-key-code-lock-switch-circuit-min.jpg Actual-size-of-Single-sided-copper pcb of key code lock switch
Actual-size of single-sided Copper PCB layout and

Component layout.

We test the circuit on a breadboard it working, as Figure 2


Watch video building and testing circuit on a breadboard.

Note: Q1 you can use a lot of numbers that is NPN transistors but the position legs are different.

Creation – Application

You should assemble include the parts to the correct place. The small first such as R, Diodes, IC Socket, etc. Then, followed by large parts.

When place parts ready, Check everything compete before, insert IC1 into a Socket. Next, connects a power supply, and pressing code.   If the relay pulls in and LED glows, the circuit works well.

Keep reading: ‘One button code Switch’ »

Related Posts


I always try to make Electronics Learning Easy.

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments


I love electronic circuit. I will collect a lot circuit electronic for teach my son and are useful for everyone.
Close Menu