We have covered MOSFET control before, But here we are taking the previous PWM sketch (no code changes), and replacing the Arduino driven LED with a MOSFET and 3 high brightness LED’s powered by an external 12v supply. This could easily be a heater or a motor instead of lights.
12v+ connects to the anode of the first LED in the series of 3. The cathode of the last LED connects to R1 (120 ohm), and then the drain of the IRL520 MOSFET. The source of the MOSFET connects to ground. The gate connects to R2 (10k ohm) to ground, and to R3 (130 ohm, protects the Arduino) to Arduino pin 7. It’s important that the external supply is grounded to the Arduino. See the schematic for further details.
Become the Maker you were born to be. Try Arduino Academy for FREE!
To control ac loads with a MOSFET, see http://arduinotronics.blogspot.com/2016/07/controlling-ac-loads-with-mosfet.html