You might have already wondered what can we do if we would like to control devices that require higher voltages or current levels than those that are available from our headers.
For example, you might want to engage a 12 V motor that moves a rig holding your SLR camera for a time lapse movie, or you might want to use a high-power LED that requires much more current than the usual 4-6 mA available in our GPIO pins. And there are plenty of other use cases you might want to consider.
For this kind of application, transistors are ideal. Without going too deep into the theory on how they operate, you can think that transistors can be used as switches of a certain kind that you can operate with a low-power input signal (they are also used as amplifiers, but this is not really in the scope of this book).
Transistors mostly fall into two main types: field effect transistors (FETs) and bipolar junction transistors (BJTs). We will focus on BJTs and their main categories: NPN and PNP. Both...