The humble transistor is the building block of all digital electronics. By creating different configurations of transistors (in relation to other electronic components), you can create circuits which provide the groundwork of binary logic. This is the basis for all modern computing and has helped us do important things like post pictures of cats on the internet, and put astronauts in space.
Transistors also do some interesting things in the analog world as well. They are also responsible for guitar effects pedals and helped David Bowie put everyone in space. Throughout this lesson, we are going to largely be looking at transistors in their simplest analog sense.To demonstrate transistors we will make a Moon Night Light.
For the Moon Night Light you will need:
(x1) TIP31 transistor
(x1) TIP42 transistor
(x1) 1M resistor
(x1) 10K resistor
(x1) Power jack
(x1) White LED strip
(x1) Moon decal
(x1) 8" wooden disc
(x1) 6" letter "O"
(x1) 10' twisted pair fabric cord
(x1) Adhesive-backed Velcro squares
A transistor is an electronic component that takes a small amount of current and amplifies it.
Unlike all of the other components we have looked at where electricity goes in one side and out the other, a more complicated process is at work within the transistor.
A common transistor has three pins which are the base, collector, and emitter. Since transistors come in all different shapes and sizes, and the pins are rarely marked, you will need to look up which pin is which. If you image search for "[INSERT TRANSISTOR NAME] pin diagram" you will quickly find out this information. For instance, let's find out the pin diagram for a 2N2222 transistor by searching for "2N2222 pin diagram." Easy-peasy.
In a schematic a transistor will be represented as an NPN, which has the arrow pointing outwards away from the vertical line, or as a PNP, which has the arrow pointing inwards towards the line.
There are two types of basic transistors in this world - those which are NPN, and those which are PNP.
To better understand the difference between the two, let us revisit diodes for a moment. Like diodes, transistors are made up of configurations of PN junctions.
You could hypothetically say that an NPN transistor is basically 2 diodes back to back. In a theoretical world, you would be right, but in the real world you can't really say that at all. The difference being that not only are the P-regions in a diode considerably bigger, they are also not actually being directly connected. Each P-region is actually being connected to a wire lead, which in turn behaves neither like a P-region or an N-region as far as electrons are considered. This demonstration is more like an NP-WIRE-PN junction. This is clearly not the same at all. However, this idea of a PN bias is important to consider.
Unlike a diode, an NPN transistor has a very thin P-region - no wider than a couple of wavelengths of light - sandwiched between two N-regions. When a current is applied to the P-region (connected to the base pin), it forward biases the base and collector pins, effectively shrinking the depletion zone on both side of the P-region in relation to the current being applied.
This forward bias arrangement between the base and emitter allows electrons to flow from the base pin to the N-region connected to the emitter (like a diode). Presuming that the electrical signal at the collector is also more positive than the one at the emitter, the electrons at the collector are able to take a free ride through the activated P-region to the emitter. Put another way, the current passing from the base to the emitter works like a Trojan Horse to activate the P-region and allow the much larger current hanging out at the collector to pass through the P-region to the emitter.
When a small electrical current is applied at its base pin, it amplifies it such that a much larger current can pass between its collector and emitter pins. The amount of current that passes between the collector and emitter pins is proportional to the current being applied at the base pin.
A PNP transistor on the other hand, works opposite of an NPN transistor. It has two P-regions and a very small N-region in the middle. On account of this it is reverse biased between the base and emitter. Thus, when a current is applied, this reverse bias works like a diode and stops electricity from flowing. It is only when the current begins to be removed from the base that electrons can pass freely between the collector and emitter.
Basically, an NPN transistor allows electricity to flow when a current is applied to its base and stops the flow of electricity when it is removed. It can let varying amounts of electricity pass through in a direct relationship to the current on its base pin.
Notice when the button connected to the base pin is pressed, the LED turns on. This is because the buttons is connecting the base to power. When the button is not pressed, the 10K resistors is connecting it to ground. This type of resistor configuration is called a "pull-down resistor" because it keeps the pin grounded when not in use.
If you were to replace the buttons with a variable resistor, you would be able to vary the brightness of the LED wired to the transistor.
A PNP transistors does the exact opposite of this. When the button is pressed, voltage is applied to the base pin and the LED is turned off. It can also be dimmed using a variable resistor.
The transistors with the highest current rating typically have metal plates in the back connected to the collector pin. It is attached to this pin in particular because the most amount of energy passes through it. These plates dissipate heat and have a hole for attaching the transistor to a heat sink.
A heat sink is a piece of metal (typically aluminum) that has been shaped in such a way to maximize its amount of surface area. Basically, it has a bunch of little fins which allows air to circulate around the part and cool it down. The transistor is bolted to the heat sink to transfer the heat outwards and cool off. This prevents the transistor from overheating and malfunctioning.
Additionally, to maximize heat transfer between the transistor and the heat sink, thermal paste can be used. Apply a thin coat between the transistor and heatsink before bolting them together.
The Moon Night Light is a back-lit moon decal that lights up when it gets dark. The transistor circuit senses the light dimming and turns on
the LED strip in response. This is a great project for anyone who has a
problem seeing in the dark.
If — like some people I know — you are afraid of the moon, you can easily replace the graphic or modify this to suit your mood. Aside from a host of potential graphics — emoji nightlight anyone? — this can easily be turned into a mirror, a cork board, or even a picture frame.
In this circuit we are using two transistors to fade an LED strip on and off. In short, the first transistor responds to changes of light, and triggers the second transistor which responds by turning on and off the LED strip.
By using a two transistor NPN/PNP DC amplifier circuit, we can amplify the input from a photocell to control a relatively high current LED strip. When the base of the NPN gets toggled on via the photocell, the base of the PNP gets toggled off and allows the lights to glow. The default setting for the NPN is to be off when it's light, and on when it's dark. The PNP transistor is obviously the opposite.
This is considered is a two-stage transistor circuit because each transistor connected together is considered a stage. All this basically means is that each adds some level of amplification to the next transistor. In the first stage, there is a voltage divider on the base pin of the NPN transistor consisting of a 1M ohm resistor connected to power and a photocell connected to ground. This divider provides a varied amount of current to the base pin depending on levels of light. As the light goes down, for instance, the resistance of the photocell increases, and in turn more power is able to flow to the transistor's base. This enables more current to flow between the collector and emitter of the NPN.
In the second stage, a PNP transistor has its base pin connected to the collector of the NPN through a 10K resistor. The resistor is just there to provide a little protection and prevent the PNP transistor from being damaged since the first transistor is amplifying the current on the second transistor's base pin. More significantly, the current flowing through the NPN transistor is actually varying the base pin of the PNP based on the light input from the photocell. By using the gain of the first transistor to increase the power to the base of the second, we are able to provide it with more current and get the LED strip to glow more brightly when the lights go out.
To begin, drill a hole slightly slanted towards the outer edge from the top to the bottom of the O. This will be used for hanging the night light on a nail, so the slant will help keep it from falling off.
Opposite the first hole, drill a 5/16" hole from the "bottom" edge of the O inwards. This hole will be used to pass the wire up into the center of the O from the bottom.
Glue the O centered upon the 8" round wooden disc.
The surface of the O that was drilled down into in the previous step should still be facing upwards when you are done gluing them together.
Wrap the LED strip around the edge of the wooden O starting next to the 5/16 hole and continuing all the way around until you reach the other side of the hole.
Look at the LED strip and find the nearest marked cut line to the edge of the hole, and cut the strip in half with a pair of scissors.
Now is time to carefully solder two wires to either edge of the trimmed LED strip.
A red wire should be soldered to power, and black wire soldered to ground.
Twist apart the power jack and wire the white wire from one end of the twisted pair fabric cord to the center pin on the jack, and the black ground wire to the outer terminal on the jack.
When done, twist the protective casing back together with the front of the jack.
Apply the moon vinyl decal over the wooden surface.
Fold the extra bits of moon decal over onto the back.
Drill a 3/16" hole on the front surface of the moon in a location where the hole will end up on the inside of the inner ring of the wooden O in the back.
Peel the adhesive backing off the back of the LED strip and stick it around the edge of the wooden O.
If your LED strip does not have an adhesive backing, you can use a strong double-sided tape, glue, or contact adhesive to connect them together.
Pass the fabric cord and the wires from the LED strip through the 5/16" from the outside in.
On the inside of the frame, fasten the wires together with a zip tie, and then trim away the excess plastic. This zip tie will eliminate strain from the wires and keep them from getting ripped out.
[Now is time to build the circuit board. As a reminder, always go by the schematic and not my pictures. These are more of a loose visual guide of my process than a blueprint.
To begin, I soldered the transistors to the board at a slight angle in order to make sure they would fit between the back of the wooden ring and the wall. However, I was careful not to lay them flat because the metal tab in the back is connected to the collector, and I did not want to risk shorting them together (or to any other part) on any of the solder bus pads.
I then attached the resistors to the board.
To figure out which pin was which, I used the following pin diagram for the TIP31 and TIP42 transistors.
Finally, I connected all of the remaining wiring.
The photocell is going to be wired in separately next.
Attach a 4" stranded ground and a 4" stranded signal wire to the photocell and insulate the connections with shrink tube.
Connect the photocell's ground wire to ground, and the photocell's signal wire to the base pin of the NPN transistor.
Solder the black wire from the power cable to ground bus and the white wire to the power bus on the PCB.
I also wrapped the ends of the fabric cord with tape to keep them from unraveling.
Once the board is complete, the PCB should be mounted flush to the backside of the 8" wooden disc using adhesive back velcro.
The one last thing to do before you hang it and plug it in is to insert the photocell into the 1/4" hole from back to front.
Apply a small dab of glue to hold it in place.
Hang the moon and your wall, and plug it in.
Never be in the dark about transistors again.
Share a photo of your finished project with the class!
Nice work! You've completed the class project