Build a Transistor Toggle (push-on, push-off) Switch on a Breadboard

What is a Push-on, Push-off Switch?

The circuit described in this article is the equivalent of a latching push-button switch. So when you press it once, it is on and press it again, it is off. This electronic equivalent of a latching push-button is accomplished by a two-transistors and a few supporting components. The circuit is depicted in with two options. One that turns on an LED, and another that energizes a relay. With this relay, you could drive a substantial load if desired.

Parts Needed (if you’d like to build this circuit)

  • Minimum breadboarding equipment (see here)
  • (1) General purpose LED (or 12v SPST relay – 350 ohms or greater – RT334012)
  • (1) IN4148 switching diode (if using relay)
  • (1) 1/4 watt resistor kit (see here)
  • (2) 2n3904 general purpose NPN transistors
  • (1) 0.47uF 25v (or greater) electrolytic capacitor
  • (1) Momentary pushbutton switch

Breadboarded Circuits

Below are pictures of both the basic circuit, and the one used to control a relay, along with the schematic references.

Transistor Push-on, Push-off Latching Switch
Transistor Push-on, Push-off Latching Switch

Transistor Push-on, Push-off Latching Switch with Relay
Transistor Push-on, Push-off Latching Switch with Relay

Schematic Diagram

Two Transistor Soft Latch Push-on, Push-off Switch
Two-transistor Push-on, Push-off Switch Circuit
Two-transistor Soft Latching Push-on, Push-off Switch Circuit with Relay
Two-transistor Push-on, Push-off Switch Circuit with Relay

Click here for a our recommended programmable bench power supply.

Circuit Description

The operation of this circuit is straight-forward. It is the transistor equivalent of a two-inverter latching circuit where the states of Q1 and Q2 invert with respect to each other upon each button press. Referring the basic circuit diagram, the circuit operates as follows:

Assume that transistor Q2 is “off” (cutoff state). Thus the load LED1 is turned off. As such, the voltage at the collector of Q2 is (Vcc minus the LED voltage drop), or around 10 volts. This voltage causes enough current to flow through R4 to turn transistor Q1 “on” (saturation state). Since Q1 is “on”, the voltage at its collector will be close to zero volts. Capacitor C1 stores this low voltage value via R1.

When the pushbutton is pressed, the low voltage value on C1 is “pushed” into the base of Q1. This turns Q1 “off”. When Q1 is turned “off” the voltage at its collector rises from approximately zero volts, to 0.7 volts, which is the maximum value that the base to emitter junction of Q2 will allow. This action forward biases that junction, and turns Q2 “on”. The voltage at Q2’s collector now drops to approximately zero volts, which causes current to flow through the load LED1. The circuit has now latched into its “on” state. Since Q1’s collector is 0.7 volts, capacitor C1 charges to this value via R1.

When the pushbutton is again pressed. The 0.7 volts at capacitor C1 is pushed into Q1’s base – switching it on. Once this happens, Q2 is turned off, and the cycle continues.

Circuit Design

Transistors Q1 and Q2 are configured as inverting switches. Each one operates in either saturation or cutoff. The output is a current sink. The expected current through load LED1 is (Vcc-VLed)/R1 or (12-2)/680 or 15mA. If using the relay, the current will be 12V/365 ohms or 33mA. This circuit was tested with a load resistor of as high as 100k, so the current sink range is from 120uA to 33mA. This translates to an output impedance range of approximately 365 – 100,000 ohms. For the maximum current draw case, you’ll want to divide the 33mA by Q2’s beta of about 180, which gives you 183uA. This is the minimum current at Q2’s base that will cause 33mA of collector current to flow. In order to push it completely into saturation, we’ll want to increase that by a factor of 2-10. Using a 15k resistor gives us 800uA, which satisfies that need.

The needed collector current for Q1 saturation depends on the value of R3 (since the collector is close to zero volts and current will no longer flow through the base of Q2). This again gives us Vcc/15k or 800uA. The minimum current into the base of Q1 will thus be 800uA/beta or 800uA/180 = 4.5uA. Resistor R2 keeps Q1’s base low when it is in its off state. So the current through that needs to be accounted for. Since Q1 will be 0.7 volts, the current through R2 is 0.7/470k or 1.5uA. Also, since R4 determines the base current during saturation, we’ll take (Vcc-VLed)/4.5uA plus 1.5uA (IR2) to get that maximum resistor value. Thus (12-2)/.000006)= 1.6M. To force Q1 into saturation when Q2 is low, we’ll reduce that to 330k. This value performed well for the required output current range.

The value of C1 was selected so as to store enough energy to reliably switch Q1 on and off, based on its present voltage state. In addition to that, R1 (along with R3) and capacitor C1 were selected to have a time constant that provides for a minimum push-button time-period and frequency that is well beyond a user’s ability to exceed – which effectively means the user will be able to press the button as fast as they want, while capacitor C1 has enough time to charge up to or discharge down to its needed triggering voltage.

Optional Inverted Output

The base circuit defaults to the “on” state. If you want the circuit to default to the “off” state, you do so in a few ways. One of them is to place an inverting common-emitter stage at the output. The suggested way to do this is shown in the schematic below. The areas inside the dotted boxes are the changes. You would change R5 from 680 to 1k and remove the LED. You would then add the circuitry that is shown in the large box. You would reinsert the LED in this output stage and add R6 (10k), R7 (680), and Q3 (2n3904) as shown.

Modified Circuit with Inverted Output (defaults to “off”)

Click here for a our recommended programmable bench power supply.

Circuit Demonstration

The Youtube video below describes the circuit in detail and demonstrates its operation.

Summary

A push-on, push-off circuit mimics a physical latching pushbutton. It is a really neat way to switch a load. Such a circuit can be advanced to the level of a touch switch, which only requires touching a metal pad. This circuit is the transistor equivalent of two logical inverters configured as a latch. This circuit is copyrighted and may be used for personal use only.

For a better experience building breadboarded circuits, please see our page detailing the minimum recommended lab equipment for your electronics bench. Also, don’t forget to review the recommended safety procedures to follow when building and testing breadboarded circuits.

Finally, for other interesting breadboarded circuits please visit the home page here or our YouTube channel hereSM

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.

We are a participant in the Commission Junction Affiliate Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to affiliated sites.