A MOSFET simulator: a 2N7000 switching an LED
Mokxi is a free online MOSFET simulator that runs in your browser, with nothing to install and no account needed. A 2N7000 N-channel MOSFET as a low-side switch: an LED and its 220 ohm resistor on the drain, the source on ground, and a slide switch putting the gate on 5 V or on ground. No gate resistor, no microcontroller, nothing in between.
- 455parts on the bench
- 43boards running now
- 1.00xreal time, on every board
What you can do here
In the circuit above, or in the editor it opens.
- Switch an LED with a MOSFET’s gate and nothing else
- Read the drain current under the part as it runs
- Swap the 2N7000 for an IRLZ44N or an IRF540N
- Try a P-channel BS250 or IRF9540N as a high-side switch
- Drive the gate from an Arduino pin instead of a switch
- Export the circuit as an ngspice deck
What the running circuit shows
A gate that takes a voltage, not a current.
A MOSFET’s gate is a plate behind an insulator, so it takes no steady current: put a voltage on it above the threshold and the channel between drain and source turns on. That is why there is no gate resistor here, where a bipolar transistor would need one on its base. The switch is wired across both rails so the gate is always held at one or the other; a floating gate is the one thing a MOSFET circuit must not have.
In the engine, with the gate on ground nothing flows. With the gate on 5 V the drain current under the part reads about 14.8 mA, the LED lights, and the drain sits about 30 mV above ground: fully on, the 2N7000’s channel is about 2 ohms. Swap in an IRLZ44N, whose TO-220 legs read gate, drain, source so its three jumpers move with it, and the drain falls under 1 mV for the same current; an IRF540N leaves about 2.4 mV.
How the MOSFET is modeled
A SPICE level 1 model, with each part’s own card.
Each MOSFET is a level 1 model solved with the rest of the circuit, with its threshold, transconductance and capacitances from its own model card: the 2N7000’s threshold is about 1.8 V, the logic-level IRLZ44N’s 1.5 V and the IRF540N’s 3 V. Below the threshold the channel is off; above it the current rises with the square of the overdrive until the channel is fully on and the load sets the current.
What it leaves out: the parts do not heat up, so a MOSFET carrying amps with too little gate voltage will not fail here the way a real one would. The analog circuit exports as an ngspice deck for anything the canvas does not show.
Questions
Is it free?
Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.
Do I need an account?
No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.
Do I need a gate resistor?
Not to limit a steady current, because the gate takes none. Real designs often add a small one to soften the edges when a pin switches a big MOSFET fast, and a pull-down so the gate never floats.
Can an Arduino pin drive a MOSFET?
Yes, for a logic-level part. The IRLZ44N’s threshold is about 1.5 V, well under a pin’s 5 V, and the small 2N7000 on this page works from a pin too, for loads like this LED.
What is the difference between N-channel and P-channel?
An N-channel MOSFET sits between the load and ground and turns on when its gate is above its source; a P-channel one sits between the supply and the load and turns on when its gate is pulled below its source. Both kinds are in the parts bin.
More simulators
Each one opens on a circuit that is already running.
Switch with a MOSFET
Open the circuit, click the switch and press Run. Nothing to install, and no account needed.