A Bipolar Junction Transistor (BJT) is a three-terminal semiconductor device that uses a small input current at its base to control and amplify a much larger current flowing between its collector and emitter. In a real circuit, it changes a weak, low-power signal—like a 5mA output from a microcontroller—into a heavy-duty power driver capable of switching 500mA loads like relays, solenoids, or high-brightness LEDs. Beginners commonly confuse it with the MOSFET; while both act as three-terminal electronic switches, a MOSFET is voltage-controlled (requiring almost zero steady-state gate current), whereas a BJT is strictly current-controlled and requires continuous base current to remain turned on.

The Core Mechanism: Current Control, Not Voltage

When you ask "what is a BJT" at the silicon level, you are looking at two back-to-back PN junctions. The most common variant in DIY and industrial control is the NPN transistor (like the ubiquitous 2N3904 or 2N2222). It consists of a Collector (C), Base (B), and Emitter (E).

To understand how an NPN BJT operates, use this single analogy: Think of the BJT as a heavy spring-loaded water valve. The main water pressure (collector-to-emitter voltage) is held back by a stiff spring. You have to continuously push the physical lever (base current) to keep the valve open against the spring's force. If you stop pushing (remove base current), the spring instantly snaps the valve shut. Unlike a ball valve that stays in position once turned, a BJT requires continuous physical effort (current) to stay open.

The ratio of the collector current ($I_C$) to the base current ($I_B$) is called the DC current gain, noted as $h_{FE}$ or $\beta$ on datasheets. If a transistor has an $h_{FE}$ of 100, and you feed 1mA into the base, it will attempt to pull 100mA through the collector. However, to use a BJT as a reliable switch rather than an amplifier, you must drive it into saturation. In saturation, you deliberately overdrive the base so the collector-emitter voltage drop ($V_{CE(sat)}$) falls to near zero (typically 0.2V), minimizing heat dissipation.

Worked Numeric Example: Sizing the Base Resistor

Let's look at a standard bench scenario: You need to switch a 12V automotive-style relay coil that draws 80mA. You are driving it from a 5V Arduino Nano GPIO pin using a standard 2N2222 NPN BJT.

Target: Force the 2N2222 into hard saturation to switch 80mA ($I_C$) using a 5V logic signal.
  1. Identify the required collector current ($I_C$): The relay draws 80mA.
  2. Calculate the required base current ($I_B$): While the 2N2222 datasheet might show an $h_{FE}$ of 100 at this current, relying on minimum gain is a trap. To guarantee saturation, engineers use a "forced beta" rule of thumb, dividing the collector current by 10.
    $I_B = 80mA / 10 = 8mA$.
  3. Account for the Base-Emitter voltage drop ($V_{BE}$): A silicon BJT always drops about 0.7V across the base-emitter junction when turned on.
  4. Calculate the base resistor ($R_B$): Using Ohm's Law on the base circuit:
    $R_B = (V_{GPIO} - V_{BE}) / I_B$
    $R_B = (5V - 0.7V) / 0.008A$
    $R_B = 4.3V / 0.008A = 537.5\Omega$
  5. Select the standard E12 resistor value: Always round down to ensure you provide at least the calculated base current. Choose a 470 $\Omega$ resistor.

With a 470 $\Omega$ resistor, your actual base current will be roughly 9.1mA, safely overdriving the base and ensuring the transistor acts as a closed switch with minimal heat generation.

Where You Meet This in Practice

While MOSFETs dominate high-power switching, BJTs remain irreplaceable in several specific domains:

  • Linear Voltage Regulators: The internal pass elements of classic linear regulators (like the LM317) rely on BJT topology because they operate in the active (linear) region, not as on/off switches.
  • Audio Amplifiers: Class AB push-pull output stages in audio gear heavily favor BJTs for their superior linearity and lack of gate-charge switching artifacts at high frequencies.
  • Darlington Pairs: When you need massive current gain from a tiny signal, two BJTs are wired together (like inside a TIP120 transistor) to multiply their $h_{FE}$ values, yielding gains of 1,000 or more.
  • Current Mirrors: In analog IC design, matched BJTs are used to copy exact current levels from one branch of a circuit to another, a feat that is much harder to achieve precisely with MOSFETs.

Bench Scenario Walkthrough: The Melted 2N3904

Theory is clean; the workbench is not. Here is a real-world failure that illustrates what happens when you misunderstand BJT saturation.

Safety Note: Always de-energize circuits before probing. A failed shorted transistor can unexpectedly apply full supply voltage to your microcontroller's GPIO pins, destroying the logic board.

The Setup: A hobbyist wants to PWM-control a 12V PC case fan (rated for 100mA running current, 150mA startup inrush) using an ESP32 (3.3V logic) and a 2N3904 NPN transistor. They use a 1k$\Omega$ base resistor.

The Numbers: The 2N3904 datasheet lists a maximum continuous collector current ($I_C$) of 200mA. The fan runs at 100mA. On paper, this looks perfectly safe. The base current is $I_B = (3.3V - 0.7V) / 1000\Omega = 2.6mA$.

The Outcome: Within 30 seconds, the 2N3904 becomes too hot to touch. The fan spins sluggishly. Shortly after, the transistor fails with a sharp pop, shorting the 12V fan line directly to ground and tripping the bench power supply's overcurrent protection.

What Went Wrong: Two distinct errors caused this failure. First, the forced $\beta$ was far too low. The actual ratio of $I_C / I_B$ was $100mA / 2.6mA = 38$. Because the base wasn't overdriven, the transistor never reached saturation; it operated in the active (linear) region. It dropped roughly 4V across its collector-emitter junction. Power dissipation is $P = V_{CE} \times I_C$, meaning it was burning $4V \times 0.1A = 0.4W$. A bare TO-92 package without a heatsink maxes out around 0.5W and will rapidly overheat at 0.4W. Second, the fan's 150mA inrush current during startup pushed the transistor past its 200mA absolute maximum rating, degrading the silicon junction before it even reached running speed.

The Fix: For inductive motor loads on 3.3V logic, swap the BJT for a logic-level MOSFET (like the IRLZ44N) which has near-zero on-resistance and requires no continuous gate current. If a BJT must be used, drop the base resistor to 220 $\Omega$ to force saturation, and always add a 1N4007 flyback diode across the fan terminals to kill inductive voltage spikes.

BJT vs. MOSFET: When to Reach for Which

If you are staring at your component drawer wondering which to grab, use this decision matrix.

Criteria Bipolar Junction Transistor (BJT) Metal-Oxide-Semiconductor FET (MOSFET)
Control Mechanism Current-controlled (requires continuous $I_B$) Voltage-controlled (requires initial gate charge, zero steady current)
On-State Voltage Drop Fixed $V_{CE(sat)}$ (typically 0.2V to 0.5V) Proportional to $R_{DS(on)}$ (can be millivolts at low current)
Drive Circuit Complexity Simple (just a single base resistor) Complex for high power (requires gate drivers to charge gate capacitance fast)
High-Frequency Switching Slower (limited by minority carrier storage time) Faster (limited only by gate capacitance and driver strength)
Best Use Case Low-side switching < 500mA, linear amplification, current mirrors High-power switching, PWM motor control, high-efficiency power supplies

Choose a BJT when: You are switching small loads (< 300mA) from a 5V microcontroller, you need a cheap, simple two-component switch (transistor + resistor), or you are building analog linear circuits.

Choose a MOSFET when: You are switching loads > 500mA, using high-frequency PWM, operating from 3.3V logic (where BJT base drive becomes difficult), or when power efficiency and heat dissipation are critical.

FAQ: Common BJT Wiring Mistakes

Do I absolutely need a resistor between the microcontroller pin and the BJT base?

Yes. A BJT base-emitter junction behaves exactly like a standard silicon diode. If you connect a 5V GPIO pin directly to the base without a current-limiting resistor, the junction will clamp at 0.7V and attempt to draw infinite current. This will instantly destroy the microcontroller's GPIO pin and likely melt the transistor's internal bond wire. Always use a calculated base resistor.

What happens if I accidentally wire the collector and emitter backward?

The transistor will enter "reverse-active mode." Because the internal doping concentrations of the collector and emitter regions are different, the current gain ($h_{FE}$) will plummet to single digits (often less than 5). The circuit likely won't work, the voltage drop across the device will be massive, and if the reverse voltage across the base-emitter junction exceeds its breakdown voltage (typically around 5V to 7V for small-signal BJTs), the transistor will suffer permanent zener breakdown and be destroyed.

Why does my microcontroller reset every time the BJT switches off a relay?

You forgot the flyback diode. Relay coils are inductors. When the BJT switches off, the collapsing magnetic field in the coil generates a massive reverse voltage spike (inductive kickback) that can easily exceed 100V. This spike arcs across the transistor, causes severe electromagnetic interference (EMI), and couples back into your microcontroller's power rails, triggering a brownout reset. Always wire a 1N4148 or 1N4007 diode in reverse-bias across the relay coil to safely recirculate this energy.

Understanding the BJT means respecting its need for continuous base current and managing its saturation limits. For deeper silicon-level physics, the Electronics Tutorials BJT guide provides excellent junction diagrams, and reviewing the ON Semiconductor 2N3904 datasheet is mandatory reading to see how $h_{FE}$ drops off at high currents.