Saturated bipolar and N-channel MOSFET to drive relays, motors and LEDs
A microcontroller pin supplies a few milliamperes at 3.3 or 5 V. To switch on a relay, a motor, an LED strip or a solenoid you need a transistor acting as a switch: the small control signal opens and closes a circuit with more current and, often, more voltage. It is usually placed on the low side (between the load and ground), because it can then be controlled with a ground-referenced voltage.
A bipolar transistor carries a collector current \(I_C = h_{FE}\,I_B\) while in the active region. As a switch we want saturation: it is given more base current than needed, the collector-emitter voltage falls to 0.1 to 0.3 V and the transistor dissipates little. Since \(h_{FE}\) varies widely between units and with temperature, the design uses a forced β of 10 to 20 (a base current of \(I_C/10\)) or, at the very least, two to three times \(I_C/h_{FE,\min}\).
A MOSFET is voltage-controlled: the gate is a capacitor and, in steady state, draws no current. When the gate-source voltage is well above the threshold, the channel behaves like a resistance \(R_{DS(on)}\) of a few milliohms. Note: the threshold \(V_{GS(th)}\) is the voltage at which it starts to conduct (about 250 µA), not the one at which it conducts well. The figure that matters is the \(R_{DS(on)}\) guaranteed at the gate voltage you will use. With 3.3 or 5 V you need a logic-level MOSFET, specified at VGS = 4.5 V or 2.5 V.
The datasheet RDS(on) is usually given at 25 °C; at 100 °C it can be 50 to 70 % higher. The switching calculation is an order-of-magnitude estimate. 62 °C/W is the typical value for a TO-220 package without a heatsink.
| Bipolar (BJT) | MOSFET | |
|---|---|---|
| Control | By current: needs continuous base current | By voltage: current only during transitions |
| On-state drop | VCE(sat) of 0.1 to 0.3 V (1 V or more for Darlingtons) | ID · RDS(on): millivolts on large MOSFETs |
| High currents | Loses efficiency and needs a lot of base current | Ideal: tens of amperes with little dissipation |
| Low control voltage | Works with 1 V or less | Needs a logic-level model at 3.3 V |
| Price and robustness | Very cheap, tolerates static electricity well | Cheap; the gate is sensitive to static electricity and overvoltage |
| Model | Type | Max. voltage | Max. current | Key figure | Typical use |
|---|---|---|---|---|---|
| BC547 / 2N3904 | NPN | 45 / 40 V | 100 / 200 mA | hFE ≥ 100 | Small relays, LEDs, signals |
| BC337 / 2N2222A | NPN | 45 / 40 V | 800 / 600 mA | hFE ≥ 100 | Relays, buzzers, loads of hundreds of mA |
| TIP120 | NPN Darlington | 60 V | 5 A | hFE ≥ 1000, VCE(sat) ≈ 2 V | Motors and solenoids (it runs hot) |
| ULN2003 / ULN2803 | 7 or 8 Darlingtons with diodes | 50 V | 500 mA per channel | 5 V compatible inputs | Relays and stepper motors |
| 2N7000 / BSS138 | N-channel MOSFET | 60 / 50 V | 200 mA | RDS(on) of a few ohms | Signals, level shifting |
| AO3400 | N-channel MOSFET (SOT-23) | 30 V | 5.7 A | Logic level, RDS(on) < 33 mΩ at 4.5 V | LED strips and medium loads from 3.3 V |
| IRLZ44N | N-channel MOSFET (TO-220) | 55 V | 47 A | Logic level, RDS(on) ≈ 25 mΩ at 5 V | Motors and large loads from 5 V |
| IRF540N | N-channel MOSFET (TO-220) | 100 V | 33 A | Not logic level: specified at 10 V | Needs a gate driver from a microcontroller |
Indicative values; the maximum currents of MOSFETs assume an ideal heatsink and are much lower in practice.
Related: LED resistor, optocouplers, level shifting and Ohm's law and power.