This is of course the simplest electronic code lock circuit one can make. The circuit uses one transistor, a relay and few passive components. The simplicity does not have any influence on the performance and this circuit works really fine.

The circuit is nothing but a simple transistor switch with a relay at its collector as load. Five switches (S0 to S4) arranged in series with the current limiting resistor R2 is connected across the base of the transistor and positive supply rail. Another five switches (S5 to S9) arranged in parallel is connected across the base of the transistor and ground. The transistor Q1 will be ON and relay will be activated only if all the switches S0 to S4 are ON and S5 to S9 are OFF. Arrange these switches in a shuffled manner on the panel and that it. The relay will be ON only if the switches S0 to S9 are either OFF or ON in the correct combination. The device to be controlled using the lock circuit can be connected through the relay terminals. Transformer T1, bridge D1, capacitor C1 forms the power supply section of the circuit. Diode D2 is a freewheeling diode. Resistor R1 ensures that the transistor Q1 is OFF when there is no connection between its base and positive supply rail.

Circuit diagram.

one transistor code lock


  • This circuit can be assembled on a Vero board.
  • Switch S1 is the lock’s power switch.
  • The no of switches can be increased to make it hard to guess the combination.
  • Transistor 2N2222 is not very critical here. Any low or medium power NPN transistor will do the job.


  1. Abuyi M. J

    This is realy a very cool and interesting project, I can wait to experiment this one. Thanks Sir

  2. this was very good project.
    i need complete documentation regarding this project.
    can u send it to my email immediately…

  3. Seetharaman

    Hi Bose the relay requires only 30mA hence should not be a problem. Kindly check your relay and transformer rating. The transformer rating should be atleast twice the rating of the relay.
    Hi Vijay BF494 is an RF transistor its pin configurations are different from BC448 please check.
    Hi Michael you can use this as a burglar alarm by fixing and wiring the switches suitably on windows and doors.

  4. Gurmeet Sharma

    A nice Project Help me alot in my minor project

  5. Vijay Prasad

    I made a water level indicator from your given instruction i used 5 transistor of no. Bf494 when i immersed the aluminium wires in water in a bucket its no respond,what i do ? Please help me. My email id is

  6. hi…. i had assembled this cicuit but it does not working,the relay get 2.0 volt if the switches s0-s4 are on and s5-s9 are off,is 2.0 volt is enough to on the relay

  7. aakanksha

    hii….can u plz send me the full ckt details of electronic lock using 555 soon as possible. and how to make it and sum theory also. plz send it to my e mail id

  8. i wonder while i’m seeing this site . . i’m technician . . the given circuits r very useful 🙂 thank u lot
    i need 1185 audio circuit . . plz upload as soon as possible.

  9. wonderful circuit to operate a locking mechanism.

  10. Seetharaman

    This is a very useful and simple circuit. A battery back up can also be thought of for operation during power failure. A master key switch in parallel with Q1 in the event of any electronic failure.

  11. Saqib Ahmed

    This is extremely wonderful circuit. I’ll have to appreciate the works of Author and Publishers. Thanks a lot…………..