Monday, January 2, 2012

Using Mosfets

I'm working on a LED lighting project. The LED's consume more power than a Arduino can handle, so I'm using a IRL520 MOSFET to control the lights.

The first phase of the project is simple on and off, the second phase will PWM the MOSFET for brightness of the LED's. Third phase is 3 MOSFETS each controlling a different color bank of LED's for tonal control.

What we have working in phase 1:

+12vdc to 3 white LED's in series with a 120 ohm resistor

This configuration was determined using the LED Wizard at

The next step was to insert a IRL520 MOSFET is series with the LED's, between the resistor and ground. The Drain (pin2) connects to the resistor, the Source (pin3) connects to Ground. The Gate (pin1) can be tested by connecting to +12v (momentarily, not good to exceed 10v) and Ground, alternately.


What have we discovered? The output (LED output) toggles with the gate connection. When we touch +12 momentarily, the LED's light up, and stay lit even after the Gate is no longer touching +12v. When the Gate is grounded, the LED's go out, and stay out, until Gate touches +12v again. We need to connect a 10k ohm resistor between Gate and Ground, so that the LED's are off unless power is applied to the gate, which will be +5v from Arduino pin 13 in the next example.

Schematic generated in SchemeIt, a free online schematic tool.


  1. The series resistor power rating is inadequate. If the LEDs you picked chanced to have a voltage drop of only 2.0v, the 120R resistor dissipates 0.3W, so use a 1/2W one to be on the safe side.

  2. They are 2.2v each, so there's a 6.6v voltage drop. The resistor is dropping 5.4v

    5.4 * 5.4 = 29.16 / 120 = .243 (less than 1/4 watt). Not sure why the LED Wizard says 48mw.

  3. First, the wizard has calculated values based on 9v, not 12v, supply.
    Second, the 2.2v drop is typical - allow for 10% variation and design for worst-case.

  4. The LED's are reversed. The flat bar on a LED diagram should point to ground.