Hello to all. I've reviewed quite a few topics here on the forum and although some are similar, I am trying to find a solid answer for the following. My project is very simple:
Digital Pin on Arduino Mega 2560 gets triggered by a condition (switch, timer, etc) > Mosfet > 12 V LED (With external power source) - My wiring diagram is below. In my testing, the IRF520 works just fine, however, based on recommendations I have decided to switch it out for something else, such as the highly recommended Logic Level Mosfet. I noticed there are many diagrams posted on here...some don't have a resistor between the Mosfet and the input to the Arduino. I plan to control at least 8 LEDs this way; I don't plan to use any type of Driver or Buffer, just each LED connected to the 12v Power supply, and a separate MOSFET going to a separate digital pin on the Arduino. The 12V LED is just an Annunciator LED, nothing crazy or fancy. Which Mosfet do you all recommend for this, and which resistor needs to be wired between the Mosfet's Gate and the arduino? I've seen 10Ks. Any help is appreciated and please go easy; I'm still learning this stuff. Thanks all for your time.
- Of importance is the current going thru the MOSFET.
-
You need to decide on Low Side verses High Side switching.
-
Logic Level MOSFETs must be able to be operated by the controller output pin voltage i.e. 5v or 3v3
-
Series current limiting resistor of ≈ 220R is sufficient to protect the controller GPIO.
-
A gate to GND (N channel Low Side) of 10k will keep the MOSFET OFF at controller power up time.
FYI, some Logic Level MOSFETs I use.
See circuit F2 for a typical LED driver:
OR
Circuit C2, for 12v operation (shows a motor and kickback diode load ).
@LarryD Thanks so much! I had actually downloaded your PDF a few days back to review and try to understand this better. It's very overwhelming as there is a lot to learn. In your sheet, the IRL540 and the IRLZ44N caught my attention for this project. Would these work for what I am trying to do?
Thanks.
-
The IRL540 can be used with a 5V Arduino at 5V Vgs, the Rds(on) is 77 milli Ohms and can easily pass 15 amps to the load.
-
The IRLZ44N can be used with a 5V Arduino at 5V Vgs, the Rds(on) is only 25 milli Ohms and can easily pass 25 amps to the load
Out of the two, the IRLZ44N can be considered better.
-
lets assume you are using a simple LED that only needs 20-50mA (very bright).
The above two MOSFETs will be over kill, like killing a fly with a shot gun.
However, they com in a TO220 case which is easy to manipulate with fingers.
-
lets assume you are using a high power LED (with heat sink) that needs 1A. Either MOSFET can be used.
-
I also Like the IRF3708 12A @ 10 milli ohms
-
Personally, I like small components when I make PCBs.
I lean to the AO4484 8A @10 milli ohms.
-
For lower current projects I use a lot of the IRLML2502, 4A @ 50 milli ohms.
What current do your LEDs require ?
What current do your LEDs require ?
@LarryD Thanks again for taking the time to reply. Looking around at similar LEDs, I think these are rated maximum 20mA. They will probably use less; I'll test them with my multimeter in a bit, but let's say max 20mA. What is your suggestion on the MOSFET to use? Even if the ones I mentioned are an overkill they are cheap enough and as you mentioned the package is so simple to work with. It would be nice to find breakout board for them like the IRF520 package but I have not had any luck yet. Thanks.
At ~ 20mA you do not need a transistor/MOSFET to drive the LED.
On a 5V Arduino:
5V(power) - 3V(led) / 1800R = 1.11mA
Here we have a high brightness Blue LED @ 1mA on pin 53 of a MEGA.
NOTE: A P-channel by itself won't work with 12V because in order to turn if off Vgs needs to be zero and that means you need a 12V control signal to turn it off.
@LarryD I guess this is where I get confused. I know I can drive a 5V 20mA LED directly, but the ones I am working with come with a very limited description of "Built-in resistor; 12V can be used". They are advertised as 12V LEDs. Will there not be a problem when connected directly to the Arduino on one of the Digital Pins?
Thanks.
NOTE: A P-channel by itself won't work with 12V because in order to turn if off Vgs needs to be zero and that means you need a 12V control signal to turn it off.
@DVDdoug Thanks for chippin' In. I've read on most posts here to avoid P-Channel as they can cause many Headaches; so I've been focused on N-Channels only. Thanks again.
Some time back I was using some LED RGB strips. I just used a common FQP30N06L for the MOSFET which is an N Channel logic level MOSFET.
All you need is a single channel rather than three. Also not shown is a gate resistor and you can add a 220 ohm gate resistor.
Ron
-
Okay, we will assume you will be using your 12v LED/resistor assemblies.
-
Any of the MOSFETs in the PDF will work.
-
For ease of handling, and low Vgs operation, suggest the IRF3708, about $1.50 each.
Useful in others projects too.
You might want to put heat shrink tubing on the TO-220 case to prevent accidental shorting of the Drain.
Sold American! I'll get these ordered and test them right away. I'll also order the 220 ohm resistors for the gate/digital pins, and also you mentioned a 10k to keep the LEDs off when the Arduino is powered on, correct?
The idea behind the 10K resistor Gate to Ground (source) is so when the gate signal is 0 volts the gate turns off rather than float. The MOSFET has a capacitive gate input and when the gate signal is removed we don't want the MOSFET to remain On.
Ron
-
Yes, when the Arduino powers up, GPIOs are in a HIGH impedance state, > 100meg ohms, essentially floating.
Leakage currents can cause the pin voltage to increase to a HIGH level which can turn on a MOSFET attached to that pin. -
The 10k bleeds off this voltage keeping the pin low i.e. at the zero volt level keeping the MOSFET OFF.
-
After power up time, your code in setup( ) makes designated pins OUTPUTs and makes them logic LOW with a digitalWrite( ).
-
All this is done so at power up time, the MOSFET doesn’t turn ON prematurely.
5V can be used too.
Why not see how they look?
Or you can rush and buy more stuff.
I just tested wiring the Annunciator directly to a Digital Pin on the Arduino...honestly...it looks really good. Lights up perfectly. Will this affect the life expectancy of the LED in anyway or is it safe to run it at 5V?
-
Life will be the same or longer.
-
It is safe to run at 5v.
For your documentation, measure the current that flows when the LED is ON.
Awesome. Thanks to all for the advice, references and documents. I'll make sure to pass the info along to help others and keep you all updated.
Thanks again for your time.
You can use a BS270. TO-92 package, a little smaller than the TO-220
Only $0.35 each for a quantity of 10
You can use a BS270. TO-92 package, a little smaller than the TO-220
Only $0.35 each for a quantity of 10
@jim-p Thanks! Will definitely read about these as well. Thanks for the contribution.