Transistors
A transistor takes in a small electrical current at its base pin and amplifies it such that a much larger current can pass between its collector and emitter pins. The amount of current that passes between these two pins is proportional to the voltage being applied at the base pin.
There are two basic types of transistors, which are NPN and PNP. These transistors have opposite polarity between collector and emitter. For a very comprehensive intro to transistors check out [page].
NPN transistors allow electricity to pass from the collector pin to the emitter pin. They are represented in a schematic with a line for a base, a diagonal line connecting to the base, and a diagonal arrow pointing away from the base.
PNP transistors allow electricity to pass from the emitter pin to the collector pin. They are represented in a schematic with a line for a base, a diagonal line connecting to the base, and a diagonal arrow pointing towards the base.
Transistors have their part number printed on them and you can look up their datasheets online to learn about their pin layouts and their specific properties. Be sure to take note of the transistor's voltage and current rating as well.
Transistors are powerful little electronic switches, and when our little NPN transistors aren't powered enough for your project, we have been known to use these beefy TIP120 Darlington transistors. Great for whenever you need to control medium to high-power electronics such as motors, solenoids, or 1W+ LEDs.
1void setup ()
2{
3 pinMode(11, OUTPUT);
4}
5
6void loop ()
7{
8 analogWrite(11, 255);
9 delay(2500);
10 analogWrite(11, 0);
11 delay(2500);
12}