Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

An easy question about MOSFET circuit

Status
Not open for further replies.

ozgur84

Member
Hi all,

I built an easy circuit on a breadboard with IRF520 which works different than I thought. I simulated the circuit with proteus but it shows the same behavior.

When I power the circuit, LED lights up regardless of an applied voltage to the gate. In my opinion, The LED has to light up, only if a voltage is applied to the gate.

As far as you see in the question, I am a beginner to electronics. The circuit is below. What am I doing wrong here?

Mosfet.jpg
 
hi oz,
The Gate is 'floating' use a 100k or a 1 megohm resistor from the Gate to 0V
E
 
hi oz,
The Gate is 'floating' use a 100k or a 1 megohm resistor from the Gate to 0V
E

Hey, Thanks a lot, it works in the simulation, however, I do not have a 1Meg or 100k for my main microcontroler circuit and tomorrow all the stores are closed... Anyway, Merry Christmas..
 
If you are driving the gate from a MCU port pin, you dont need a pull-down resistor. However, the IRF520 requires +10V on its gate to fully turn it on. Your MCU will supply a maximum of 5V (its Vdd voltage). To do this properly, you will likely need to replace the IRF520 with a modern "logic gate" NFET that turns on fully with less than 5V on its gate.

If all you need to do is to illuminate a 20mA indicator LED, then you do not need an NFET at all. What is the real load you are trying to switch with the NFET?
 
If you are driving the gate from a MCU port pin, you dont need a pull-down resistor. However, the IRF520 requires +10V on its gate to fully turn it on. Your MCU will supply a maximum of 5V (its Vdd voltage). To do this properly, you will likely need to replace the IRF520 with a modern "logic gate" NFET that turns on fully with less than 5V on its gate.

If all you need to do is to illuminate a 20mA indicator LED, then you do not need an NFET at all. What is the real load you are trying to switch with the NFET?


Hi Mike,

I build a temperature control circuit for my laptop cooler with an ATTINY85 and the load is the fan of the laptop cooler, there are also some LEDs which are powered by the I/O pins so that I wanted to use a MOSFET for not drawing high currents from the ATTINY. I ordered the IRF520 because they were in the arduino starter pack and I knew that I could use the MOSFET as a relay. What could be a possible NFET, could you give me a part number? I can replace it before it is too late.

Cheers
 
The IRL520 from DigiKey has the low-voltage gate drive (L is for logic gate).

The I/O port pins on most modern MCUs can source or sink 25mA directly. The best way to drive an indicator LED (~20mA) from an MCU port pin is to write the code so that you drive the port pin low when you want to light the LED. You wire the LED and its current-limiting resistor from the port pin to +5V (same as the MCU VCC pin). Current flows from +5V through the LED and is being sinked (sunk?) into the port pin to ground.
 
The IRL520 from DigiKey has the low-voltage gate drive (L is for logic gate).

The I/O port pins on most modern MCUs can source or sink 25mA directly. The best way to drive an indicator LED (~20mA) from an MCU port pin is to write the code so that you drive the port pin low when you want to light the LED. You wire the LED and its current-limiting resistor from the port pin to +5V (same as the MCU VCC pin). Current flows from +5V through the LED and is being sinked (sunk?) into the port pin to ground.

Damn, I could have ordered IRL instead of IRF, if I knew... The LEDs are not the problem but I wanted to power the fan at least over a MOSFET instead of powering it over the MCU. But I have chosen the wrong FET.

One last question, I still need the resistor between the gate and 0V as Eric said, if I use the IRL 520, right? (Note: The gate is controlled by one of the I/O pins of ATTINY)
 
Last edited:
...
One last question, I still need the resistor between the gate and 0V as Eric said, if I use the IRL 520, right?

Nope. The port pin can actively drive the gate low or high. The electronics behind the port pin inside the MCU can both source and sink current.
 
Nope. The port pin can actively drive the gate low or high. The electronics behind the port pin inside the MCU can both source and sink current.

ok, that's great! I will replace the MOSFET with a Logic-Level NFET(IRL520 if possible) and hopefully it will work :) Thanks a lot!
 
The value of the resistor that Eric suggested is not critical. If you are switching to a battery, anything more than 100 Ω will work; although I suggest you stay at greater than 1000 Ω.

John
 
Even though the controller will drive the pin low, I would still use the resistor to cover the period when the power is already on, but the controller hasn't started yet. I learned this the hard way :) Use the biggest resistor that you have. Smaller resistors will needlessly waste energy.
 
ok, that's great! I will replace the MOSFET with a Logic-Level NFET(IRL520 if possible) and hopefully it will work :) Thanks a lot!
hi oz,
A basic requirement is that when using mechanical switching of a CMOS or MOSFET Gate, is not to let the Gate [or Input pin ] 'float' when the mechanical switch contacts are Open. A high value resistor from the Gate to 0V will 'tie' the Gate to 0V when the contacts are Open.

I would agree a logic level Gate, MOSFET would be more suitable for your App.
E
 
Thank you for all the information guys.

If I summarize (correct me if I am wrong); for the mechanical switching is used with a MOSFET, a resistor between the gate and 0V is necessary to avoid the gate floating and avoid keeping the drain-source on when the switch is off. The value of the resistor can be 100ohms to 1Meg-ohms, but as far as the power is concerned, the bigger the resistor value, the lower the power consumption.

The resistor is not always necessary when the gate is controlled by a microcontroller I/O pin, but still can be used to avoid floating at the start of the operation.

A logic level MOSFET/N-FET is proper for the microcontroller applications. I have also read that, for the logic level MOSFETs, usually the gate-source voltage (Vgs) is rated for 4,5V or 5V, this can be found at Drain-Source On-State Resistance (Rds) characteristics of MOSFET in the datasheet.

Cheers
 
"By Jove, I think she's got it..."

One minor additional factoid. In the original circuit with the mechanical switch, if the pull-down resistor value is too high, say 10MegOhm, it will take a relatively long time for that resistance to discharge the FET's Gate input capacitance, so the FET will slowly transition through the region where it is partially on, partially off. When FETs are used as switches, to minimize power dissipation (Vds*Id), it is desirable to get through the partially-on region as quickly as possible, so that RC time constant must be considered.

Look at the attached simulation. Due to the unrealistically high pull-down resistor, notice how long it takes to discharge the gate capacitance. Note the power dissipation in the FET (yellow trace). Note that the gate voltage (red trace) looks like an RC discharge curve with a flat spot in the middle. The flat spot is due to the Miller capacitance from drain to gate. The flat spot persists while the drain voltage (blue trace) is transistioning upwards (turning off).

DF50.jpg
 
Last edited:
Great contribution Mike, thanks. So, as far as I understand, a high resistor value cannot always be a wise solution, if high switching is necessary (for example if a pwm is used to switch the gate on and off).

Cheers
Oz
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top