IRF510 Mosfet Problem


I'm currently working on a project to control a large amount of LEDs through my Arduino Mega, but I've stumbled across the following problem:

I have my Arduino out pin (PWM/digital, tried both) connected to the gate of the IRF510, the +12V to the drain and ground to source. (+12V and ground are from my external power supply)

My LEDs light up but they flicker and I'm not able to adjust the brightness with the PWM pin.

When I have the +12V to source and ground to drain, the LEDs light up but do not flicker. However, I'm still not able to adjust the brightness.

I'm pretty sure that I need a pulldown resistor on the gate, but I have totally no idea where and how to wire it. I've tried numerous possibilities but to no avail :(

When trying to "manually" ground the gate, i.e. touching it with my fingers, the circuit seems to be working and I'm able to use the PWM output to control the brightness. However, with the output set to 0, I still have a faint glow in the LEDs. (note it also works when I touch the ground of the external power supply, but don't ask me why :p)

I'm sure there must be a simple solution but I just can't find it. If anybody could help me out, I'd be more than grateful !

Perhaps the gate source capacitor doesn't discharge. Should put a 10k resistor to ground to discharge it.

But I think arduino's output is delivering a to low voltage to well saturate the transistor.

Would first like to see your wiring drawing, however the problem is most likely the fact that a IRF510 is NOT a logic level MOSFET and requires a full 10vdc to the gate terminal to fully turn on the mosfet. A LOGIC level mosfet rated well above your total LED current draw is required.


I've created a schematic to give you a better idea. (don't mind the 2 LEDs, I've just simplified it a little :D)

Please note that I've just tested the same circuit with a pulldown resistor (1K) from gate to ground and I put both 9 and 12V on the gate pin. Sadly enough, with no result..

How are you wiring the Arduino ground to the negitive side of the +12vdc supply? This won't work without a common ground between the Arduino board and the external LED circuit. Also your drawing doesn't show which mosfet terminal is the source and drain terminals.

Again an Arduino high output will not be enough voltage to fully turn on the MOSFET, possibly only enough to allow a few ma of current.


Aha I get it now !

I've tried putting a 1K resistor between gate and ground again, but this time I tied both grounds to each other. And it's working just as it should now :D

So in this scenario, I have 2 power supplies. One 5V which powers the LEDs (schematic is wrong I know :p) and a 12V which passes current to the gate. And the two grounds are connected. Is this the right way to wire it up or am I doing something terribly stupid here? :P

Say that I do have a logic level mosfet, how would I then wire things up? Do I need to connect the ground from the Arduino to the ground of the other power supply?

Thanks a lot for the quick replies :)

PS: Should the +5V be connected to source or drain? And does this make a big difference?

EDIT: Just tried it with my Arduino PWM pin and it works ! Does this mean the mosfets will operate just fine at a +5V at the gate? Or are they just letting a few mA through? (currently I have 4 LEDs hooked up, totalling 100mA)

and a 12V which passes current to the gate.

I'm very confused with what you are proposing. The gate is wired to a Arduino output pin, no? If so that's 5vdc when on and ground when off, supplied by the Arduion output pin. Applying 12vdc to an Arduino pin will destroy the Arduino.

The Mosfet source terminal should wire to ground, gate terminal to Arduino output pin, drain terminal to the external load (leds and series resistors), other side of load to positive external voltage source. Negative of external voltage source to common Arduion and MOSFET source terminal ground connection. A 10k resistor from gate to ground is useful to insure the MOSFET is off even if you power off the Arduino.


Heh yeah, sorry about the confusion :stuck_out_tongue:

See I wasn’t using my Arduino at first, but just a +12V signal from an adapter which I then connected to the gate.
I saw that it worked and only then I switched over to the Arduino pin.

I hope it makes sense now :wink:

Right now it’s connected to a PWM output pin and I can successfully fade several LEDs, does that mean I’m good to go with these mosfets or should I consider logic level ones? (although somebody suggested to buy these as they were logic level he said …)

Yes you should be using logic level mosfet instead of standard mosfet as a Arduino digital high is around 4.5 to 5 volts which is barely turning on your MOSFET.

It might work for the small current your external LEDs are using, and if it works and you are happy with it, then don't change to logic level, your choice.

Just so you understand that if you were trying to switch on and off say a 1 amp current load though your mosfet it wouldn't work.


Okay, I'll bear that in mind ;) Just in case it happens, can it hurt my Arduino in any way?

Thanks again for all your help, without you I'd still be scratching my head :D

Just in case it happens, can it hurt my Arduino in any way?



Don't know if I have missed something in the intervening posts, but why is the top of R2 connected to the cathode of D1?

I came in late to this thread so I am not sure if you corrected the schematic but the drain and source terminals are reversed. In the schematic the LEDs will light because you are conducting through the intrinsic body diode.

(* jcl *)

www: twitter: blog:

Heh yeah guess I'm not good at making schematics :D

Anyway I was in a rush and just added some components and forgot to rotate them. Everything works now, and I guess I've hit the limit of current that's allowed to pass through the IRF510 when the gate is at 5V because with 10 LEDs they start to flicker a little ..

I've been looking for some better logic level N-MOSFETS, but I'm a bit overwhelmed by what my regular electronics supplier has to offer. If you could take a look and quickly go through the list, perhaps you recognize one that could be of use in my project. I'm looking for a logic level N-MOSFET, that's capable of sinking >5A at 12V.

It would be a great help because I really don't know where to begin. (I have to look at the category 'Chips' right? But then what subcategory? ::))

Your big problem is that you are using a 110V FET in a 12V application. The 110V FET has much higher Rds(on) then a 30V part. For my LED driver I am using an On-Semi NTP65N02R which should be able to provide about 20A at a Vgs of 3.3V. The practical limitation due to heatsinking and voltage compliance for the LEDs
is more in the range of 2A.

In the pictures of my LED driver I am powering 5 Luxeon LEDs at 350mA (without heatsinking of the FETs).

(* jcl *)


Do I need to connect the ground from the Arduino to the ground of the other power supply?


Thanks for the reply, I'm starting to understand MOSFETs better now :) Perhaps you know a widely available MOSFET in Europe that would fit my needs? If necessary, I can add a small heatsink to them to allow better heat dissipation.

Upon making some calculations, I've come to realize that around 2-3A would be enough, as long as they are logic level.

It's actually quite frustrating because I've already found several good ones, but not a single store has them in Europe, nor can I find them on eBay :-/ (for example the NTE2980 which looked perfect to me)

I forgot to include the link to my electronics supplier the other post. If you wouldn't mind to take a look and see if anything rings a bell? And in what subcategory of the 'Chips' should I be looking?

You can look at IRLZ24 or IRL510, they can be bought from Conrad in Germany.

Is Mouser or Digikey difficult to deal with in Europe? Maybe Farnell (Newark).

You could also try getting some parts from the manufacturer. Onsemi would probably sell you some sample parts.

(* jcl *)

Yup, they sell em at Conrad ! Thanks a lot for the link ;)

Can't wait to start building now :p

I have one question left: Is it possible to let Arduino switch on/off an external PSU? I've read that you have to connect the green wire with a black one, so I was thinking, is it possible to put a MOSFET in between the two wires and let the Arduino control it?