Set/Reset Flip Flop

This is an example of a set/reset flip flop using discrete components. When power is applied, only one of the transistors will conduct causing the other to remain off. The conducting transistor can be turned off by grounding it's base through the push button which causes the collector voltage to rise and turn on the opposite transistor.


Bistable Flip Flop

Here are two examples of bistable flip flops which can be toggled between states with a single push button. When the button is pressed, the capacitor connected to the base of the conducting transistor will charge to a slightly higher voltage. When the button is released, the same capacitor will discharge back to the previous voltage causing the transistor to turn off. The rising voltage at the collector of the transistor that is turning off causes the opposite transistor to turn on and the circuit remains in a stable state until the next time the button is pressed and released. Note that in the LED circuit, the base current from the conducting transistor flows through the LED that should be off, causing it to illuminate dimly. The base current is around 1 mA and adding a 1K resistor in parallel with the LED will reduce the voltage to about 1 volt which should be low enough to ensure the LED turns completely off.


High Current MOSFET Toggle Switch with Debounced Push Button.

This circuit was adapted from the "Toggle Switch Debounced Pushbutton" by John Lundgren. It is particularly useful in controlling a load from several locations where the load may be switched on from one location and switched off from another. Any number of momentary (N/O) switches or push buttons may be connected in parallel.

The circuit uses a N-channel power MOSFET to control the load and can supply fairly large currents depending on the MOSFET used. The IRFZ44 is a 50 amp device available at Radio Shack for $2.99 and the IRF10 is a 4 amp device available for a dollar less.

The combination (10K, 10uF and diode) on the left side of the schematic insures the circuit powers on with the MOSFET turned off and the NPN transistor conducting. These components can be omitted if the initial power-on condition is not a concern. In this initial state (MOSFET off), the voltage at the gate of the MOSFET will be near zero and the voltage on the 1uF capacitor connected to the switches will also be near zero.

When a switch is closed, the 1uF capacitor is connected to the junction of the 220 ohm and 470K resistors causing the voltage to fall to near zero turning off the NPN transistor. As the transistor turns off, the collector voltage rises and turns on the MOSFET when the voltage climbs above about 3 volts. The drain terminal (D) of the MOSFET now moves close to ground preventing the NPN transistor from turning back on. When the switch is opened, the 1uF cap will charge through the 4.7M and 10K resistors to the full supply voltage. When a switch is again closed, the 1uF capacitor will cause the NPN transistor to turn back on due to the positive voltage on the capacitor applied to the junction of the two resistors (470K, 220). The MOSFET will now turn off and the drain voltage will rise to the supply voltage which in turn keeps the NPN transistor conducting with a positive voltage on the base. The circuit has now returned to the initial turn-on state.

The small (0.1uF) capacitor connected from the transistor base to ground functions to filter out noise that could cause false triggering if the switches are located far away from the circuit using long wires. If false triggering becomes a problem, either the capacitor value (0.1) or the 220 ohm resistor value can be increased to provide better filtering. Increasing these values however will increase the switching times of the MOSFET (rise and fall times) generating more heat when the MOSFET changes state. This is probably not a problem with small loads of a couple amps or less, but may be a problem at higher load currents. The circuit was tested at 1.5 amps using the IRF510 and 6 amps using the IRFZ44.


Single Transistor Relay Toggle Circuit

The circuit below requires a double pole, double throw relay in conjunction with a single transistor to allow toggling the relay with a momentary push button. One set of relay contacts is used to control the load, while the other is used to provide feedback to keep the relay activated or deactivated. Several push buttons can be wired in parallel to allow toggling the relay from different locations.

In the deactivated state, the relay contacts are arranged so the 1000 uF capacitor will charge to about 2.7 volts. When the switch is closed, the capacitor voltage is applied to the transistor base through a 560 resistor causing the transistor to turn on and activate the relay. In the activated state, the relay contacts are arranged so the 3.3K resistor and 560 ohm resistor provide a continous current to the transistor base maintaining the activated state. While in the activated state, the capacitor is allowed to discharge to zero through the 1K resistor. When the switch is again closed, the capacitor will cause the transistor base to move toward ground deactivating the relay.

The circuit has three distinct advantages, it requires only a few parts, always comes up with the relay deactivated, and doesn't need any switch debouncing. However since the capacitor will begin charging as soon as the button is depressed, the button cannot remain depressed too long to avoid re-engaging the relay. This problem can be minimized with an additional resistor connected from the transistor base to ground so that the base voltage is close to 0.7 volts with the button depressed and the transistor is biased in the linear region. With the button held down, the relay coil voltage should be somewhere between the pull in and drop out voltages so that the relay will maintain the last toggled state. This worked out to about 820 ohms for the circuit I built using a 12 volt, 120 ohm relay coil and 2N3053 transistor. Temperature changes will effect the situation but the operation is still greatly improved. I heated the transistor with a hair dryer and found that the relay will re-engage with the button held down for approximately 1 second, but this is not much of a problem under normal operation.


CMOS Toggle Flip Flop Using Push Button

The circuit below uses a CMOS dual D flip flop (CD4013) to toggle a relay or other load with a momentary push button. Several push buttons can be wired in parallel to control the relay from multiple locations.

A high level from the push button is coupled to the set line through a small (0.1uF) capacitor. The high level from the Q output is inverted by the upper transistor and supplies a low reset level to the reset line for about 400 mS, after which time the reset line returns to a high state and resets the flip flop. The lower flip flop section is configured for toggle operation and changes state on the rising edge of the clock line or at the same time as the upper flip flop moves to the set condition. The switch is debounced due to the short duration of the set signal relative to the long duration before the circuit is reset. The Q or Qbar outputs will only supply about 2 mA of current, so a buffer transistor or power MOSFET is needed to drive a relay coil, or lamp, or other load. A 2N3904 or most any small signal NPN transistor can be used for relay coil resistances of 250 ohms or more. A 2N3053 or medium power (500 mA) transistor should be used for coil resistances below 250 ohms. The 47 ohm resistor and 10uF capacitor serve to decouple the circuit from the power supply and filter out any short duration noise signals that may be present. The RC network (.1/47K) at the SET line (pin 8) serves as a power-on reset to ensure the relay is denergized when circuit power is first applied. The reset idea was suggested by Terry Pinnell who used the circuit to control a shed light from multiple locations.


CMOS Toggle Flip Flop Using Laser Pointer

The circuit below is similar to the one above but can be used with a laser pointer to toggle the relay rather than a push button. The IR photo transistor Q1 (Radio Shack 276-145A) or similar is connected to the set input (pin 6). The photo transistor should be shielded from direct light so that the voltage at the set input (pin 6) is less than 1 volt under ambient conditions and moves to more than 10 volts when illuminated by the laser pointer or other light source. The reset time is about a half second using a 4.7uF cap which prevents the circuit from toggling more than once during a half second interval. The 10K resistor and diode provide a faster discharge path for the 4.7uF cap so the circuit can be retoggled in less than 1 second. The 3K resistor in series with the photo transistor may need be adjusted for best performance. The relay shown is a solid state variety to be used with lights or other resistive loads at less than 3 amps. A mechanical relay can also be used as shown in circuit above.


Monostable Flip Flop

The monostable flip flop, sometimes called a 'one shot' is used to produce a single pulse each time it is triggered. It can be used to debounce a mechanical switch so that only one rising and one falling edge occurs for each switch closure, or to produce a delay for timing applications. In the discrete circuit, the left transistor normally conducts while the right side is turned off. Pressing the switch grounds the base of the conducting transistor causing it to turn off which causes the collector voltage to rise. As the collector voltage rises, the capacitor begins to charge through the base of the opposite transistor, causing it to switch on and produce a low state at the output. The low output state holds the left transistor off until the capacitor current falls below what is needed to keep the output stage saturated. When the output side begins to turn off, the rising voltage causes the left transistor to return to it's conducting state which lowers the voltage at it's collector and causes the capacitor to discharge through the 10K resistor (emitter to base). The circuit then remains in a stable state until the next input. The one shot circuit on the right employs two logic inverters which are connected by the timing capacitor. When the switch is closed or the input goes negative, the capacitor will charge through the resistor generating an initial high level at the input to the second inverter which produces a low output state. The low output state is connected back to the input through a diode which maintains a low input after the switch has opened until the voltage falls below 1/2 Vcc at pin 3 at which time the output and input return to a high state. The capacitor then discharges through the resistor (R) and the circuit remains in a stable state until the next input arrives. The 10K resistor in series with the inverter input (pin 3) reduces the discharge current through the input protection diodes. This resistor may not be needed with smaller capacitor values.

Note: These circuits are not re-triggerable and the output duration will be shorter than normal if the circuit is triggered before the timing capacitors have discharged which requires about the same amount of time as the output. For re-triggerable circuits, the 555 timer, or the 74123 (TTL), or the 74HC123 (CMOS) circuits can be used.


555 timer Mono stable (one shot) circuit

The two circuits below illustrate using the 555 timer to close a relay for a predetermined amount of time by pressing a momentary N/O push button. The circuit on the left can be used for long time periods where the push button can be pressed and released before the end of the timing period. For shorter periods, a capacitor can be used to isolate the switch so that only the initial switch closure is seen by the timer input and the switch can remain closed for an unlimited period without effecting the output.

In the idle state, the output at pin 3 will be at ground and the relay deactivated. The trigger input (pin 2) is held high by the 100K resistor and both capacitors are discharged. When the button is closed, the 0.1uF cap will charge through the button and the 100K resistor which causes the voltage at pin 2 to move low for a few milliseconds. The falling voltage at pin 2 triggers the 555 and starts the timing cycle. The output at pin 3 immediately moves up to near the supply voltage (about 10.4 volts for a 12 volt supply) and remains at that level until the 22 uF timing capacitor charges to about 2/3 of the supply voltage (about 1 second as shown). Most 12 volt relays will operate at 10.4 volts, if not, the supply voltage could be raised to 13.5 or so to compensate. The 555 output will supply up to 200mA of current, so the relay could be replaced with a small lamp, doorbell, or other load that requires less than 200mA. When the button is released, the 0.1uF capacitor discharges through the 100K and 2K resistors. The diode across the 100K resistor prevents the voltage at pin 2 from rising above the supply voltage when the cap discharges. The 2K resistor in series with the 22uF cap limits the discharge current from pin 7 of the timer. This resistor may not be necessary, but it's a good idea to limit current when discharging capacitors across switch contacts or transistors.


Generating a Delayed Pulse Using The 555 Timer

The circuit below illustrates generating a single positive pulse which is delayed relative to the trigger input time. The circuit is similar to the one above but employs two stages so that both the pulse width and delay can be controlled. When the button is depressed, the output of the fist stage will move up and remain near the supply voltage until the delay time has elapsed, which in this case is about 1 second. The second 555 stage will not respond to the rising voltage since it requires a negative, falling voltage at pin 2, and so the second stage output remains low and the relay remains de-energized. At the end of the delay time, the output of the first stage returns to a low level, and the falling voltage causes the second stage to begin it's output cycle which is also about 1 second as shown. This same circuit can be built using the dual 555 timer which is a 556, however the pin numbers will be different.


RC Notch Filter (Twin T)

The twin T notch filter can be used block an unwanted frequency or if placed around an op-amp as a bandpass filter. The notch frequency occurs where the capacitive reactance equals the resistance (Xc=R) and if the values are close, the attenuation can be very high and the notch frequency virtually eliminated. The insertion loss of the filter will depend on the load that is connected to the output, so the resistors should be of much lower value than the load for minimal loss. At audio frequencies, the filter could function as a bass and treble boost circuit by attenuating the mid range frequencies. Using 1.5K resistors and 0.1uF capacitors, the band stop at -10dB is about 500 Hz to 2Khz. The depth and width of the response can be adjusted somewhat with the 0.5R value and by adding some resistance across the C values. If the circuit is used around an op-amp as a bandpass filter, the response may need to be dampened to avoid oscillation.