Using Transistors as Switches
Transistors are very useful little components that can be used in many different ways. We are not going to go very deep into the details how transistors work. We are basically only going to use transistors (NPN) as switches, but keep in mind that it is not the only way to use a transistor.
if you want to learn more details, see these tutorials:
The way my electronics teacher taught how to remember which of the schematic symbols is NPN and which one is PNP:
- NPN = Never Point iN
- PNP = Point iN Please
When you use an NPN transistor as a switch, the load that you want to switch (lights, motor etc.) needs to be between the positive voltage pin and the collector. This is called a low-side switch, since the transistor is on the low (ground) side of the circuit.
Always connect the thing that you want to switch on/off to the collector side with the NPN transistor.
The base turns the switch on or off. In our case the base pin would be often connected to one of the Arduino pins.
We are not going to use PNP transistors in the class, but basically they just work the opposite way to the NPN transistors.
The Parts We Are Actually Using
You have two NPN transistors in your kit:
The PN2222 is a very common general purpose transistor. It is a bipolar junction transistor.
- Able to switch up to 40V
- Max peak current 1A (don’t use these if you continuously need 1 amp)
Just be careful to take note of the pin order.
- Max Voltage: 60V
- Max Current (peak): 8A
- Max Current (constant): 6A
- Please note that these can get really hot if you are trying to switch a lot of current. You might need a heat sink.
- Look into MOSFET transistors if you need to drive lots of current, they are more efficient and don’t heat up so much.
Control Motor Speed With Arduino and Transistor
For a small motor you could use either of the transistors (PN2222 or TIP120). The TIP120 is just going to be able to handle more current.