Mosfet to power LED strip

I'm working on a wake-up light project, in which an arduino nano controls an led-strip. I'm using a 2.7m led strip using about 50 W, powered by a 24V 3A transformer. I'd like to make a dimmable strip, using a mosfet (currently trying an IRF520) in combination with PWM. I'm not having much succes so far putting this together.

Im using this configuration:

Is this wired correctly? Should i use a different mosfet?

I can sort of get this to work as expected using an Iduino Debo MOS module, except then the led-strip glows very dimly, not being able to wake up anyone, least of all me. Any pointers or tips are appreciated!

The 100R resistor is doing nothing other than maybe burning the processor pin out.
Put around 1K between the processor and the gate of the FET.
Maybe 10K where the existing 100R is placed.

Those 220R are doing nothing worthwhile. Maybe only getting warm.

So, like this?

You're right, the arduino seems to run perfectly fine without those 220R resistors. The LED-strip stays fully off though, no matter the state of the processor pin...

ok, I just looked at the IRF520 datasheet…
IRF 520
It’s an N-channel FET, which is good, and in most applications will be used in the negative side of the load.

The positive supply is always on the anode of the LEDs, the FET [S]ource goes to ground, and the [D]rain goes to the LED cathodes. the [G]ate is fed with the processor output via the resistor.

You also need to use a FET that will turn on with logic levels on the Gate - the 520 needs +20V above the common 0V rail.

Unfortunately, it seems you got it almost perfectly wrong from the beginning !

We all started somewhere !

I bet it does well at +10V as well in this application, but that's still way beyond Arduino levels.

IRF520 is a mosfet from the stone age and is not very useful in a project like this. There are many better alternatives out there. Google for "Arduino logic level mosfet" and see what you get.

Also you're correct on an N-channel mosfet being used as a low-side switch.

Finally, I see a DC-DC convertor connected to Vin on the Nano. Doesn't make sense to me...assuming it's a 24V to 5V converter, just connected the 5V to the 5V pin on the Nano. It doesn't make sense to use a step down converter and then have that feed the wasteful and power-limited linear regulator on the Nano.

Thanks for the tips lastchancename and koraks! I feel like I'm getting closer...

It turns out I got the IRF520 with the arduino starter kit. I have previously ordered a different one that seems to be more logic level (IRLB8721). Still not getting it to with that one, but i do start to see some 'transisor-like' behaviour when not using the 10K R, such as the light turning on (brightly!) when i touch the arduino body, and turning off when i let go of it. When i put the 10K resistor in place, nothing happens. Also, the state of the processor output, on or off, doesnt seem to make any difference, though it does turn on/off the LED at the output pin.

I'm not saying this IRLB8721 is the best tool for the job, but if it's specs are off i have no idea which one that would be. This one (IRLB3034PbF) might have slightly lower starting Gate to Source voltage, but doesnt seem to different otherwise...

Any further tips?

I did connect the arduino directly to the 5v pin, working fine! I was kinda hesistant to do that after already frying an arduino processor, a resistor and multiple LED's, but it turns out i can just do that!

That LED from D2 to GND needs a current limiter resistor. Try 330 or 1k and see if that makes a difference.
The 10k resistor should not make a difference. Fix the issue above and see if still makes a difference if you remove it.

The whole business with touching it influencing how it works suggests a connection/cabling issue. Could you post a good photo of your setup?

I don't think it makes any difference. Still completely off with the 10k resistor in place, and susceptible to touch without it. Here are some pics:


Not included in the diagram are a button (used for turning the D2 PWM pin on and off) and a clock module that is connected, but not controlling anything right now.

OK, well, the 1k now forms a voltage divider with the 10k, so you only get 90% of the available output voltage of the GPIO pin on the MOSFET gate. Swap them so that the 10k goes from GPIO to GND and then take 1k from there to gate. Or just leave out the 1k altogether. Since the 10k is also not strictly necessary, you could try without either of these resistors.

Your led looks pretty happy now where it is with its new-found resistor friend :slight_smile:

Given what you said about touching the Arduino, I suspect it might just be a bad contact on the breadboard. Have you tried moving the Arduino to the other end of the board, or shifting it by a few pins? Sometimes those strips inside the breadboards become a little...well, compromised.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.