Suppose you want to build a temperature control system for your room. You want a fan to turn on if the temperature exceeds 78°F and to turn off when the temperature drops below 75°F. (You use different temperature thresholds to prevent the fan from oscillating between on and off.) You plan to use the following hardware:

There are a couple of problems when you connect the components directly.

The TMP36 output voltage range does not match well with Arduino input voltage range. According to the TMP36 datasheet, it operates at temperatures between -40°C and 125°C (i.e. -40°F to 257°F), and within this temperature range, it outputs a voltage between 0 and 2 V. That means that at room temperatures the TMP36 output lies between about 0.7 and 0.9 V, which leads to a significant mismatch with the Arduino input voltage range of 0 to 5 V.

The Arduino does not output enough current to start the motor. An Arduino pin can supply a maximum current of 40 mA, but a DC motor driving fan blades draws current on the order of 1 A.

Fortunately, you can solve both problems using BJTs in the common emitter configuration. In the first case, you use a common emitter amplifier to scale up the TMP36 output so that it better matches the Arduino input range. In the second case, you let the Arduino output voltage toggle a common emitter switch that controls a large current flowing through the motor.

The input-output characteristic of this circuit is the output $V_{\text{out}}$ plotted as a function of the input $V_{\text{in}}$. We trace the plot by varying $V_{\text{in}}$ and determining the corresponding values of $V_{\text{out}}$ following the common emitter circuit analysis.

Figure 4

Fig. 4: Amplifier input-output characteristic. $V_{\text{out}}$ is constant at $V_{CC}$ in the OFF mode, linearly decreasing in the ACTIVE mode and constant at $V_{CE,\text{sat}}$ in the SATURATED mode. The transition from OFF to ACTIVE happens at $V_{\text{in}}=V_{BE,\text{on}}$ and the transition from ACTIVE to SATURATED happens at $V_{\text{in}}=V^*_{\text{in}}$, derived as $\eqref{CEA-VIN}$ below.

Notice that in the ACTIVE mode a change in $V_{\text{in}}$ leads to a change in $V_{\text{out}}$. In the common emitter circuit, the change is typically magnified from input to output, making it an amplifier. But notice also that a change in $V_{\text{in}}$ causes $V_{\text{out}}$ to change in the opposite direction, so we call this circuit an inverting amplifier. The ratio of the change in $V_{\text{out}}$ to the change in $V_{\text{in}}$ is called the gain $G$, a negative number for an inverting amplifier. The magnitude of $G$ indicates how much the input is stretched into the output and the sign of $G$ indicates whether the stretching is in the same direction or the opposite direction. In fact, the gain is the slope of the ACTIVE mode line segment:
\begin{align}
G&= \frac{V_{CE,\text{sat}}-V_{CC}}{V^*_{\text{in}}-V_{BE,\text{on}}} \label{CEA-GA1}
\end{align}
The constant output voltages $V_{CC}$ in OFF mode and $V_{CE,\text{sat}}$ in SATURATED mode are explained by the behavior of $V_{CE}$ in those modes. The transition input voltage $V_{BE,\text{on}}$ between OFF and ACTIVE is the boundary between the conditions on $V_{\text{in}}$ in those modes.

At the transition input voltage between ACTIVE and SATURATED, the BJT obeys the behavior of both of these modes. In particular, we follow these steps to derive $V^*_{\text{in}}$:
\begin{aligned}
I_C&=I_{C,\text{sat}}=\frac{V_{CC}-V_{CE,\text{sat}}}{R_2}& &\text{SATURATED mode }I_C\text{ formula} \\
I_B&=\frac{I_C}{\beta}& &\text{from ACTIVE mode }I_C\text{ formula} \\
V^*_{\text{in}}&=V_{\text{in}}=V_{BE,\text{on}}+I_B R_1& &\text{from ACTIVE mode }I_B\text{ formula}
\end{aligned}
The overall expression is:
\begin{align}
V^*_{\text{in}}&= V_{BE,\text{on}}+\frac{R_1}{\beta R_2}(V_{CC}-V_{CE,\text{sat}}), \label{CEA-VIN}
\end{align}
where $V_{CC}$, $R_1$ and $R_2$ are known circuit constants and $\beta$, $V_{BE,\text{on}}$ and $V_{CE,\text{sat}}$ are known BJT parameters. Substituting equation $\eqref{CEA-VIN}$ into equation $\eqref{CEA-GA1}$, gives another formula for the gain of the common emitter amplifier:
\begin{align}
G&= -\frac{\beta R_2}{R_1} \label{CEA-GA2}
\end{align}
We now see what happens when $V_{\text{in}}$ is a voltage waveform.

Figure 5

Fig. 5: Voltage signal amplification. If $V_{\text{in}}$ is a signal between $V_{BE,\text{on}}$ and $V^*_{\text{in}}$, then $V_{\text{out}}$ is an amplified and inverted copy that exists between $V_{CC}$ and $V_{CE,\text{sat}}$.

Figure 6

Fig. 6: Voltage signal amplification with clipping. If $V_{\text{in}}$ is a signal that goes below $V_{BE,\text{on}}$ and above $V^*_{\text{in}}$, then $V_{\text{out}}$ is an amplified and inverted copy that is clipped at $V_{CC}$ above and $V_{CE,\text{sat}}$ below.

A common emitter switch for an actuator (such as a DC motor) receives a voltage signal at an input port and controls an output current through the actuator.

Figure 7

Fig. 7: Common emitter switch circuit. This switch circuit is the same as the common emitter circuit, except that the resistor $R_2$ is replaced by a DC motor (with modeled internal resistance $R_2$) and the input voltage source is replaced with an input voltage port $V_{\text{in}}$. The output current $I_{\text{out}}$ flows through the motor into the collector, so $I_{\text{out}}=I_C$. Since the internal resistance of the motor is $R_2$, the common emitter formulas apply to this circuit too.

Because the output is a current, the input-output characteristic is $I_{\text{out}}$ as a function of $V_{\text{in}}$. Similar to the case of the common emitter amplifier, we trace the plot by varying $V_{\text{in}}$ and determining the corresponding values of $I_{\text{out}}$ following the common emitter circuit analysis.

Figure 8

Fig. 8: Switch input-output characteristic. $I_{\text{out}}$ is zero in the OFF mode, linearly increasing in the ACTIVE mode and constant at $I_{C,\text{sat}}$ in the SATURATED mode. The transition from OFF to ACTIVE happens at $V_{\text{in}}=V_{BE,\text{on}}$ and the transition from ACTIVE to SATURATED happens at $V_{\text{in}}=V^*_{\text{in}}$, derived as $\eqref{CEA-VIN}$ above. Note that the vertical axis is $I_{\text{out}}$, unlike in Fig. 4.

Notice that if $V_{\text{in}}$ toggles between values $V_{\text{in}} < V_{BE,\text{on}}$ and $V_{\text{in}} > V^*_{\text{in}}$, then the BJT toggles between the OFF and SATURATED modes, and $I_{\text{out}}$ toggles between 0 and $I_{C,\text{sat}}$, respectively. As long as $I_{C,\text{sat}}$ is designed to be large enough to start the motor, the input voltage signal (itself supported by a small current) can switch the motor on and off.