The next step into semiconductors, the transistor. Chances are you have heard of the transistor before. They are one of the more widely used components, a computer has massive amounts of them. So what is a transistor? A transistor is an electrical switch. By using a small amount of power you can control a larger amount of power. There are many types of transistors, but we will focus on the two basic ones, NPN and PNP.
Inside a Transistor
Inside a transistor there are three pieces of silicon. Just like the diode each piece is ether a N-type or P-type silicon. The name of the transistor, NPN and PNP, come from how the silicon is arranged.
NPN vs. PNP
As you can see, NPN and PNP have the same structure, but differently doped silicon. Why does that matter? A NPN transistor is used to sink current, or pull it to ground, while a PNP transistor sources current, or pulls it to VDD (positive voltage). Also a NPN transistor is closed (conducting) when the base has a positive voltage, but a PNP is closed when the base is pulled to ground.
Using the Transistor
A transistor has three pins, base, collector, and emitter. The emitter of a NPN transistor is connected to ground, while in a PNP it is connected to a VDD. To make the transistor conduct electricity, you need to run current from the base pin to the emitter pin. That is why you need to connect the base of a PNP transistor to ground and a NPN to VDD to turn them on.
A resistor should be placed between the base and whatever is driving it. This is because the base will act as a diode and short the signal when the transistor is on! The resistance of the resistor depends on the transistor as well as how much current you need. A transistor requires a certain amount of current to flow from the base to the emitter to become saturated. When a transistor is saturated is will be the best conductor it can be, allowing the most amount of current. Sometimes you do not want that, as the amount of current that flows from the collector to the emitter is related to the amount of current flowing through the base to the emitter, you can use this to amplify a signal, or to limit how much power something receives.
Just like a diode a transistor has a forward voltage of around 0.7V, as it is basically two diodes. See the diode tutorial for more on this.