A transistor is essentially a switch with three connections and they come in many different form factors.
Fig. 2 illustrates the different kinds of transistors that you may come across in simple applications. The notes below expand on some of the terms in the figure.
With BJTs, the three pins are the collecgtor (C), the emitter (E) and the base (B). BJTs rely on layered electrical conductors where adjacent layers have slightly modified electronic characteristics. Some layers will have a bias towards negative charge, and others will be biased towards positive charge. They are referred to a N and P layers. There are two possible orderings of three layers, P-N-P and N-P-N. In both types, it is the presence or absence of a high signal on the base that determines whether or not current flows between the collector and the emitter. The precise behaviour of the two types of BJT is shown in the table below where the right-hand column shows the state of the base which allows current to flow.
BJTs can be damaged by applications such as motor control or heating where the power requirement is high. On the other hand, a MOSFET is designed to handle higher currents and voltages. The essential difference in construction is that the control signal is electrically isolated from the current flowing between the other two connectors. This allows you to control large voltages with the small ones produced by a microprocessor. Because of the difference in construction, the pins on a MOSFET have different names from those on a BJT. They are the source (S), the drain (D) and the gate (G), where the gate has the same function as the base in a BJT.
Like BJTs there are two types of MOSFET, N-channel and P-channel devices that bear some similarity to the PNP/NPN BJTs. These differences are summarised in the table below.
Fig. 3 shows the pin arrangement on a typical N-channel MOSFET. As with all components, you should check the datasheet for the device you are using to make sure that it follows the same pattern.
The circuit shown in Fig. 4 illustrates an application where the microprocessor is controlling the power to a heating pad. The heating pad itself is basically a resistor - all it needs is a voltage across its terminals. The power for the heating pad is supplied by an external source which in this case is shown as a 5V supply from a USB connection. When the microprocessor Raises a high signal on the control pin connected to the MOSFET's gate, the 5V current will flow between the source and the drain powering the heating pad. Lowering the signal to the gate with switch the current flow off.
Things to note
The voltage on the top power rail is 5V from the USB source
The voltage on the lower rail is 3.3V from the microprocessor (Particle Argon)
The power supply on the lower rail is not used in this example
The ground rail on one side is connected to the ground rail on the other side
Please check the general circuit notes for an explanation of the concept of a common ground.