The silicon transistor was invented in 1954 and has been considered one of the greatest inventions in the history of technology. Its invention practically spawned the field of electronics and contributed to all of our modern computers, iPods, phones, etc. If you've ever asked what a transistor is or does, you probably were told that it is like a switch. However, it is a bit more complicated than that.
This Instructable will detail a basic transistor and what it can be used for. I am making this because I have had a box of assorted transistors for a while and never really knew how to use them in circuits. After reading some tutorials online I combined some ideas together and figured out how to use transistors in basic circuits.
I will demonstrate the use of transistors by controlling PC fans from a computer's LPT (parallel) port. Then I will implement a simple form of PWM (pulse-width modulation) to control the fan's speed. This demonstrates the ability of transistors to use low-voltage, low-current signal lines (such as a parallel port or microcontroller IO line) to control higher voltage, higher current devices like motors (in this case, PC fans).
Step 1: How a Transistor Works
In this instructable I will be focusing on NPN transistors. A transistor has three terminals: Base, Emitter, and Collector. The base terminal is connected to the signal voltage, the collector is connected to the load, and the emitter is connected to negative (ground). Whenever the base voltage is zero, the collector voltage is also zero. Applying a small current to the base causes a proportionately larger current to flow through the collector. By doing this, a tiny amount of current from a signal can be used to drive larger currents to power heavier loads such as relays and motors.
Note that the load and the signaling devices must share a common ground. In the case of a fan (running from an external power supply) and a computer's LPT port, you can connect the ground terminal of the power supply to the ground pin on the LPT port to achieve this. For a microcontroller you can use the same ground for the chip and the load.
For my examples I soldered three NPN transistors to a small PCB and wired all of the emitters together to form a common ground. I did this to make connecting things easier. In the following examples I am only using one of the transistors. The other two are not affecting anything and can be disregarded entirely. The transistors are "MPS A06" labeled. According to the datasheet they can control up to 300mA and have a voltage limit at 80V. On my PCB, the brown wires are common ground, blue is collector (load), and white is base (signal).