A bipolar junction transistor (BJT) can be used in many circuit configurations such as an amplifier, oscillator, filter, rectifier or just used as an on-off switch. If the transistor is biased into the linear region, it will operate as an amplifier or other linear circuit, if biased alternately in the saturation and cut-off regions, then it is being used as a switch, allowing current to flow or not to flow in other parts of the circuit. This lab activity describes the BJT when operated as a switch.
As in all the ALM labs we use the following terminology when referring to the connections to the M1000 connector and configuring the hardware. The green shaded rectangles indicate connections to the M1000 analog I/O connector. The analog I/O channel pins are referred to as CA and CB. When configured to force voltage / measure current -V is added as in CA-V or when configured to force current / measure voltage -I is added as in CA-I. When a channel is configured in the high impedance mode to only measure voltage -H is added as CA-H.
Scope traces are similarly referred to by channel and voltage / current. Such as CA-V , CB-V for the voltage waveforms and CA-I , CB-I for the current waveforms.
Switching circuits are significantly different than linear circuits. They are also easier to understand. Before investigating more complex circuits, we will begin by introducing discrete solid-state switching circuits: those built around BJTs.
A switch consists of a BJT transistor that is alternately driven between the saturation and cutoff regions. A simple version of the switch is shown in figure 1. When the input equals -Vin , the base-emitter junction is reverse biased or off so no current flows in the collector. This is illustrated by the red load line shown in the figure. When the BJT is in cutoff, the circuit (ideally) has the following values:
This state is similar to an open switch.
When the input equals +Vin, the transistor is driven into saturation and the following conditions occur:
This state is similar to a closed switch connecting the bottom of RC to ground.
Figure 1 NPN BJT switch and its load line.
The characteristics for a BJT switch assume that:
These conditions can be assured by designing the circuit so that:
Condition 1 guarantees that the circuit is driven into the cutoff region by the input. Conditions 2 and 3 assure that the transistor will be driven into the saturation region. An actual BJT switch differs from the ideal switch in several aspects. In practice, even in cutoff there is some small leakage current through the transistor. Also, in saturation, there is always some voltage dropped across the transistor's internal resistance. Typically, this will be between 0.2 and 0.4 V in saturation depending on the collector current and size of the device. These variations from the ideal are generally minor with a properly sized device, so we can assume near ideal conditions when analyzing or designing a BJT switch circuit.
ADALM1000 Hardware module
1 - 6.8KΩ Resistor (RB)
1 - 100Ω Resistor (RC)
1 - 5mm LED (any color)
1 - small signal NPN transistor (2N3904)
One common application for a BJT (or any other) switch is to drive an LED. An LED driver is shown in figure 2. The driver shown in this figure is used to couple a low current part of the circuit to a relatively high current device (the LED). When the output from the low current circuit is low (0 V), the transistor is in cutoff and the LED is off. When the output from the low current circuit goes high (+3 V), the transistor is driven into saturation and the LED lights. The driver is used because the low-current part of the circuit may not have the current capability to supply the 20 mA (typical) required to light the LED to full brightness.
Build the LED switch circuit shown in figure 2 on your solder-less breadboard. RC serves to limit the current that flows in the LED from the +5 V power supply. The switch is controlled by the channel A voltage output from the I/O connector. Scope channel B will display the voltage across the switch transistor Q1 (VCE) or the voltage at the LED as indicated by the green arrows.
Figure 2, NPN LED switch
The CA generator should be configured for a 100 Hz square wave with a 3 volt Max and 0 volt Min. Scope channel B is connected to measure the voltage across the transistor or the at the top of the LED. The current flowing through the transistor can be calculated as the voltage difference between the +5 V supply and CB-V divided by the resistor value (100Ω). The Channel A current trace measures the current in RB.
Save the voltage trace across the transistor collector-emitter ( channel B dashed green line ) and at the LED ( channel B solid green line ) and include them in your lab write-up.
How much current is flowing in resistors RC and RB when the LED is on and when the LED is off?
Calculate the ß when Q1 is saturated. How does this value compare to the spec listed in the datasheet?
Two NPN transistors can be connected with their collectors and emitters in parallel, figure3, which provides a way to switch on the load from two different signals. Either input can turn on the load but both need to be off for the load to be off. This is referred to as an “OR” logic function.
Figure 3, Two Switches in parallel
Modify the circuit on your breadboard to look like figure 3. Add a second NPN transistor, Q2, and second base resistor, RB2, as shown. Now connect the other ends of RB1 and RB2 to the digital I/O port pins PIO 0 and PIO 1 respectively. Open the digital control window and set PIO 0 and PIO 1 to all four combinations of logic 0 and 1. Note which combinations turn on the LED. The voltage on the LED and collector resistor can be monitored with the CHB scope input as before.
Two NPN transistors can be connected in series with the collector of the lower transistor connected to the emitter of the upper transistor, figure 4, which provides a way to switch off the load from two different signals. Either input can turn off the load but both need to be on for the load to be on. This is referred to as an “AND” logic function.
Figure 4, Two Switches in series
Modify the circuit on your breadboard to look like figure 4. Now the second NPN transistor is in series with the emitter of Q1. Again the other ends of RB1 and RB2 are connected to the digital I/O port pins PIO 0 and PIO 1 respectively. Again, set PIO 0 and PIO 1 to all four combinations of logic 0 and 1. Note which combinations turn on the LED. The voltage on the LED and collector resistor can be monitored with the CHB scope input as before. You should also measure the voltage at the connection between the emitter of Q1 and the collector of Q2 for each of the four conditions. Comment on the voltages seen at the collector of Q2 in your lab report and why.
The single transistor inverter stage along with multiple input resistors can be combined to create more complex logic functions. The configuration shown in figure 5 realizes a two input exclusive NOR (XNOR) logic function. You will need a total of 5 NPN transistors, 13 resistors and one LED.
The resistors used as inputs at the bases of the 5 NPN transistors are not all the same value and they in theory should all be the same value. But a range of values will still work given the relatively high beta of the 2N3904 transistors and the values shown were chosen so as to not need more than the 5 of any one value supplied in the Analog Parts Kit. You can experiment with other resistor values to find what the range of minimum and maximum values is.
Figure 5, Resistor and NPN transistor XNOR gate.
Again, set PIO 0 and PIO 1 to all four combinations of logic 0 and 1. Note which combinations turn on the LED. The voltage at the LED and Q5 collector resistor can be monitored with the CH-B scope input as before. You can also use the CH-B ( and / or CH-A ) input to monitor the voltages at the collectors of Q1 – Q4 as you change PIO 0 and 1.
For Further Reading: