In this post I have explained how to make a simple transistor latch circuit using just two BJTs and a few resistors.
Introduction
A transistor latch is a circuit which latches ON with a permanent high output in response to a momentary input high signal, and continues to stay in this position as long as its in the powered condition, regardless of the input signal.
A latch circuit can be used to lock or latch the output of the circuit in response to an input signal and sustain the position even after the input signal is removed.
The output may be used to operate a load controlled through a relay, SCR, Triac or simply by the output transistor itself.
Working Description:
The simple latch circuit using transistors I have I have explained in this article can be made very cheaply using just a couple of transistors and some other passive component.
As shown in the figure transistor T1 and T2 are configured in such a manner that T2 follows T1 to either conduct and or to stop the conduction depending upon the trigger received at the input of T1.
T2 also acts as a buffer and produces better response even to very small signals.
When a small positive signal is applied at the input of T1, T1 instantly conducts and pulls the base of T2 to ground.
This initiates T2 which also starts conducting with the received negative biasing offered by the conduction of T1.
It must be noted here that T being NPN device responds to positive signals while T2 being a PNP responds to negative potential generated by the conduction of T1.
Uptill here the function looks pretty ordinary as we witness a very normal and obvious transistor functioning.
How the Feedback from R3 Works to Latch the Circuit
However the introduction of a feedback voltage through R3 makes a huge difference to the configuration and helps to generate the required feature in the circuit, that is the BJT circuit instantly latches or freezes its output with a constant positive supply.
If a relay is used here it would also operate and stay in that position even after the input trigger is completely removed.
The moment T2 follows T1, R3 connects or feeds back some voltage from the collector of T2 back to the base of T1 making it conduct virtually “for ever”.
C1 prevents the circuit from getting activated with false triggers generated from stray pick-ups, and during switch ON transients.
The situation can be restored back either by restarting power to the circuit or by grounding the base of T1 through a push button arrangement.
The circuit can be used for many important applications, especially in security systems and in alarm systems.
Calculations and Formulas:
Threshold Voltage for BJT Activation
The threshold voltage values for turning ON or OFF the NPN and PNP transistors remain the same:
- NPN Transistor Turn-On Voltage (
VBE(on)
):VBE(on) ≈ 0.7V
(for silicon BJTs) - PNP Transistor Turn-On Voltage (
VEB(on)
):VEB(on) ≈ 0.7V
(for silicon BJTs)
These values determine when the base-emitter junction of either transistor is forward biased, enabling current flow and turning the transistor ON.
Base Current (I_B) Calculation
For both NPN and PNP transistors, the base current is still calculated in relation to the collector current:
- Base Current for NPN Transistor (IB(NPN)):
IB(NPN) = IC / βNPN
- Base Current for PNP Transistor (IB(PNP)):
IB(PNP) = IC / βPNP
Where:
IC
is the collector currentβ
is the current gain of the transistor (typically 50–300)
This is relevant for understanding how the transistors maintain their ON or OFF states once latched.
Collector-Emitter Voltage (V_CE)
The voltage across the collector-emitter junction of each transistor is very important for ensuring the transistors remain in the active or saturation regions:
- NPN Transistor Saturation Voltage (VCE(sat)):
VCE(sat) ≈ 0.2V
(when fully ON) - PNP Transistor Saturation Voltage (VEC(sat)):
VEC(sat) ≈ 0.2V
(when fully ON)
These values are relevant when the latch is "set" or "reset," which ensures that both transistors are either fully conducting or completely turned off.
Latch Holding Condition
Once the latch is set or reset, the feedback ensures that the state is maintained regardless of the input signal:
- Feedback Current (IFB):
IFB > IB(required)
Where, the
is the base current needed to keep the transistor latched in its ON state.IB(required)
This feedback signal ensures that once the NPN or PNP transistor is turned on, the circuit remains latched in that state until forced to reset.
Resistor Calculations
Resistors will control the currents flowing through the transistor and define the behavior of the circuit:
- Base Resistor (RB):
RB = (Vinput - VBE(on)) / IB
- Collector Resistor (R_C):
RC = (VCC - VCE(sat)) / IC
Where:
Vinput
is the voltage applied to the base of the transistorVCC
is the supply voltageIB
andIC
are the base and collector currents, respectively
These resistor values help in controlling the current levels to properly switch and latch the circuit.
Switching Time
The switching time for the latch circuit or the time it takes for the latch to change states is determined by the charging and discharging of junction capacitances:
- Rise Time (tr):
tr ≈ (RB * Cj)
- Fall Time (tf):
tf ≈ (RC * Cj)
Where Cj
is the junction capacitance of the transistor which determines how quickly the transistor can switch between states.
Hysteresis Voltage
Hysteresis ensures that once the circuit is latched in a particular state... it remains stable:
- Hysteresis Voltage (Vh):
Vh = IFB * Rfeedback
Where:
Rfeedback
is the feedback resistor value.
This feedback voltage creates a gap between the switching thresholds which helps to prevent oscillation and ensurs stable operation.
Testing procedure can seen in the following video tutorial:
Parts List
- R1, R2, R4 = 10K,
- R3 = 100K,
- T1 = BC547,
- T2 = BC557
- C1 = 1uF/25V
- D1 = 1N4007,
- Relay = As preferred.
Marko says
I’m learning electronics in my spare time. I already know some basics about electronics and still learning. I’m trying to make an alarm that uses 4011 NAND gates for checking if the an alarm wire is broken and then it should use a latch circuit to turn on a microcontroller that turns on the speaker, leds etc.
Then after a specific time the microcontroller should turn off the latch circuit, to preseve energy. This is because I want to make a small battery powered multipurpose alarm system that could be used in bikes to prevent thefts (with vibration activated sensor/switch) or as a door alarm (with NC switch) in my apartment.
I already understand quite well how NPN and PNP transistors works, but I don’t currently understand the purpose of the C1 capacitor how it works here in the circuit.
Swagatam says
Thank you for your question, I appreciate your interest in electronics.
Could you please tell me where is this C1 capacitor situated?
Is it connected in series with a resistor or after the resistor and across ground?
If you can refer me to the schematic or provide the exact configuration details of the capacitor in the circuit, I can certainly help you to understand how the capacitor may work to fulfil its specific job.
Marko says
Actually I mean the C1 capacitor in this example latching circuit you have made. To fully undertand this latching circuit, is this a decoupling capacitor or what exactly is it called in this setup? Or is this used for some kind of filtering or debouncing prevention?
But about the alarm circuit I’m trying to make, part that would activate the latch circuit would look something like this. I have 4011 ICs for this purpose, so one NAND gate would be used for checking if the circuit is closed and another NAND gate would be used to invert the output, so it could be used by a latch circuit.
I have not yet fully planned this, but my initial idea was to keep the alarm latched for a specific amount of time and it could probably be done using your latch circuit. In this example image I posted, the 1K resistor is just there because I quickly added something to demostrate.
Why I want to keep the alarm latched is that if someone would close the circuit again, the alarm so still be on and not turn off.
https://i.postimg.cc/GpkJPccS/alarm-nand.png
Swagatam says
Ok, understood!
The C1 in the above latch circuit is used for filtering external noise and to prevent false activation of the latch circuit.
However, the best position of C1 is across the base/emitter of T1, so that the noise is filtered right at the beginning of the circuit.
If you want to latch your alarm circuit for some specific amount of time, then I would recommend you using a 555 monostable circuit.
Alternatively, you can simply use your NAND gates to create a simple monostable for the same purpose.
Let me know if you have any further doubts or questions.
Jan says
I want the latch to stay even if the input signal drops to 0. In my preferred solution the only way to break the latch is by switching off power. How do I achieve this?
Swagatam says
The circuit will stay latched even if the input signal is removed. The circuit needs only a momentary input signal to get latched.
Jan says
thanks for your quick reply. at the moment, the latch drops when the base resistor of T1 is connected to ground. I don’t want this to happen. instead I want the latch to stay until the power is turned off even if the input signal drops to 0. Can you suggest a modification?
Swagatam says
For that, you can add a 1N4148 diode at the input side of R1, and feed the trigger signal through this diode.
Jan says
it worked, thanks for your help
Jan
Swagatam says
Glad it worked…
JimmyCrackedCorn says
I have a circuit that takes less than 100usec to “get started” and my input signal is high during this startup period. How can I ignore the first 100usec of input before using the input to trigger? Within ~ 40usec my input is low and later (tens of seconds) the input goes high as expected and this is the transition I wish to react.
Swagatam says
Controlling a microsecond signal looks difficult, I can’t figure out a configuration that would control the microsecond timings with such accuracy.
Ryan says
Amazing! Thank you so much!.
I simulated it and it works. Just the 2 questions I have are:
1) I have a 20us negative pulse that I need this transistor to switch on to and turn on the LED. Will this work?
2) There could be a lot of noise in the signal that will trigger the base of T2. I know you mentioned that C1 should help with the filtering, but now that i have switched the input to the base of T2 would this capaitor still help with noise or should I make modifications?
Swagatam says
Thanks, Glad it helped.
C1 might help to eliminate false switch ON only if it is connected directly across base/emitter of T2. However if this done, then the 20us pulse will be too short and might get quickly absorbed by the capacitor, so that no signal reaches the T2 base.
Nevertheless, you can try smaller capacitor values such as 0.01uF across base/emitter of T2 and see if that helps to mitigate the noise and yet allows the 20us triggering.
Ryan says
I would like to know how to switch the circuit on a negative going pulse rather than positive. What changes do I need to make ?
Swagatam says
Apply the negative pulse to the base of T2 via a resistor.
R1 can be removed, it is not required now.
Girish Chauhan says
I am giving triggering of 1 volt from ccd camera video signal ,how can we make it possible to disable the latching when the trigger voltage is deactivated
Swagatam says
It means you don’t want the latching feature, for that you simply have to remove the R3 resistor link.
Girish Chauhan says
Thanks Sir
Girish Chauhan says
Thanks for the circuit, i made and it works fine, is there any way the the the latching will reset when the trigger circuit is removed if so please share diagram
Swagatam says
Thank you for the update! Triggering is supposed to be done only once, then the circuit latches and remains latched. If the circuit resets on removing the triggering source then it won’t be a latch circuit.
Cn sampath kumar says
In connection with previous ckt my inputs both are +ve for dis i need ckt sir.
Swagatam says
Try this circuit then:
https://www.homemade-circuits.com/wp-content/uploads/2012/08/set-reset-latch-circuit.png
Cn sampath kumar says
Pl give me SR Transistor lactch ctk with detail
Swagatam says
here it is:
https://www.homemade-circuits.com/wp-content/uploads/2022/01/motor-set-reset-control.jpg
Jack says
Built circuit but it latches on application of power. I have checked and rechecked the circuit and soldering but I am at a loss
Swagatam says
Connect the C1 across base/emitter of T1. C1 can be a 1uF/25V. This will stop the self latching issue.
Rahul Bansal says
Hi
Thank you for the post. I tried replicating the circuit with BD139 and BD140 transistors. All seems to work well, except that there is a voltage drop across T2. The input voltage is 9V, the output is only 4.5V. Why would this be heppening?
Swagatam says
Hi, that should not happen. The collector of the PNP must show the same voltage as its emitter supply. Did you check the voltage without a load or the relay? Please check it without a load.
Doug says
Hi Swagatam,
I have what I suspect is an impossible circuit, but want to run it pass you to confirm.
I am sure you have knowledge of a simple moisture tester. This device uses dissimilar metals generally made up of copper and zinc. These metals when exposed to moisture (water) give a very low electrical current, this is the basis of my question.
I would like to know if there is any circuit and or device that could be powered by say a 3.7vdc lithium Ion battery or a 1.5VDC AAA battery that is basically in the off position, until two leads senses moisture, thereby powering up and indicating by a low volt LED that there is moisture across these 2 “LEADS” dissimilar metals but wouldn’t cause any, “shock” if applied to sensitive skin?
Swagatam says
Hi Doug,
It is definitely possible, I have designed the circuit and have posted it at the end of the following article, you can check it out:
https://www.homemade-circuits.com/soil-moisture-tester-circuit/
KRISHEN GOPAL KATHEL says
For very less sensitive , what can we do as for water level sensing by 12 volt relay.
Swagatam says
Could not understand what is less sensitive, please explain properly!
Suresh says
Can latch be ‘broken’ by an input based transistor switch inserted in the connection with 110 k reactance?
If the answer is ‘yes’, can one use more than one input as ‘breakers’ ?
Swagatam says
yes that’s possible, as given in the following figure:
https://www.homemade-circuits.com/wp-content/uploads/2011/12/set-reset-circuit.jpg
Yogesh says
Sir, I want to create a simple latching circuit,
which can turn on/off by using single push button only.
Sir,Please note that,i want to achieve this task without using IC and microcontroller.
Please help me to design this circuit
I eagerly waiting for yours response sir
Swagatam says
Hi Yogesh,
You can refer to the second last circuit from the following article:
https://www.homemade-circuits.com/build-these-simple-flip-flop-circuits/
However, without using an IC, and using only transistors may not give reliable results….using IC will give extremely reliable results.
Yogesh says
Thank you sir,☺️????
Yogesh says
Sir, what is the use of resistor R4 in this circuit?
And what happens,if I won’t use R4 resistor present in this circuit?
Please clear my doubt sir
Swagatam says
Yogesh, R4 keeps the T2 base to a proper switched OFF condition when T1 is not conducting, which ensures that the T2 base is always held at a well defined potential and never in the floating position.
Yogesh says
Thank you sir, ???? now I understood
And again thanks for yours speedy response sir……
Swagatam says
You are welcome Yogesh!
Marko says
The R4 is called a pull-up resistor in this case. Just in case if someone else tries to figure out how the circuit works.
But about the R3 resistor, is it really needed, or could the feedback loop use only the R1 resistor? I have some difficulties understanding the function of the R3 resistor.
Swagatam says
R4 is actually a pull-down resistor in this case, because T2 is a PNP transistor.
R3 is the heart of the latch circuit, without it the latching would never happen.
With a momentary base trigger when T1 is turned ON, T2 also is also turned On, which allows a feedback voltage to pass through R3 and reach the T1 base, so that now T1 and T2 lock on with each other ensuring that the circuit gets latched regardless of whether T1 base is getting any external trigger or not.
Paul_John says
Hi, I simulated your circuit with 12V input but it doesn’t work as intended – can you please provide design guidelines for selection of resistors?
Swagatam says
Hi, the circuit is fully tested, so you can be sure it will work if you build it practically.
Paul_John says
I did build the circuit – is it mandatory to use BC547 and BC557? I’m trying to use BC807 and BC817 instead…
Swagatam says
Any NPN/PNP combination should work. It is advisable to remove the capacitor C1 from the existing position and place it across the base/emitter of T1 for better response