A previous Design Idea outlined a relatively simple circuit in which a momentary pushbutton could be made to function like a latching, mechanical switch. The article generated a good deal of reader feedback. Amongst other comments, readers questioned whether it would be possible to adapt the circuit to provide (a) a cross-coupled arrangement in which two switches could be made to 'cancel' each other; and (b) a 'time delay' version in which the circuit would turn off after a predetermined time had elapsed. This idea attempts to address each of these suggestions.

Cross-coupled, latching switches
Figure 1 shows two switch circuits connected in a cross-coupled fashion where each switch is turned on and off by its own momentary pushbutton, and is also switched off whenever the other switch is turned on. This mutual cancelling behavior lends itself to applications such as automotive indicators.

Figure 1 Cross-coupled switches latch on independently but cancel each other.
Click to enlarge

The two switch circuits are identical and mirror each other, i.e., R1a provides the same function as R1b, Q1a behaves exactly like Q1b, and so on. Furthermore, except for the additional cross-coupling components (C2, D1, D2, R6, R7, and Q3), each circuit is largely identical to the one shown in Figure 1(a) of the previous Design Idea where you'll find a detailed description of how the basic circuit functions. Remember that R5 may or may not be necessary depending on the nature of the load, and that for loads such as motors it may be necessary to fit a blocking diode between the OUT (+) terminal and the load.

To understand how the cross-coupling works, assume that switch (a) is currently off, and switch (b) is on, such that Q1a and Q2a are off, and Q1b and Q2b are both conducting and providing bias for each other via R3b and R4b. If momentary pushbutton Sw1a is now pressed, Q1a and Q2a switch on, and switch (a) latches into its energized state. At the moment Q2a switches on, a pulse of current is delivered to the base of Q3a via D1a, C2a, and R7a causing Q3a to switch on momentarily, which briefly shorts Q1b's base to 0V. Both Q1b and Q2b now turn off and switch (b) latches into its off state. Switch (a) is now latched in its energized state and the switches will remain in this state until either of the push switches is pressed. So, if Sw1b is now pressed, Q1b and Q2b switch on, switch (b) latches into its energized state and Q3b momentarily switches on causing Q1a and Q2a to switch off.

The length of time for which Q3 is briefly pulsed on is determined by the C2-R7 time constant and must be long enough for the opposite MOSFET to turn off completely. Remember that when Q1 turns off, the charge stored on Q2's gate must be removed completely via R1 in series with R3. Some 'large' (high current) MOSFETs have gate capacitances of tens of nanofarads, so with R1 = R3 = 10kΩ it can take several milliseconds for the gate to discharge completely. Now, with C2 = 100nF and R7 = 10kΩ, Q3 clamps Q1's base for around 5ms which should be long enough to turn off the majority of P-channel MOSFETs.

At the end of the current pulse described above, the voltage stored on C2 will be roughly equal to the supply voltage, +Vs. Without diode D1, this voltage would hold Q1 on, thereby preventing the switch from turning off. With D1 in circuit, the blocking action allows the switch to turn off normally, such that when Q2 turns off, the voltage on C2 discharges via the path formed by R6-D2-R7.

Although switch (a) and switch (b) are identical, they do not need to share the same supply voltage, i.e., +Vs(a) and +Vs(b) do not need to be equal and can be derived from different sources. However, for the circuit in Figure 1 to achieve cross-coupling, switch (a) and switch (b) must share a common ground return (0V). For applications where this is a problem, Q3a and Q3b can be replaced by optocouplers (Figure 2), which allows each switch to have its own ground return, galvanically isolated from the other. Most common-or-garden optocouplers should work perfectly well, but remember that the opto's LED requires more drive voltage than a transistor, so it may be necessary to reduce the value of R7 (and increase C2 accordingly) if the supply voltage, +Vs, is fairly low.

Figure 2 Optocouplers allow for completely isolated cross-coupled switches.

Latching switch with timed output
Certain applications may require a latching switch that turns off automatically after a preset period of time. A fairly simple way of achieving a timed output is shown in Figure 3, where Q1 has been changed from a single transistor to a Darlington pair, and capacitor C2 has been inserted between Q2's drain and R4. As before, a momentary pushbutton, Sw1, is used to control the circuit. When the switch is closed, Q2 turns on and sources bias current to the Darlington's base via C2 and R4. The circuit now latches into its energized state with Q2 held on via Q1.

Figure 3 Minor changes to the basic switch circuit allow for a preset timed output.

C2 now begins to charge and the voltage at the junction of C2 and R4 falls at a rate largely determined by the C2-R4 time constant. As this voltage falls, so does the base current delivered to the Darlington via R4; eventually, the Darlington's collector current becomes too small to provide sufficient gate drive for Q2 and the MOSFET switches off. The switch now reverts to its unlatched state and C2 discharges via D1 and the load in parallel with R5 (if fitted). Note that the switch can be unlatched at any point during the timed 'on' period simply by pressing the pushbutton - it is not necessary to wait until the output has timed out.

The high current gain afforded by the Darlington pair allows for large values of R4 (on the order of several megaohms) to be used to produce a long time constant. A test circuit powered from a 15V supply generated an 'on' time ranging from around nine seconds with C2 = 1µF and R4 = 1MΩ to just over 15 minutes with C2 = 10µF and R4 = 10MΩ. Increasing C2 to 100µF resulted in an 'on' time well in excess of two hours.

Although adequate for undemanding applications, the circuit suffers from several drawbacks which may limit its suitability. The Darlington's current gain (which can vary considerably from device to device and with temperature) plays a significant part in determining the circuit's time constant, thereby making the circuit unsuitable for applications requiring precise control of the 'on' time. Likewise, changes in supply voltage also affect the 'on' time.

Furthermore, the fact that the Darlington's collector current decreases gradually results in the MOSFET turning off relatively slowly. This effect can be seen in the oscillograph (Figure 4), which shows the output of a circuit powered from 15V with a 500Ω load using an FDS6675A MOSFET for Q2 (R4 = 1MΩ). Note how it takes the output almost three milliseconds to transition from 15V (the 'on' state) to 0V (the 'off' state). This leisurely turn-off may be acceptable for light loads but it is not ideal behavior for MOSFETs switching large currents.

Figure 4 A leisurely turn-off might be acceptable for light loads.

An improved version of the circuit is shown in Figure 5, where the Darlington has been replaced by a dual, open-drain/open-collector comparator (IC1), and R5 has been replaced by potential divider R4-R5. The R6-R7 divider generates a reference voltage, Vref, (a constant fraction of the comparator's supply voltage, Vcs), which provides a stable reference for both comparators.

Figure 5 The improved circuit provides accurate timing, fast switching, and immunity to supply voltage changes.

When the push switch is first pressed, Q2 turns on, energizing the load and also forward biasing D1, which provides the supply voltage, Vcs, for the comparators. Now, if R4/R5 = R6/R7, the voltage Vx will be slightly greater than Vref causing IC1a's output transistor to turn on. Its output goes low (close to 0V) thereby providing gate bias for Q2 via R3.

The circuit is now latched into its 'on' state and timing capacitor C4 begins to charge via R8, and the voltage, Vc, on C4 rises exponentially. At the point where Vc just exceeds Vref, comparator IC1b trips and its output transistor turns on, pulling Vx down to 0V. IC1a's output transistor now turns off and, since Q2 no longer has gate drive, the MOSFET turns off and the switch unlatches. C4 now discharges relatively quickly via the D2-R6-R7 path. As with the simpler circuit, the switch can be unlatched at any time simply by pressing the pushbutton.

Blocking diode D1 provides a dual function. It isolates R2 from the charge stored on C2 when Q2 turns off, thereby ensuring that the switch unlatches properly. Additionally, it prevents C2 (and C4) from discharging rapidly via the load when the switch turns off. This provides a brief time for the comparators to remain powered when Q2 turns off, thus ensuring that the circuit turns off in an orderly fashion. Powering the comparators from the switch output rather than from the supply voltage satisfies the fundamental requirement of all the circuits in this article, namely that (just like a mechanical switch) the power consumption in the 'off' state is zero.

Figure 6 shows the timing equations for the circuit along with the results from a test circuit built with IC1 = TLC393, R4 = R6 = 10kΩ, R5 = R7 = 22kΩ, and +Vs = 15V. Note that Vcs falls out of the equations, so the 'on' time is largely immune to variations in supply voltage.

Figure 6 Here are the timing equations and test results for the circuit in Figure 5.

The measured and theoretical results agree well except for the case where C4 = 100µF, which produces an 'on' time much longer than calculated. This is most likely due to internal leakage within the electrolytic capacitor used for that test (non-electrolytic types were used for the 1µF and 10µF tests). With suitable components, an 'on' time well in excess of an hour could be achieved.

Ignoring the drop across D1, the comparator supply voltage is roughly the same as the DC supply voltage (Vcs ≈ +Vs) which influences the type of comparators that can be used. The TLC393 dual micropower comparators are an ideal choice due to their miniscule power requirements and extremely low input bias current (typically 5pA), though they are limited to a supply voltage of around 16V. The LM393 provides an identical function and can be used with supply voltages as high as 30V. However, the supply current is greater than that of the TLC393, and the input bias current is relatively large (typically −25nA), which can influence C4's charging rate. When choosing values for R4-R7, make sure that Vx and Vref don't exceed the comparators' upper common-mode voltage limit (roughly 1.5V below Vcs for the TLC393 and LM393).

As well as providing fairly precise control over the timed output, the circuit transitions from the 'on' to the 'off' state much more rapidly than the simple circuit of Figure 3. The oscillograph shown in Figure 7 shows the output of the test circuit powered from 15V with the same 500Ω load and FDS6675A MOSFET as used for the simple circuit. Compared with the somewhat sluggish response in Figure 4, switching time is much improved at around 100µs from fully 'on' to fully 'off'.

Figure 7 A modification of the circuit creates a more rapid transition from "on" to "off."

Choosing components
There are no special requirements for the bipolar transistors and diodes used in the preceding circuits. Provided they are rated to the maximum supply voltage, most NPN bipolars with good current gain are suitable. The P-channel MOSFET must be rated like any device used in a high-side driver circuit in terms of maximum drain-source voltage, current handling, and power dissipation. Be aware, though, that certain types of MOSFET have a maximum gate-source voltage limit much lower than the drain-source voltage rating. For example, a device like the IRFR9310 has a maximum drain-source voltage rating of −400V, and yet the gate-source voltage is limited to just ± 20V. If your application requires a very large supply voltage, it may be necessary to fit a protective zener diode between the MOSFET's gate and source in order to clamp the gate voltage to safe levels.

Although a push switch has been used in all the circuits, this could be replaced by, say, a reed relay (to provide a magnetically activated switch) or by some other type of momentary contacts. The only requirement is that the contacts must be electrically 'floating' relative to the supply rails.

Finally, remember that IC1 of Figure 5 must be an open-drain or open-collector type. Also, be aware that the large impedances and sensitive nodes make the circuits susceptible to noise, which can cause false triggering and unpredictable behaviour, so avoid 'messy' construction and shield the circuits from EMI and RFI if necessary.