Arduino pinout/mosfet issue

Hi, so I am trying to figure out mosfet. I am new to arduino, and electronics, but I do have a basic understanding of them.

I have 2 questions that I think are related to better understand my issue.

  1. I hooked 2LEDs (series with 330R) to a breadboard. One of the leds directly to 5v rail, and another led to pinout3 of the arduino, and uploaded a blinking program.
    I noticed that the led connected directly to 5v is much brighter than the one activated by the arduino pinout... why? I figured a simple led wouldn't be an issue for a pinout...

  2. I am using the same program, and the same output to "activate" a mosfet, hoping that this time the mosfet won't limit in any way the current that goes though the led(drain), and it will be much brighter... The blinking ocurs, however is less bright than I would manually activate the mosfet (Gate) to the 5v/gnd rail instead of the pinout... I thought the drain current is not affected by the gate current, gate acting just like a switch... I don't understand?!?!

Also, just as a sidenote, I have seen everywhere that the mosfet has to be pulled(up or down - tried both) with the 10kR, however, this lights up the led brightly, and the blinking never ocurs, is like the pulling up is overwriting the Arduino...

This is just a test for a project that eventually will run a 12v solenoid valve (500mA)... but with the limited current... there is no way the valve will trigger. Also, the on/of will be in the range of 50-100 miliseconds, so it has to be very responsive.

I have used IRFZ44N... I also tried IRLB8721, which lights up the led at extremly low intensity...bearly visible.

here is a diagram...

Measure the current of both leds by measuring the voltage across them and dividing by the resistor value and I believe you will find the mosfet driven led is drawing less current. You can increase it accordingly by
adjusting the resistor value:

V=I*R
I=V/R
R=V/I

Did you look at any of the specs for any of the mosfets in their datasheets ?

Do you know the RON,Vgs Threshold , or anything else about them ?

Hint:
If you are truelly trying to learn about mosfets you should post a link to the datasheet in your OP and
begin your post with the question "Which datasheet spec best explains the following behavior ?"

You should not be asking why one led is brighter than another until you have done your homework
and measured their respective currents.

Show us a good image of your ‘actual’ wiring.

IRFZ44N is not a logic level MOSFET, you need a IRLZ44N or such. The IRLB8721 should have worked if connected correctly. Post your code.
EDIT: You ARE using a 5V Arduino, right? :slight_smile:

raschemmel:
Did you look at any of the specs for any of the mosfets in their datasheets ?

Hint:
If you are truelly trying to learn about mosfets you should post a link to the datasheet in your OP and
begin your post with the question "Which datasheet spec best explains the following behavior ?"

You should not be asking why one led is brighter than another until you have done your homework
and measured their respective currents.

Yes, I looked into the datasheets, however, my knowledge is not vast enough to understand all the parameters and the difference between them...

I just wanted to understand theoretically why that happens without getting too much into numbers and formulas, and advanced electronics. The way I understand Mosfet (for now) is very simplistic. It can be used as an electronic switch. as long as you apply a minimum voltage on the gate, it will open the drain to the source... I don't understand how the value of the current on the gate is affecting the current from drain to source, as long as the mosfet is rated for 47 amps ... right?
Wait... is it gate-to-source voltage the minimum voltage I have to apply to fully "trigger" the mosfet?
Because in that case I am definitly using the wrong mosfets...

Still, this doesn't explain why the intensity of the LED changes when I connect the gate to the pin versus if I connect it to 5v.

Maybe I am understanding Mosfet wrongly, and it is not an on/off switch, is more of a "dimmer", depending on the gate?!?!?

Same behaviour if I just connect a simple LED to the pin vs the same LED to 5v...

Could it be that I have a defective Arduino?

the code is the simple blinking code in the Arduino builtin example.

The "actual wiring" is exactly like the one I posted, minus the 10kR resistor, which I mentioned nullifies the blinking and turns the mosfet either on or off, depending on if I pull up or down.

The problem is the Gate needs to be higher voltage for the MOSFET to turn fully on.
Look at the first picture - at 4V Vgs, there is only 0.25mA of current flow.

The 2nd part should work much better, unless you have it miswired. With just 0.013 ohm on on resistance at 4.5V Vgs, it will appear nearly as bright as being powered from 5V directly. But it will be different, as the output transistors, either from 5V to the IO pin, or from the IO pin to Gnd, have some Rds of their own. Some here have calculated it to ne 40. So the LED will see (5V - Vf)/(40 ohm + 330) = 6.7mA if Vf of the LED is 2.5V.
Vs perhaps 7.6mA without the 40 Ohm, tho I don't know if I could see that difference in current as a difference in brightness.

CrossRoads:
The problem is the Gate needs to be higher voltage for the MOSFET to turn fully on.
Look at the first picture - at 4V Vgs, there is only 0.25mA of current flow.

Thanks. That was exactly the answer I needed to better understand the issue.

One last thing. It was mentioned that the mosfet was not logic level. What data in the sheet is a good indicator of that?

I saw a suggestion that it has to have an L in the name , like IRL... however I have seen some switch boards already built for "arduino" that are using IRF540 or IRF520... so I think there's more to that than that letter.

I saw a suggestion that it has to have an L in the name , like IRL... however I have seen some switch boards already built for "arduino" that are using IRF540 or IRF520... so I think there's more to that than that letter.

There is a little more to it than the letter L. However the L is often included in the part number of logic level MOSFETs. Briefly the MOSFET when used as a switch requires a voltage applied to the gate to turn it on. Take a look at the data sheet for a IRFZ44N MOSFET verse the data sheet for a IRLZ44N MOSFET. Among all those characteristics note the Gate-Source Voltage between the two. The logic level IRLZ44N has a much lower Gate Source voltage. In the case of the IRLZ look at the data sheet figure 3. Note the current conduction curve.

Anyway when using a uC with about a 5 volt output to drive a MOSFET using a logic level MOSFET is worth considering.

The IRF 540 is popular because of the low Gate to Threshold voltage as you can see in the data sheet. However, take a look at Figure 7 verse the IRLZ44. The IRF540 was popular only because it has a low turn on threshold, however, with 5 volts on the gate note the current.

Sometimes it's not just a matter of will it work as much as choosing the best component for a given application. :slight_smile:

Ron

The IRF540 is popular because they are long obsolete and cheap as beach sand, some of them are barely cracked open at 5V Vgs, but that's OK if you're only drawing 1 Amp or so for an LED strip or itty bitty motor, try pulling 10 Amps through one.

ok, so after mesuring, and testing, I finally made it work. Apparently it was a matter of pulling down the IO wich I already tried with a 10K and it was overwritting the signal from Arduino... basically the mosfet was stuck in off position regardless of what signals was receiving from Arduino. I switched the resistor to a 470Kohm... and magic... works like a beauty with both types of mosfet. So my guess is the internal resistance of the transistor is higher than 10k? and the signals were going the less resistant route?...

My guess is that you didn't set the pin to OUTPUT with PinMode.
Then a digitalWrite(pin, HIGH) only enables the ~30k internal pull up, which creates a voltage divider with the external 10k resistor, resulting in not enough gate voltage to drive the fet.
Leo..

Not trying to be rude but I would suggest the OP find a nice tutorial for FETs on the net. There are some really good ones out there.

Also if you are just switching on a LED why do you need such a large device. Do you really need a MOSFET? JFETS can be just as useful.

Edit: Just noticed the 500mA requirement. How about using a solid state relay?

Hi,
Can you post your code please?

Thanks.. Tom.. :slight_smile:

int led = 3;
void setup() {
  pinMode(led, OUTPUT);
}

void loop() {
  digitalWrite(led, HIGH); 
  delay(1000);                    
  digitalWrite(led, LOW);   
  delay(1000);                     
}

windoze_killa:
Edit: Just noticed the 500mA requirement. How about using a solid state relay?

any suggestion? The ones I've tried are designed for AC, with DC they latch.

Mechanical relay I won't trust for this project. need quick response (25-100 ms)

PVT212, can do AC or DC, up to 825mA
I have 8 on a board to drive 8 different loads.
This is a high power LED, with 700mA rated power supply.
TPIC6C595 shift register to sink current on the input side.

The one you listed will work fine at 12V. That is just the switched side. Also if you want something a bit smaller try this.

raschemmel:
Measure the current of both leds by measuring the voltage across them and dividing by the resistor value and I believe you will find the mosfet driven led is drawing less current.

Measure the current ... by measuring the voltage across the resistor and dividing by the resistor value

I might have been have typed that on my phone in haste...
You knew what I meant and the OP never did it
anyway so I guess nothibgl lost...