In this lab you will make some real circuits using resistors, transistors, switches, and LED’s.
It is important that you follow lab directions carefully. If you don’t, you may create short circuits which could make components hot enough to burn your fingers. The smell of burning plastic has permeated the air in previous CSCI 255 labs.
You should also be careful about cutting wires. When making the cut, be sure the part of the wire that you aren’t holding is pointing toward the table and not toward anyone’s eyes. We’d actually prefer that, when appropriate, you just use the cut pieces of wire left over from previous years. There’s a lot to choose from.
Task 0 — Parts and partners
You’ll need to work in groups of two this week. And, you’ll need the following parts.
- 1 multimeter
- 1 breadboard
- 1 battery holder for 4 AA batteries
- 4 AA batteries
- 2 10 kΩ resistors
- 2 330 Ω resistor
- 1 3.3 V regulator
- 1 27 Ω resetable thermal fuse
- 1 push-button switch
- 2 LED’s
- 1 10 µF capacitor
- 1 1 µF capacitor
- 1 PNP transistor (PN 3906)
- 1 NPN transistor (PN 3904)
- single-stranded wire as needed
Task 1 — The breadboard
You’ll build your circuit on a
which has contact points where you’ll
insert wires and components.
Here’s a couple of breadboards built for a paper published about
Notice that these breadboards are pretty neatly laid out. The wires are not too long and are not tangled. Color is used encode important information: black wires are tied to ground; and white wires, to the high voltage. Components can be easily removed because they are not enclosed by wires.
Most breadboards contains long columns of points, usually next to blue or red lines, along their edges. These columns are called bus strips. The points within a bus strip are connected internally by metal, though breaks within the columns usually indicate breaks of conductivity.
The breadboard also contains rows of ten points separated by a notch. These are terminal strips. The notch divides each terminal strip into two five-point sections. The five points of each section are all connected, but the two sections are disjoint.
The connections of a typical breadboard are illustrated below:
On almost all breadboards, the rows are labeled with letters and the columns with numbers. This makes it possible to refer to a contact point by a letter-number combination such as B-17.
Using a multimeter and two small sections of wire, plug the wire into various contact points and see how the points are connected.
If you’ve never used a multimeter, you may want to read a multimeter tutorial.
If you are a breadboard or multimeter expert, help out someone else.
Task 2 — The voltage regulator: 0’s and 1’s
In circuits, 0’s and 1’s are implemented at different voltage level. Generally, 0 will be 0 V (0 volts) or ground; however, different circuits, or even parts of a circuit, may use different voltage levels for 1. Voltage levels have been steadily decreasing over the last few years from 5 V to 3.3 V to 2.8 V to 1.8 V. The voltage level inside recent chips has gotten as low as 1.2 V. Lower voltage results in circuits that use less power, generate less heat, and run faster; so there’s good reason to turn down the voltage.
Circuits, particularly at these low voltage levels, need a stable voltage source. This is provided by a voltage regulator.
The circuits you build in this lab and future labs will need a stable power supply. Follow the steps outlined below to construct a 3.3 V power supply on your breadboard.
- Use your multimeter to identify 4 “good” (close to 1.5 V) AA batteries from the “lightly-used” battery box and place them in your battery holder.
Construct the power supply depicted below on your breadboard.
Use black wires to connect directly to ground and red wires to connect to 3.3 V.The symbol for a capacitor is . You may need to use a polarized capacitor. One leg of the polarized capacitor will be directly below a black stripe with a minus sign (-). Place this leg into the ground bus strip.
Connect the empty battery holder to your bread board.
- The 6 V input is the red lead of the battery holder.
- The ground symbol equates to the black lead of the battery pack.
Complete your power supply circuit by adding a “power-on light” and connecting both “+” bus strips to the output of the regulator, and both “-“ rails to ground. Be sure that your power light is on.
- The symbol for a LED is . The legs of a LED are of unequal length. The long leg must be orientated to the more positive (higher voltage) end of the circuit.
- Never connect a LED directly to a power supply, always protect it with a current limiting resistor as shown above.
Insert batteries into the holder. Use the multimeter to verify that you have 3.3 V on the output leg of the regulator.
LED is an abbreviation for light emitting diode. A diode will only conduct electricity in one direction. That’s why it was important the that long leg, or anode, of the LED be connected to a higher voltage than the short leg, or cathode.
LED’s also have a forward voltage, a fixed voltage that cannot be exceeded when they are conducting. The forward voltage varies between LED’s. When it is exceeded, you effectively have a short circuit until the LED burns out. The current limiting resistor prevents the short circuit. The internet is full of web pages you can use to calculate the appropriate current limiting resistor for your LED.
Have at least one other group verify that your power supply and then show it to a lab instructor.
Pay careful attention — A word about power
You really need to read this section!
The volage regulator part of our circuit (everything thing except the resistor and LED in the above drawing) takes a lot of room in our drawing. So, we are going to replace it with two symbols. One, labeled 3.3V, will be the output of the voltage regulator. The other will be the just the ground symbol.
We suggest you set up your breadboard right now so that 3.3v is running
on the red bus lines and 0v (ground) is connected to the blue bus lines.
This means that a circuit like the LED and resistor, with voltage regulator,
above would not be written simply
as shown below.
Make sure you have 3.3v is on the red bus and 0v is on the blue bus.
Task 3 — A simple switch
Now let’s do something with all this power.
We’ll begin by building a simple circuit using a switch to control a LED. Create the circuit depicted below on your breadboard using a push-button switch.
You should use your multimeter to determine which legs of the switch are connected when the switch is pushed.
This diagram should help.
Verify that the LED turns on when the switch is activated.
Use your multimeter to measure the voltage drop across both the LED and resistor when the switch is either open or closed. This is four measurements. You’ll need at least three hands to do this.
Then show your switched circuit and your measurements to a lab instructor.
Task 4 — A Transistor as a switch
Transistors are the building blocks of digital electronic systems. Transistors can be used to build logic gates, and logic gates can be used to build computers. In this lab, we will use a transistor to replace the push-button switch.
But first let’s learn a little bit about transistors.
A little transistor information
A bipolar junction transistors has three external connections: a base, a collector, and an emitter. The design of a transistor allows it to function as an amplifier or a switch. A little bit of current flowing into the base can control a much larger flow of current between the emitter and collector. This is similar to your kitchen sink where the faucet (think “base”) controls the flow of water.
In digital circuits a transistor always acts as a switch, just like the push-button switch above. In this case a voltage threshold is crossed to open and close the switch.
We will be using two types of transistors, NPN and PNP, in this lab. The NPN transistor is the 2N3904, and the PNP is the 2N3906. Take a quick look at the datasheets for both the 2N2904 and the 2N3906.
Datasheets are full of information.
No one completely reads them, but they do have nice
pictures to show what the wires coming out of a component do.
Our transistors are in
TO-92 cases, so
the three connectors, base, collector, and emitter,
are arranged as shown in the datasheet.
NPN and PNP transistors have different arrangements of the P-type (positively charged) and N-type (negatively charged) semiconductor materials that form the transistors. In the NPN type, a little bit of P type is placed between two little bits of N type. It’s the other way around for the PNP.
On schematics, these transistors are written in a more stylistic fashion.
However, you have to be careful! It’s a little weird that the
positions of the collector and emitter are reversed in the two
diagrams. Sometimes, this inconsistency is solved by flipping the
PNP, as shown below. (Provide your own Portuguese translation.)
To understand a little more about NPN and PNP transistors without plowing through pages of textbooks, try out some of Paul Falstad’s excellent Java Applet animations.
Start by opening the NPN animation an another browser tab. Note the following about the NPN:
- The collector should be at a higher voltage than the emitter. This is why the emitter is fixed at 0 V (ground) and the collector voltage cannot be decreased below 0 V.
- The transistor “turns off” as you lower the base voltage.
Now try out the PNP. In this case:
- The emitter should be at a higher voltage than the collector. This is why the emitter is fixed at 2 V and the collector voltage cannot be increased above 2 V.
- The transistor “turns off” as you raise the base voltage.
Like LED’s, transistors have preferred orientations and voltage limitations which must be followed. Because of these properties, we need to place resistors on the collector and base connectors of the NPN transistor. Transistors 101 offers a good explanation of these properties along with some justification for these rules.
Before making the transistor-switched LED, you must make a switch.
Here’s a simple picture of a simple switch.
When the switch is open, the output is connected to the high voltage, or 1,
through a 10 kΩ resistor.
When the switch is closed, the output is now connected to both the high
voltage and ground. However, since the connection to ground doesn t
go through a resistor, the effective output of the circuit in 0 V,
This is called a pull-up switch, because the output is pulled up
to 1 when the switch is open.
Go ahead and make this switch on your breadboard.
Back to the lab
Now that you’re familiar with transistors, let’s use one. The NPN transistor should be inserted where your push-button switch was previously located. The emitter of your transistor should be connected directly to ground. The collector should be connected to the LED. The base should be connected though a 10 kΩ resistor to the output of the pull-up switch you just made.
Your new circuit should follow the schematic shown below.
When you press the switch, the output of the pull-up is set to 0. When the transistor receives 0, it does not conduct. When the transistor does not conduct, the LED is off. Make sure that the LED turns off when you activate your push-button switch.
This time use your multimeter to measure the voltage at the emitter and base of the transistor. Don’t try to connect the leads of the transistor directly. Instead touch the leads of the resistor or LED that connect to the transistor through the breadboard.
Show your transistorized circuit and associated measurements to your instructor.
Perhaps you are wondering what is the point of this exercise. Why add the transistor when we are already able to turn on the LED? There are two reasons. First, using a transistor allows any digital circuit to turn on a transistor. Second, using a transistor allows a device that uses significantly more current than an LED, such as a motor, to be turned on and off.
Task 4 — A PNP Switch
Revise the circuit above to use PNP transistor as opposed to a NPN transistor. Remember the rules for using PNP transistors provided above.
Show your revised circuit to a lab instructor.