One transistor code lock

jacky March 3, 2010 19 Comments


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.
    November 22, 2017

    Simple and an Excellent Circuit

  • Abuyi M. J
    November 15, 2014

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

  • goutham
    October 27, 2014

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

  • Adeel
    July 15, 2012

    What is the secondary voltage?

    • Ebbe
      April 24, 2015

      Look at the relay voltage, and think…

  • priya
    April 15, 2012

    how 100k act as current limiter, plz help me

  • Seetharaman
    March 19, 2012

    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.

  • March 18, 2012

    A nice Project Help me alot in my minor project

  • March 18, 2012

    wwwwhello goee

  • michael
    March 11, 2012

    wat is d usage of dis circuit? tnx

  • Vijay Prasad
    January 16, 2012

    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

  • Bose
    December 30, 2011

    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

  • aakanksha
    August 19, 2011

    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

  • June 8, 2011

    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.

  • gsbv
    April 11, 2011

    Awesome circuit

  • kamal
    January 4, 2011

    darun circuit.mahashaya ke dhonnobad er jonno.

  • kamal
    January 4, 2011

    wonderful circuit to operate a locking mechanism.

  • Seetharaman
    February 20, 2010

    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.

  • February 19, 2010

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

Leave a Reply