If you need to switch a dc load, a MOSFET is a very useful component. Typically carrying much more current than a standard transistor, and better performance characteristics, like a high impedance gate that draws very little current. BJT’s are current driven devices, MOSFETs are voltage driven devices.
Not all MOSFETs are the same, and too many Arduino sites show the IRF series MOSFET. The IRF series require 10v (VGS = 10.0 V) at the gate to fully open at anywhere near rated loads, so we use the IRL series. Any logic level N-Channel MOSFET (VGS = 5.0 V) will work, and look for the lowest RDS(on) (Ω) resistance you can practically find, to limit heat buildup. Connect your DC load between + and the Drain (D) of the MOSFET. If you are using an inductive load, like a motor, relay, or solenoid, do not forget the flyback diode across the load terminals.
Become the Maker you were born to be. Try Arduino Academy for FREE!
Connect the MOSFET Source (S) to ground, or negative terminal of your voltage source. We add two resistors, a 10k Ohm from the MOSFET Gate (G) to ground to ensure turnoff when Gate signal is removed, and a 125 Ohm resistor between the Arduino output and the MOSFET Gate (G). This protects the Arduino pin from too much current draw if the MOSFET fails. The value is determined by the voltage of the Arduino pin (5v) divided by the max current we want to allow (40ma). The Arduino sends a HIGH signal to turn on the MOSFET, a LOW to turn it off, and can also use PWM (analogWrite on an appropriate pin) to control motor speed, lamp brightness, etc.