This is easy and Simple Electronic Code Lock Circuit.
To open door or box no need of key we can use special code instead.
This circuit uses buttons and code to the open lock.
Only correct code can open and wrong code will not work.
Circuit Working:

Parts List:
Component | Quantity |
---|---|
Resistors (1/4 watt) 1k | 2 |
Semiconductors | |
Transistor BC547 | 1 |
Diode 1N4007 | 1 |
Relays | 1 |
Mini switches (ON/OFF) | 8 |
This code lock circuit is famous because design is very simple.
It uses smart code with only one main part and 8 push buttons.
How this lock circuit work?
To turn ON the relay we must press all 4 buttons S1, S2, S3, S4 together.
If we press any wrong button like S5 to S8 relay will not work and lock will stay closed.
Very important: power supply voltage must be same like relay voltage.
Small transistor like BC547 can take current up to 50mA.
If relay needs more power then use transistor like 2N2222 it can take 0.2A.
Formulas:
Relay Coil Current is tool for finding how much resistor (R) needed for BJT transistor to turn ON relay coil.
Lets see what is inside the formula:
R = (Us – 0.6) × hFE / Relay Coil Current
- R is resistor value in ohms Ω we want to find this.
- Us is power supply voltage in volts V.
- hFE is BJT gain how much it can increase base current.
Relay Coil Current is how much current is in Amps A which is needed to turn ON the relay.
How to use this formula:
Voltage Drop:
(Us – 0.6) means voltage drop at base emitter of BJT.
Most BJT have drop of 0.6V so we subtract it from power supply.
This give us voltage for base resistor.
Base Current Gain:
hFE show how much transistor multiply base current.
Bigger hFE = less base current needed to turn ON relay.
Ohms Law:
Use formula R = V / I.
This will help find correct resistor R so enough current goes in base of BJT which is not too much.
In simple words:
This formula help choose good resistor so transistor work correct and switches ON relay coil with right amount of current.
How to Build:
To build a Simple Electronic Code Lock Circuit following steps are used for connections:
Identify Parts:
- Check all parts in circuit diagram are there.
- Be sure all parts match the needs of circuit.
Make Circuit:
- Connect power supply positive (+) to relay common pin.
- Connect relay NO (normally open) pin to positive side of code lock system.
- Connect power supply negative (-) to negative side of code lock.
Button Connection (S1 to S8):
- Put S1, S2, S3, S4 in parallel.
- Connect this group to relay input.
- Connect S5, S6, S7, S8 to ground to stop wrong press from turning ON relay.
Use Resistors:
- Put resistors where needed to save parts and control current flow.
LED (Optional):
- If we use LED then connect it with resistor in parallel to relay coil.
- This show light when relay is ON.
Soldering Work:
Test Circuit:
- Press all buttons S1 to S4 together, relay should turn ON and unlock the door.
- If wrong button is pressed then relay will stay OFF.
Be Safe:
- Before power ON check all wires and part values.
- If we are not sure how to make circuit then ask someone who knows or learn more before trying.
Conclusion:
Simple Electronic Code Lock Circuit are better than old key locks.
We can change code easily and can see who entered and how are connected with other security systems.
This type of circuits are used in homes, offices, factories and more.
References:
Development of a Programmable Electronic Digital Code lock system
Leave a Reply