A BJT (Bipolar Junction Transistor) is a current-controlled semiconductor device that amplifies signals and switches loads using three terminals: Base, Collector, and Emitter. A small base current (I<sub>B</sub>) controls a much larger collector current (I<sub>C</sub>). This guide covers the operating regions, current gain (β/h<sub>FE</sub>), saturation switching, base resistor calculations, and a working Arduino-driven relay circuit.
Quick Takeaways
- A BJT has four operating regions: cutoff, active, saturation, and reverse-active. Switching uses cutoff and saturation. Amplification uses the active region.
- Current gain follows I<sub>C</sub> = β × I<sub>B</sub>. Typical β for a 2N2222 is 100 to 300, but it drifts with temperature and current.
- For reliable switching, drive the BJT into hard saturation with a forced beta of about 10 (I<sub>B</sub> = I<sub>C</sub> / 10).
- A silicon BJT needs about 0.7V V<sub>BE</sub> to conduct. Always use a base resistor, and a flyback diode on inductive loads.
BJT Quick Comparison: NPN vs. PNP
| Feature | NPN | PNP |
|---|---|---|
| Majority carriers | Electrons | Holes |
| Conducts when | V<sub>B</sub> > V<sub>E</sub> by ~0.7V | V<sub>B</sub> < V<sub>E</sub> by ~0.7V |
| Current direction | Collector → Emitter | Emitter → Collector |
| Typical switch position | Low-side (load to V+) | High-side (load to GND) |
| Common parts | 2N2222, BC547, 2N3904 | 2N2907, BC557, 2N3906 |
| Speed | Faster | Slightly slower |
What Is a BJT? Structure and Symbols
A BJT is built from three doped silicon layers forming two PN junctions:
- NPN: N-type emitter, thin P-type base, N-type collector.
- PNP: P-type emitter, thin N-type base, P-type collector.
The emitter is heavily doped and injects carriers. The base is thin and lightly doped, so most carriers pass through it. The collector is physically larger and collects those carriers while dissipating heat.
In schematics, the arrow on the emitter shows conventional current direction. Arrow pointing out means NPN. Arrow pointing in means PNP. Remember it as “Not Pointing iN” for NPN.
Key Equations
| Parameter | Equation | Notes |
|---|---|---|
| Emitter current | I<sub>E</sub> = I<sub>B</sub> + I<sub>C</sub> | Kirchhoff’s current law |
| Current gain | β = I<sub>C</sub> / I<sub>B</sub> | Also called h<sub>FE</sub> (DC) |
| Alpha | α = I<sub>C</sub> / I<sub>E</sub> | Always slightly below 1 (0.98 to 0.998) |
| Alpha/beta link | β = α / (1 − α) | Useful for datasheet conversion |
| Base-emitter drop | V<sub>BE</sub> ≈ 0.65 to 0.7V | Silicon, at room temperature |
BJT Operating Regions
The region depends on the bias state of the base-emitter (BE) and base-collector (BC) junctions.
| Region | BE Junction | BC Junction | Behavior | Use Case |
|---|---|---|---|---|
| Cutoff | Reverse | Reverse | I<sub>C</sub> ≈ 0, switch OFF | Digital OFF state |
| Active (Forward) | Forward | Reverse | I<sub>C</sub> = β × I<sub>B</sub> | Amplifiers |
| Saturation | Forward | Forward | V<sub>CE(sat)</sub> ≈ 0.1 to 0.3V, switch ON | Digital ON state |
| Reverse-Active | Reverse | Forward | Very low β (~1 to 5) | Rarely used |
Cutoff Region
When V<sub>BE</sub> < 0.6V, no meaningful base current flows. The collector current drops to leakage levels (I<sub>CEO</sub>, typically nanoamps). The transistor behaves like an open switch between collector and emitter.
Active Region
With V<sub>BE</sub> ≈ 0.7V and V<sub>CE</sub> above about 0.3V, the collector current tracks the base current. The BJT acts as a current-controlled current source. This is the region for audio preamps, sensor buffers, and analog signal conditioning.
Saturation Region
Raise the base current high enough and the collector voltage collapses. V<sub>CE(sat)</sub> settles near 0.2V for a 2N2222 at 150mA. The relationship I<sub>C</sub> = β × I<sub>B</sub> no longer holds. The external load, not the transistor, limits collector current. This is the “ON” state for switching.
Current Gain (β / h<sub>FE</sub>) in Practice
Datasheets list h<sub>FE</sub> as a range, not a single number. Design for the minimum value.
| Transistor | Type | I<sub>C(max)</sub> | V<sub>CEO</sub> | h<sub>FE</sub> (typ range) | Package |
|---|---|---|---|---|---|
| 2N3904 | NPN | 200mA | 40V | 100 to 300 | TO-92 |
| 2N2222A | NPN | 600mA | 40V | 100 to 300 | TO-92 / TO-18 |
| BC547 | NPN | 100mA | 45V | 110 to 800 | TO-92 |
| TIP120 (Darlington) | NPN | 5A | 60V | ≥1000 | TO-220 |
| 2N3906 | PNP | 200mA | 40V | 100 to 300 | TO-92 |
Why β Is Not Constant
- Temperature: β rises as junction temperature increases.
- Collector current: β peaks at mid-range I<sub>C</sub> and falls at very low or very high currents.
- Part-to-part variation: Two identical part numbers can differ by 3x.
Never design a circuit that depends on a specific β. Use negative feedback (emitter resistor) for amplifiers and forced beta for switches.
Using a BJT as a Switch
Switching is the most common hobbyist application. Drive the transistor between cutoff (OFF) and saturation (ON).
Base Resistor Calculation
Use the forced beta method. Instead of the datasheet β, assume a conservative value of 10 so the transistor is guaranteed to saturate.
Step 1: Find the load current.
I<sub>C</sub> = V<sub>supply</sub> / R<sub>load</sub> (or from the datasheet for relays and LEDs).
Step 2: Calculate the required base current.
I<sub>B</sub> = I<sub>C</sub> / 10
Step 3: Calculate the base resistor.
R<sub>B</sub> = (V<sub>drive</sub> − V<sub>BE</sub>) / I<sub>B</sub>
Worked Example: Drive a 5V relay coil drawing 70mA from a 3.3V GPIO using a 2N2222.
- I<sub>C</sub> = 70mA
- I<sub>B</sub> = 70mA / 10 = 7mA
- R<sub>B</sub> = (3.3V − 0.7V) / 7mA = 371Ω
- Choose the nearest standard value below: 330Ω
Check the GPIO limit. An ESP32 pin sources roughly 20mA safely, so 7mA is acceptable. An ATmega328P pin tops out at 40mA absolute maximum (20mA recommended), also fine.
Low-Side Switch Circuit (NPN)
+5V
│
┌──┴──┐
│Relay│──┐
│Coil │ ▼ 1N4007 (flyback diode, cathode to +5V)
└──┬──┘──┘
│
C
GPIO ─[330Ω]─ B 2N2222
E
│
GND
Wiring rules:
- Connect the emitter to GND.
- Place the load between +V and the collector.
- Put the base resistor in series with the GPIO pin.
- Add a flyback diode (1N4007 or 1N4148) across any coil or motor, cathode toward the positive rail.
- Tie microcontroller GND and load supply GND together.
Optional Pull-Down Resistor
Add a 10kΩ resistor from base to GND. It holds the transistor OFF while the microcontroller boots and its pins float.
Firmware Example: Arduino Relay Driver
This sketch toggles a relay through a 2N2222 on D7 every two seconds.
// BJT low-side switch test: Arduino Uno + 2N2222 + 5V relay
// Wiring: D7 -> 330 ohm -> Base | Emitter -> GND | Collector -> Relay coil (-)
const uint8_t RELAY_PIN = 7; // Drives the BJT base through a resistor
const unsigned long INTERVAL = 2000; // Toggle period in milliseconds
void setup() {
pinMode(RELAY_PIN, OUTPUT); // GPIO as push-pull output
digitalWrite(RELAY_PIN, LOW); // Start OFF: BJT in cutoff (V_BE = 0V)
}
void loop() {
digitalWrite(RELAY_PIN, HIGH); // ~5V on pin -> I_B ~ (5-0.7)/330 = 13mA -> saturation
delay(INTERVAL);
digitalWrite(RELAY_PIN, LOW); // 0V on pin -> BJT returns to cutoff
delay(INTERVAL);
}
For ESP32 with MicroPython:
from machine import Pin
import time
# GPIO23 drives the BJT base via a 330 ohm resistor (3.3V logic)
bjt_drive = Pin(23, Pin.OUT, value=0) # Initialize LOW: transistor in cutoff
while True:
bjt_drive.value(1) # I_B = (3.3 - 0.7) / 330 = ~7.9mA -> saturation
time.sleep(2)
bjt_drive.value(0) # Cutoff, relay releases
time.sleep(2)
Using a BJT as an Amplifier
In the active region, a common-emitter stage gives voltage gain and phase inversion. The standard biasing method is the voltage divider bias with an emitter degeneration resistor.
Design Targets (Example: 2N3904, 12V Supply)
| Parameter | Target | Component |
|---|---|---|
| Collector current I<sub>C</sub> | 1mA | Set by bias |
| Emitter voltage V<sub>E</sub> | ~1.2V (10% of V<sub>CC</sub>) | R<sub>E</sub> = 1.2kΩ |
| Collector voltage V<sub>C</sub> | ~6V (mid-supply) | R<sub>C</sub> = 5.6kΩ |
| Base voltage V<sub>B</sub> | V<sub>E</sub> + 0.7V = 1.9V | Divider: R1 = 47kΩ, R2 = 8.2kΩ |
| Voltage gain (approx.) | −R<sub>C</sub> / R<sub>E</sub> ≈ −4.7 | Stable against β drift |
The divider current should be about 10x the base current so the base voltage stays stiff. Add a 10µF coupling capacitor at input and output to block DC, and a bypass capacitor across R<sub>E</sub> if you need higher AC gain.
Common BJT Failures and Diagnostics
| Symptom | Likely Cause | Check |
|---|---|---|
| Load always ON | C-E short (overstressed part) | Diode-test C to E with multimeter |
| Load never turns ON | Open base resistor, wrong pinout | Measure V<sub>BE</sub> while driven (should be ~0.7V) |
| Transistor runs hot | Not saturating, linear-region dissipation | Measure V<sub>CE</sub>; should be under 0.3V when ON |
| Random triggering | Floating base | Add 10kΩ pull-down |
| Microcontroller resets when load switches | Inductive spike | Add flyback diode and bulk capacitor |
| Weak output | R<sub>B</sub> too large | Recalculate with forced beta of 10 |
Testing a BJT with a Multimeter
Set the meter to diode mode.
- Place the red probe on the base and the black probe on the emitter. An NPN reads 0.6 to 0.7V.
- Repeat with base to collector. Expect a similar reading.
- Reverse the probes on both junctions. Expect OL (open).
- Probe collector to emitter in both directions. Expect OL.
Any reading outside these results signals a failed junction.
BJT vs. MOSFET: Which Should You Choose?
| Criterion | BJT | MOSFET |
|---|---|---|
| Control method | Current driven | Voltage driven |
| Gate/base drive | Needs continuous I<sub>B</sub> | Near-zero DC gate current |
| ON-state loss | V<sub>CE(sat)</sub> × I<sub>C</sub> | R<sub>DS(on)</sub> × I<sub>D</sub>² |
| High-current efficiency | Moderate | Excellent (milliohm R<sub>DS(on)</sub>) |
| Cost (small signal) | Very low | Low |
| Linear amplification | Excellent, predictable | Good, more variation |
| ESD sensitivity | Robust | Gate easily damaged |
| Best for | Signal switching, analog stages, LEDs, small relays | Motor drivers, power supplies, high-current loads |
Use a BJT for loads under about 500mA and for analog circuits. Choose a logic-level MOSFET (for example IRLZ44N) when current reaches several amps or when you must minimize drive current.
Practical Project: IoT Soil Moisture Pump Controller
Build an ESP32-based controller that waters a plant when the soil is dry.
Bill of Materials
| Qty | Component | Purpose |
|---|---|---|
| 1 | ESP32 DevKit | Controller, 3.3V logic |
| 1 | Capacitive soil moisture sensor | Analog input |
| 1 | 2N2222A NPN BJT | Pump switch |
| 1 | 330Ω resistor | Base current limit |
| 1 | 1N4007 diode | Flyback protection |
| 1 | 5V mini water pump (≤250mA) | Load |
| 1 | 100µF electrolytic capacitor | Supply decoupling |
Wiring
- GPIO34 (ADC1) ← sensor analog output
- GPIO23 → 330Ω → base of 2N2222A
- Emitter → GND
- Collector → pump negative terminal
- Pump positive → 5V
- 1N4007 across the pump (cathode to 5V)
- 100µF across the 5V rail
Firmware
// ESP32 soil moisture pump controller with BJT driver
const int SENSOR_PIN = 34; // ADC1_CH6, input-only pin
const int PUMP_PIN = 23; // Drives 2N2222A base via 330 ohm
const int DRY_THRESHOLD = 2800; // Raw 12-bit ADC value; higher = drier (calibrate!)
const unsigned long PUMP_ON_MS = 5000; // Run pump for 5 seconds
const unsigned long CHECK_MS = 60000; // Re-check every minute
void setup() {
Serial.begin(115200);
pinMode(PUMP_PIN, OUTPUT);
digitalWrite(PUMP_PIN, LOW); // BJT cutoff at boot
analogReadResolution(12); // 0-4095 range
}
void loop() {
int moisture = analogRead(SENSOR_PIN); // Read raw ADC counts
Serial.printf("Soil ADC: %d\n", moisture);
if (moisture > DRY_THRESHOLD) { // Soil is dry
digitalWrite(PUMP_PIN, HIGH); // Saturate BJT, pump runs
delay(PUMP_ON_MS);
digitalWrite(PUMP_PIN, LOW); // Return to cutoff
}
delay(CHECK_MS);
}
Calibrate DRY_THRESHOLD by reading the sensor in dry air and in water, then pick a value about 40% of the way from wet to dry.
Selecting the Right BJT: Datasheet Checklist
Check these parameters before ordering:
- V<sub>CEO</sub>: Must exceed your supply voltage with margin (at least 1.5x).
- I<sub>C(max)</sub>: Choose at least 2x your load current.
- h<sub>FE</sub> at your I<sub>C</sub>: Read the curve, not just the headline number.
- V<sub>CE(sat)</sub>: Lower values mean less heat in switching service.
- P<sub>D</sub> (power dissipation): Compute V<sub>CE</sub> × I<sub>C</sub> and compare, including thermal derating.
- f<sub>T</sub> (transition frequency): The 2N3904 reaches about 300MHz. Faster is not always better for EMI.
- Package: TO-92 for prototyping, SOT-23 for compact PCBs, TO-220 for power.
FAQ
What is the difference between BJT saturation and the active region?
In the active region, collector current equals β × I<sub>B</sub> and V<sub>CE</sub> stays above about 0.3V. In saturation, both junctions are forward biased, V<sub>CE</sub> drops to roughly 0.1 to 0.3V, and the load limits current instead of the transistor.
How do you calculate the base resistor for a BJT?
Use R<sub>B</sub> = (V<sub>drive</sub> − 0.7V) / I<sub>B</sub>, where I<sub>B</sub> = I<sub>C</sub> / 10 for a forced beta of 10. For a 70mA load on a 3.3V GPIO, that gives about 371Ω, so use a 330Ω resistor.
Can a BJT be driven directly from a 3.3V microcontroller pin?
Yes, through a base resistor. A 3.3V pin supplies about (3.3V − 0.7V) / R<sub>B</sub>. Keep base current within the pin’s limit (about 20mA on ESP32 and 20mA recommended on AVR) and choose a transistor with high gain at low base voltage, such as the 2N2222A or BC547.
Why does my BJT get hot when switching a load?
It is likely not saturating. Measure V<sub>CE</sub> while ON. If it reads above 0.5V, the transistor is dissipating power in the linear region. Lower R<sub>B</sub> to raise base current, or switch to a Darlington or MOSFET for larger loads.




