A BJT (bipolar junction transistor) is a three-terminal semiconductor device — base, collector, and emitter — that uses a small base current to control a larger collector current. Unlike FETs, which are voltage-controlled, BJTs are often described as current-controlled: in the active region, collector current is approximately proportional to base current by the device's DC current gain (hFE or beta), though this relationship varies with VCE, temperature, and operating region and is not a reliable constant in saturation or across all conditions.
In practice
In embedded systems, BJTs appear most often as low-side or high-side switches for driving loads that a microcontroller GPIO cannot source or sink directly — buzzers, relays, small motors, LED arrays, and indicator lamps. An NPN transistor is the most common choice for low-side switching: the emitter ties to ground, the collector drives the load, and a base resistor limits the current from the GPIO pin. In switching applications, the base resistor is typically sized to push the BJT into saturation so the collector-emitter voltage (VCEsat) drops low — often a few hundred millivolts, though the exact value depends on the device, collector current, and forced beta — minimizing power dissipation. The "Byte and Switch" series on EmbeddedRelated covers this switching design in detail.
BJTs are also used to drive transistor-transistor logic (TTL) signals, level-shift between voltage domains, and buffer signals from open-collector or open-drain outputs. Darlington pairs — two BJTs cascaded to multiply current gain — appear in motor drivers and relay boards where very high current gain is needed with a modest base drive. The tradeoff is a higher VCEsat (typically 1 V or more) and slower switching compared to a single BJT.
A key pitfall in switching applications is leaving the BJT in the active region rather than driving it fully into saturation. If the base current is too low for the collector load, the device dissipates significant power as VCE remains high. Conversely, deeply saturating a BJT slows its turn-off time because stored minority carriers must recombine before the device shuts off — a concern above roughly 100 kHz. For higher-frequency switching (PWM motor control, DC-DC converters), MOSFETs are generally preferred. The blog post "Voltage Drops Are Falling on My Head" discusses operating-point selection and the thermal runaway risk that arises when BJT leakage currents increase with temperature, potentially in a self-reinforcing loop.
In analog signal-conditioning circuits on embedded boards, small-signal BJTs (2N3904, BC547, MMBT3904) buffer high-impedance sensors, implement simple current sources, or create reference circuits. In optoisolators, the output stage is commonly a phototransistor — a BJT whose switching is controlled by light-generated current at the base-collector junction rather than an external resistor — though photodiode, photodarlington, and logic-output optocouplers are also widely used. The post "Optimizing Optoisolators, and Other Stories of Making Do With Less" addresses the practical current-transfer-ratio (CTR) constraints that follow from this structure.
Frequently asked
How do I choose the base resistor for a BJT switch driven from a GPIO?
Start from the load current (IC) you need, divide by the device's minimum hFE from the datasheet, and multiply by an overdrive factor of 5 to 10 to ensure hard saturation across temperature and device variation. That gives the required base current IB. Then set RB = (VGPIO - VBE) / IB, where VBE is typically 0.6 to 0.7 V for a silicon BJT at room temperature. The 'Byte and Switch' posts on EmbeddedRelated walk through this calculation with practical examples.
When should I use a BJT instead of a MOSFET for switching?
BJTs are often simpler and cheaper for low-current, low-frequency loads (relays, LEDs, buzzers) driven directly from a 3.3 V or 5 V
GPIO, because no gate-drive charge is required and the base resistor sets everything directly.
MOSFETs become advantageous when switching efficiency matters, load currents exceed a few hundred milliamps, switching frequency is above roughly 20 to 100 kHz, or the available drive voltage is uncertain — situations where the voltage-controlled, low-RDSon nature of MOSFETs wins out.
What is thermal runaway and how does it relate to BJTs?
In a BJT biased in the active region, collector leakage current (ICBO) increases with junction temperature — as a rough rule of thumb it can roughly double for every 10 °C, though the actual rate depends on the device and operating point. More leakage means more power dissipation, which raises temperature further — a positive feedback loop that can destroy the device. In switching applications this risk is low because the BJT spends most of its time fully on (saturated, low VCE) or fully off (near-zero IC). It is a real concern in
linear regulator or audio amplifier topologies where the BJT stays in the active region. The EmbeddedRelated post 'Voltage Drops Are Falling on My Head' covers this in depth.
What is the difference between NPN and PNP BJTs and when is each used?
In an NPN
transistor, conventional current flows into the base and collector and out of the emitter; the device turns on when the base is pulled high relative to the emitter. NPN devices are the natural choice for low-side switching with an emitter tied to ground. In a PNP transistor, current flows into the emitter and out of the base and collector; the device turns on when the base is pulled low relative to the emitter. PNP transistors suit high-side switching where the emitter sits near the supply rail, though a PNP high-side switch driven from a
microcontroller GPIO often requires a level-shifting NPN to pull the PNP base low.
Can I use a BJT to drive an H-bridge for motor control?
Yes, though it is uncommon in newer designs. Early discrete H-bridges used complementary NPN/PNP pairs. The main drawbacks are higher VCEsat losses compared to
MOSFETs, slower switching, and the base-drive complexity needed to prevent shoot-through. The 'Lost Secrets of the H-Bridge' series on EmbeddedRelated discusses gate (and base) drive requirements in detail. For most new motor-control work, integrated MOSFET H-bridges or gate-driver ICs are preferred, but BJT-based bridges still appear in legacy designs and very low-cost applications.
Differentiators vs similar concepts
BJTs are often compared to
MOSFETs. The core distinction is control mechanism: a BJT is current-controlled (IC proportional to IB via hFE in the active region), while a MOSFET is voltage-controlled (drain current set by gate-source voltage with negligible steady-state gate current). BJTs have a predictable VBE of ~0.6 to 0.7 V and do not require charge-pump drive for low-side NPN switches, but they are less efficient at higher currents due to VCEsat and base drive losses. MOSFETs offer lower on-resistance (RDSon) at higher currents, faster switching, and simpler thermal paralleling, but require attention to gate charge and, for high-side P-channel or N-channel bootstrap drive, more complex drive circuitry. JFETs are a third type: depletion-mode, voltage-controlled devices used mostly in analog front ends, rarely seen as switches in embedded designs.