Transistors
Bipolar and MOSFET transistors as switches and amplifiers, base and gate resistors, and driving loads from a pin.
What a transistor does
A transistor is a three-terminal part in which a small signal on one terminal controls a much larger current between the other two. Used as a switch, it lets a microcontroller pin turn a relay, motor or LED strip on and off. Used as an amplifier, it makes a small signal bigger. Every integrated circuit is built from millions of them.
| Family | Terminals | Controlled by | Notes |
|---|---|---|---|
| BJT (bipolar) | Base, collector, emitter | Current into the base | NPN conducts with a positive base current; PNP is the complement |
| MOSFET | Gate, drain, source | Voltage on the gate | Almost no gate current; N-channel is the usual choice |
| IGBT, JFET | various | Voltage | IGBTs for high-voltage power; JFETs for low-noise amplifiers |
Bipolar transistors (BJT)
In an NPN transistor, a small current into the base lets a larger current flow from the collector to the emitter. In the active region the collector current is about β (also called hFE) times the base current. β is typically 100–300 but varies widely between parts and with temperature, so design so that it does not matter.
IC ≈ β × IB IE = IC + IB VBE ≈ 0.7 V (silicon, when on)
- NPN (2N2222, BC547, 2N3904): the emitter goes to ground, the load goes between the supply and the collector (a “low-side” switch).
- PNP (2N2907, BC557): the complement; the emitter goes to the supply and the load to ground (“high-side”), turned on by pulling the base below the supply.
- Collector-emitter saturation voltage VCE(sat) is the small voltage across a fully-on transistor, about 0.1–0.3 V; the transistor then dissipates P = VCE(sat) × IC.
- Maximum ratings: collector current, VCEO (the voltage across it when off), power dissipation. Exceeding VBE reverse (about 5–6 V) can damage the base-emitter junction.
Using a BJT as a switch
A switch must be either fully off or fully on (saturated). To ensure saturation regardless of β, do not rely on the gain: supply a base current of about one tenth of the collector current (“forced β” of 10).
IB ≈ IC ÷ 10 RB = (Vcontrol − 0.7 V) ÷ IB
Worked example: switching a 100 mA load from a 5 V pin
- Collector current 100 mA, so base current ≈ 10 mA.
- RB = (5 − 0.7) ÷ 0.010 = 430 Ω. Use the next lower standard value, 390 Ω, which gives 11.0 mA: plenty to saturate the transistor.
- The transistor drops about 0.2 V, so it dissipates 0.2 × 0.1 = 0.020 W, far below the limit of a small-signal part (about 0.5 W).
- A pin may supply only 20 mA at most, so 11 mA is acceptable; for bigger loads, use a MOSFET.
- If the load is a relay or motor, put a flyback diode across it (see Inductors, Transformers and Relays).
MOSFETs
A MOSFET is controlled by the voltage between its gate and source. The gate is insulated, so it draws no current once charged (only a brief pulse to charge the gate capacitance). When the gate-source voltage VGS is above the threshold, the channel conducts and the drain-source path behaves like a small resistor, RDS(on).
- Logic-level MOSFET. A standard power MOSFET (for example the IRF540N) needs about 10 V on the gate to turn fully on, which a 3.3 V or 5 V pin cannot supply. A logic-level part (IRLZ44N, AO3400, IRLB8721) is specified with RDS(on) at 4.5 V or even 2.5 V gate drive. Read RDS(on) at your gate voltage, not just the headline number.
- VGS(th) is not the turn-on voltage. It is the point where the channel just starts to conduct (typically at 250 µA). The MOSFET is fully on only a volt or two above it.
- Gate resistor. 100 Ω to 1 kΩ in series with the gate limits the charging current and damps ringing. Pull-down resistor (10–100 kΩ gate to source) keeps the MOSFET off when the pin floats, such as at start-up.
- Body diode. A MOSFET has a diode built in between source and drain (reverse conducting). It can serve as a flyback path on a high-side switch but is slow; add a proper diode for motors.
- Power dissipation in the on state is P = I² × RDS(on), usually very small, which is why MOSFETs run cool when switching hard. In a linear (half-on) state they get hot fast.
- Static sensitivity. The gate oxide can be destroyed by static discharge; handle by the body and leave the gate with a pull-down resistor.
- N-channel switches the low side (source to ground). A P-channel MOSFET switches the high side (source to the supply), turned on by pulling the gate below the source. P-channel is also used for reverse-polarity protection.
Worked example: a 12 V, 2 A motor with an IRLZ44N
- At VGS = 5 V the IRLZ44N has RDS(on) of about 0.022 Ω. The drop across it is 2 × 0.022 = 0.044 V and the power is I² R = 4 × 0.022 = 0.088 W: no heat sink needed.
- A 2N7000 in the same job would have RDS(on) of about 5 Ω at 4.5 V gate drive: I² R = 4 × 5 = 20 W and a 10 V drop. It would burn out. The 2N7000 is rated only for about 200 mA.
- Add a gate resistor (100 Ω), a 10 kΩ pull-down and a flyback diode across the motor.
Driving a load: which one to use
| BJT (NPN) | Logic-level N-MOSFET | |
|---|---|---|
| Control | Base current (a few mA) | Gate voltage (almost no current) |
| Best for loads of | Up to about 500 mA | From 100 mA to tens of amps |
| Drop when on | 0.1–0.3 V (fixed) | I × RDS(on): millivolts at modest current |
| Speed | Fast; storage delay when saturated | Fast; limited by gate drive |
| Watch out for | β variation, base resistor | Gate voltage too low, static, no pull-down |
Operating regions
The output characteristics show collector current against collector-emitter voltage for several base currents. A switch works at two points on its load line: cut-off (off, no current, all the supply across the transistor) and saturation (on, full current, almost nothing across it). An amplifier works in between, in the active region, where the current is set by the base.
- Both end points are low-dissipation: off (current near zero) and on (voltage near zero). A switch spends only a moment in between, so it stays cool.
- In the middle of the load line the transistor drops half the supply and carries half the current, which gives its maximum dissipation (here 12 ÷ 2 × 0.06 = 0.36 W). A transistor left half-on, for example by too small a base current, runs hot.
Transistors as amplifiers
In a common-emitter amplifier, a small change in base voltage makes a large change in collector current, which appears as a large swing across the collector resistor. A resistor RE in the emitter stabilizes the gain against the transistor’s variations: the voltage gain is roughly RC ÷ RE.
AV ≈ − RC ÷ RE (common emitter, inverted) emitter follower: AV ≈ 1, with current gain
- Example: RC = 4.7 kΩ and RE = 1 kΩ give a gain of about −4.7. A 0.1 V peak input becomes a 0.47 V swing at the collector, inverted.
- Emitter follower (common collector): the output follows the input but can drive a much heavier load; useful as a buffer.
- For most audio and sensor work an op-amp is easier than a discrete amplifier; see Op-amps and Integrated Circuits.
Darlington pairs and H-bridges
- Darlington pair (TIP120, ULN2003): two transistors in one package with gains multiplied (1 000 or more). It needs very little base current, but drops 0.7–1.2 V when on and so dissipates more heat. The ULN2003 chip has seven drivers with built-in flyback diodes, handy for relays and steppers.
- H-bridge. Four switches around a motor let the current flow either way, so the motor can run forward and backward. Turning on the two switches in the same leg at once (“shoot-through”) shorts the supply, so use a driver chip (L298N, DRV8871, TB6612) with built-in protection and dead-time rather than building one.
- Motor speed is controlled by PWM on the enable or one of the switches.
Common parts
| Part | Type | Ratings (typical) | Use |
|---|---|---|---|
| 2N2222A / PN2222A | NPN | 40 V, 600–800 mA | General switch |
| BC547 / BC337 | NPN | 45 V, 100 mA / 800 mA | Small signals / small loads |
| 2N3904 | NPN | 40 V, 200 mA | General small-signal |
| 2N2907 / BC557 | PNP | 40–60 V, 600 mA / 100 mA | High-side or complementary |
| 2N7000 / BS170 | N-MOSFET | 60 V, 200–500 mA, RDS(on) a few ohms | Logic and level shifting; too weak for motors |
| AO3400 | N-MOSFET (SMD) | 30 V, 5.7 A, about 30 mΩ at 4.5 V | Good 3.3 V switch |
| IRLZ44N / IRLB8721 | N-MOSFET (logic level) | 55 V 47 A / 30 V 62 A, RDS(on) around 10–25 mΩ at 5 V | Motors, heaters, LED strips |
| IRF540N | N-MOSFET (standard) | 100 V, 33 A, needs about 10 V gate | Use with a gate driver |
| TIP120 / ULN2003 | Darlington | 60 V, 5 A / 500 mA per channel | Simple drivers |
Check the pinout in the datasheet before wiring: the same package (TO-92) has different pin orders for different parts, and a transistor wired backwards may work poorly or fail.
Related
- Electronics Fundamentals: the overview of this guide.
- Resistors: base and gate resistors and pull-downs.
- Inductors, Transformers and Relays: flyback protection and relay drive.
- Embedded Systems: microcontroller pins and PWM.
FAQ
Why does my MOSFET get hot?
Most often the gate voltage is too low, so the MOSFET is only partly on and its resistance is much higher than the datasheet’s RDS(on). Check that VGS is at the level the RDS(on) figure assumes. Slow switching edges and very high currents also cause heating.
Do I need a base resistor?
Yes. The base-emitter junction is a diode; without a resistor the current is limited only by the source and can destroy the pin or the transistor. Size it as above.
Can I drive a MOSFET directly from a 3.3 V pin?
Yes, if it is a logic-level part rated for that gate voltage (RDS(on) specified at 2.5 V or 3.3 V). Many “logic-level” MOSFETs are specified only at 4.5 V or 10 V, so read the table.
What is the difference between NPN and PNP?
They mirror each other. An NPN switches the low side (load between the supply and the collector, emitter at ground); a PNP switches the high side (emitter at the supply). In the symbol, the arrow on the emitter points out for NPN and in for PNP.
Why add a pull-down resistor on the gate?
A floating gate may sit anywhere, partly turning the MOSFET on. At start-up, a microcontroller pin is often high-impedance for a moment, so the pull-down keeps the load off until the program takes control.
References
- Horowitz, P. and Hill, W., The Art of Electronics, 3rd ed., Cambridge University Press: chapters 2 and 3.
- Manufacturer datasheets: 2N2222A (onsemi), BC547 (Philips/Fairchild), 2N7000 (onsemi), IRLZ44N (Infineon), AO3400 (Alpha & Omega).
- Platt, C., Make: Electronics, 3rd ed., Make Community.
- Texas Instruments, ULN2003 and DRV88xx application notes (drivers and H-bridges).
Last reviewed: October 2026. Values are typical: check the datasheets of the parts you use.
