Logic-level MOSFET
A MOSFET with RDS(on) guaranteed at 2.5 V or 4.5 V switches fully from a 3.3 V or 5 V pin, with little heat.
IRLML6344: 0.16 W of heat, junction 41 °C.
Will this transistor switch my load from a 3.3 V or 5 V pin? Pick the board, the part and the load: you get the base resistor or the gate verdict from the figures the datasheet guarantees, the heat, the flyback diode, and better options when it doesn’t work.
The usual ways to switch the same load, in the order that suits your values.
Now, AO3400A: 0.21 W of heat, junction 52 °C.
A MOSFET with RDS(on) guaranteed at 2.5 V or 4.5 V switches fully from a 3.3 V or 5 V pin, with little heat.
IRLML6344: 0.16 W of heat, junction 41 °C.
A driver such as the TC4427 (1.5 A, 4.5–18 V supply, input high from 2.4 V) puts 10–12 V on the gate and switches in nanoseconds: for standard MOSFETs and fast PWM.
TC4427 from a separate 9 V supply (a regulator or a Zener) with the AO3400A: 0.14 W, junction 42 °C.
7 or 8 Darlington channels with the flyback diodes inside, 50 V and 500 mA per channel: for relays, small solenoids and stepper motors. Each channel drops 1–1.6 V.
Over the 300 mA per channel it handles from this pin.
Check which MOSFET the module carries. The common IRF520 module needs about 10 V on the gate; modules with a logic-level MOSFET or a gate driver work from 3.3 V.
Isolates the load completely and switches AC or DC with almost no heat. No PWM, slow, and the coil needs its own current: check that the module’s input works from 3.3 V.
For mains AC loads: silent, no contacts to wear. AC models don’t switch DC: there are DC models for that.
Chips such as Infineon’s PROFET switch the positive side with an N-MOSFET and a built-in charge pump, with current limiting and overtemperature protection.
| Load | 12 V × 2 A = 24 W (resistive load) |
|---|---|
| Gate | 100 Ω in series, 10 kΩ from gate to ground |
| RDS(on) | at most 48 mΩ, guaranteed at 2.5 V (3 A); the gate gets 3.3 V, threshold up to 1.45 V |
| Voltage drop | 0.11 V (RDS(on) 54 mΩ when warm): 0.21 W |
| Junction temperature | 52 °C = 25 °C + 0.21 W × 125 °C/W |
| Ratings | 12 V of 30 V · 2 A of 5.7 A |
| In free air | up to 1 W at 25 °C (θJA 125 °C/W) |
Keep the 10 kΩ from gate to ground: while the microcontroller boots its pins float and the MOSFET could turn on by itself.
With amps flowing, keep the ground return of the load away from the microcontroller’s ground wire: join them at the power supply.
An SOT-23 sheds its heat through the copper on the drain pin: the datasheet figure assumes about 6.5 cm² (1 in²), a bare pad runs much hotter.
The microcontroller and the load supply must share ground, otherwise the gate or base has no reference.
A transistor used as a switch should be fully off or fully on. Fully on means saturated for a bipolar transistor and at its low RDS(on) for a MOSFET: the drop across it is small, and so is the heat. The calculator checks that your pin can drive it there using only the figures the datasheet guarantees, then works out the heat and the junction temperature.
The hFE in the datasheet is measured with several volts across the transistor, not in saturation. For the saturation voltage VCE(sat) the datasheets use a much lower gain, usually IC = 10 × IB (20 × for the BC547, 250 × for the TIP120 Darlington). The calculator uses that same forced gain, so the saturation voltage in the result is guaranteed.
IB = IC ÷ β(forced) RB = (VGPIO − VBE(sat)) ÷ IB P = VCE(sat) × IC + VBE(sat) × IB
Example: an ESP32 switching a 12 V relay coil of 70 mA with a 2N2222A. IB = 70 ÷ 10 = 7 mA and RB = (3.3 − 1.2) ÷ 0.007 = 300 Ω, rounded down to 270 Ω so the base gets a little more. The transistor drops at most 0.3 V: about 30 mW, nothing to worry about. At 300 mA the base would need 30 mA, more than the 20 mA an ESP32 pin should give: that is where a MOSFET takes over.
The threshold voltage VGS(th) is not where a MOSFET turns on: it is where it barely starts to conduct, at 250 µA or 1 mA. What matters is the RDS(on) the datasheet guarantees at a given gate voltage. The AO3400A guarantees it at 2.5 V and switches fully from a 3.3 V pin. The IRLZ44N guarantees it from 4 V: fine from 5 V, not guaranteed from 3.3 V. The IRF520 and IRF540N guarantee it only at 10 V. Between the threshold and the lowest guaranteed point the datasheet promises nothing, and the calculator says so instead of guessing.
P = I² × RDS(on)(Tj) + Pswitching Tj = Ta + P × θJA
RDS(on) rises with temperature, by about 1.5 times at 125 °C on these datasheets (1.43 for the AO3400A and 1.8 for the 2N7000, from their tables). The calculator raises it with the junction temperature and repeats until the two agree. Example: an AO3400A driven by an ESP32 switching a 2 A LED strip at 12 V. At 3.3 V the guaranteed figure is the 2.5 V one, 48 mΩ: 2² × 0.048 = 0.19 W, about 0.21 W once warm. At 125 °C/W the junction reaches about 52 °C.
The common red IRF520 module connects the signal pin almost straight to the gate of an IRF520. Its threshold can be as high as 4 V and its RDS(on) is guaranteed only at 10 V. From a 3.3 V ESP32 it may not turn on at all; from a 5 V Arduino it conducts only partly and heats up with a few amps. From 5 V you can replace it with a logic-level MOSFET with the same pinout, such as the IRLZ44N or the IRLB8721. From 3.3 V use a MOSFET guaranteed at 2.5 V or a gate driver.
A coil resists changes in current. When the transistor turns off, the coil keeps the current flowing and its voltage shoots up until something breaks down, usually the transistor. A diode across the load, cathode to the positive supply, gives that current a path. For relays switched on and off a 1N4148 (small coils) or a 1N4007 is enough; with PWM on a motor use a Schottky diode such as the 1N5819 (1 A) or the SS34 (3 A), rated for the load current.
Sometimes the load must keep its ground connection and the switch goes between the supply and the load. With a P-channel MOSFET the source goes to the positive supply and a resistor pulls the gate up to the same voltage (off); a small NPN driven by the pin pulls the gate down (on). The gate then sees the whole supply voltage: above 80 % of the MOSFET’s gate limit the calculator adds a divider. A pin can’t drive the P-MOSFET directly when the supply is higher than the pin voltage: the MOSFET would never turn off.
At every edge the MOSFET spends a moment half on, with both voltage and current. A microcontroller pin moves the gate charge with a few tens of milliamps, so an IRLZ44N (48 nC) needs a few microseconds per edge: harmless at 1 kHz, a few watts at 20 kHz with 5 A. The calculator estimates it as ½ × V × I × (rise + fall time) × frequency, with the whole gate charge, which errs on the safe side. For fast PWM use a small MOSFET with a low gate charge or a gate driver.
| Part | Type | Package | Max V | Max I | Guaranteed | At 3.3 V | At 5 V | θJA |
|---|---|---|---|---|---|---|---|---|
| 2N2222A | NPN | TO-92 | 40 V | 600 mA | VCE(sat) 1 V / 500 mA | — | — | 200 °C/W |
| 2N3904 | NPN | TO-92 | 40 V | 200 mA | VCE(sat) 0.3 V / 50 mA | — | — | 200 °C/W |
| BC547 | NPN | TO-92 | 45 V | 100 mA | VCE(sat) 0.6 V / 100 mA | — | — | 200 °C/W |
| S8050 | NPN | SOT-23 | 25 V | 500 mA | VCE(sat) 0.6 V / 500 mA | — | — | 417 °C/W |
| TIP120 | NPN Darlington | TO-220 | 60 V | 5 A | VCE(sat) 4 V / 5 A | — | — | 62.5 °C/W |
| 2N7000 | N-channel MOSFET | TO-92 | 60 V | 200 mA | RDS(on) 5.3 Ω / 4.5 V | not guaranteed | 5.3 Ω | 313 °C/W |
| BS170 | N-channel MOSFET | TO-92 | 60 V | 500 mA | RDS(on) 5 Ω / 10 V | not guaranteed | not guaranteed | 357 °C/W |
| AO3400A | N-channel MOSFET | SOT-23 | 30 V | 5.7 A | RDS(on) 48 mΩ / 2.5 V | 48 mΩ | 32 mΩ | 125 °C/W |
| Si2302 | N-channel MOSFET | SOT-23 | 20 V | 2.6 A | RDS(on) 75 mΩ / 2.5 V | 75 mΩ | 57 mΩ | 175 °C/W |
| IRLML6344 | N-channel MOSFET | SOT-23 | 30 V | 5 A | RDS(on) 37 mΩ / 2.5 V | 37 mΩ | 29 mΩ | 100 °C/W |
| IRLZ44N | N-channel MOSFET | TO-220 | 55 V | 47 A | RDS(on) 35 mΩ / 4 V | not guaranteed | 25 mΩ | 62 °C/W |
| IRLB8721 | N-channel MOSFET | TO-220 | 30 V | 62 A | RDS(on) 16 mΩ / 4.5 V | not guaranteed | 16 mΩ | 62 °C/W |
| IRF520 | N-channel MOSFET | TO-220 | 100 V | 9.2 A | RDS(on) 270 mΩ / 10 V | not guaranteed | not guaranteed | 62 °C/W |
| IRF540N | N-channel MOSFET | TO-220 | 100 V | 33 A | RDS(on) 44 mΩ / 10 V | not guaranteed | not guaranteed | 62 °C/W |
| AO3401A | P-channel MOSFET | SOT-23 | 30 V | 4 A | RDS(on) 85 mΩ / −2.5 V | — | — | 125 °C/W |
| IRF9540N | P-channel MOSFET | TO-220 | 100 V | 23 A | RDS(on) 117 mΩ / −10 V | — | — | 62 °C/W |
Guaranteed maximum figures at 25 °C from the makers’ datasheets (onsemi, CJ, Alpha & Omega, Vishay, Infineon). At 3.3 V and at 5 V: the RDS(on) guaranteed with that gate voltage. θJA was measured on each maker’s test board, about 6.5 cm² of copper for the SOT-23 parts: with less copper they run hotter.
Yes, if the MOSFET’s RDS(on) is guaranteed at 2.5 V or less, like the AO3400A, Si2302 or IRLML6344. Add 100 Ω in series with the gate and 10 kΩ from gate to ground, so it stays off while the ESP32 boots. The IRLZ44N, often sold as logic-level, is guaranteed only from 4 V.
Because the IRF520 is not a logic-level MOSFET: its threshold can be 4 V and its RDS(on) is guaranteed only at 10 V. From 3.3 V it may not turn on at all. Use a gate driver, a module with a logic-level MOSFET, or a MOSFET guaranteed at 2.5 V such as the AO3400A.
RB = (VGPIO − VBE(sat)) ÷ IB, with IB = IC ÷ 10 for most small transistors (IC ÷ 20 for the BC547). For 100 mA from a 5 V Arduino with a 2N2222A: IB = 10 mA and RB = (5 − 1.2) ÷ 0.01 = 380 Ω, so 330 Ω.
From a 5 V Arduino a TIP120 works with little base current, but it drops up to 2 V at 3 A: up to 6 W of heat. A logic-level MOSFET drops a few tens of millivolts at the same current. From an ESP32 choose a MOSFET guaranteed at 2.5 V.
Yes for anything with a coil: motors, relays, solenoids, valves, fans. Fit it across the load with the cathode (the end with the stripe) to the positive supply. LED strips and heaters don’t need one.
The rating says several amps, but the heat decides. An AO3400A driven from a 3.3 V pin dissipates about 0.2 W at 2 A and stays near 50 °C; at 3 A it gets close to 100 °C. More copper around the drain pin helps.
The low side (transistor between the load and ground) is simpler: an N-channel MOSFET or an NPN driven straight from the pin. Use the high side when the load must keep its ground, for example a sensor that shares ground with the microcontroller: then a P-channel MOSFET with a small NPN that pulls its gate down.