Help with a mosfet problem

Thread Starter

dumle29

Joined Jun 26, 2011
45
Hi, so i have tried making a RGB controller using an arduino µcontroller, and 3 IRF540 mosfetts.

I have made this schematic:


what i forgot in the schematic, is that i have a 10k resistor from the gate to ground to pull it low, and the resistor is a 330 ohm resistor

so my problem, is this:

i apply power, and all the LED´s turns on, even if i directly connect a gnd lead to the gate of the mosfett´s nothing happen, the LED´s just keep on shineing. however, if i apply the +12 volts from the powersupply, the corrosponding color that is connected to that mosfet shines a tad bit brighter. enough to see which color it is.

what have i done wrong here? ran into the same problem once before, controlling a computer fan, and have only been working with BJT´s till now.
 
Last edited:
You have drain and source mixed up. Connect source to ground, LED to drain with the triangle pointing downward and the resistor for the LED between the led and the 12V supply.
 

Audioguru

Joined Dec 20, 2007
11,251
Your Mosfet's drain and source pins are backwards so the body diode in the Mosfet conducts all the time.

Your transistor is an emitter-follower so its emitter high voltage is +4.3V instead of +12V.
The Mosfet needs a gate to source voltage of 10V or more to fully turn on.

I corrected your circuit but the logic is reversed. Add another transistor and collector resistor for it to invert the logic.
 

Attachments

Thread Starter

dumle29

Joined Jun 26, 2011
45
thanks, so not having many parts, and trying to fix this with what i have, what is the reason for changeing the logic? (easily changeable in the programming, not a problem)

also, why a 10k on the basepin? could i use the 330 ohm one i do as of now? Also googleing emitter follower i found out its some sort of a circuit, not a type og transistor (am i completly off here?).

and would this work sort of (with dimmer LED´s) if i just switch the drain a and source around?

i understand that somehow, the way im doing it, the transistor only supplies 4,3 volts for the mosfet. Would a PNP be able to be used in place of the NPN ive got right now? Im using a BC547.
 

Audioguru

Joined Dec 20, 2007
11,251
What is the reason for changing the logic?
Because the transistor is a switch that inverts now. It wasn't a switch and did not invert before.

Why a 10k on the basepin? Could i use the 330 ohm one i do as of now?
The transistor needs a base current that is about 1/10th its collector current. the collectror current is 11.9V/2.2k= 5.4mA. its base resistor can be 4.3V/0.54mA= 8k ohms but 10k is fine.

Googleing emitter follower i found out its some sort of a circuit, not a type of transistor (am i completly off here?).
Its emitter signal is the same amplitude as its base signal, minus 0.7VDC.

Would this work sort of (with dimmer LED´s) if i just switch the drain and source around?
Then the Mosfet gets a gate voltage of only 4.3V which is not enough for some of the Mosfets. The Mosfet is spec'd with a gate to source voltage of 10V or more.

I understand that somehow, the way im doing it, the transistor only supplies 4,3 volts for the mosfet. Would a PNP be able to be used in place of the NPN ive got right now? Im using a BC547.
No because a PNP would need an input signal that goes to +12V for it to turn off. Your signal signal from the microcontroller only goes as high as +5V.
 

Thread Starter

dumle29

Joined Jun 26, 2011
45
okay thanks alot, just learned two things in never knew about transistors, Thanks :D
 

russpatterson

Joined Feb 1, 2010
353
Like Experimentor said, a logic level MOSFET makes things much easier. I drive them with 5 Volts right off my uC pin. Just put a current limiting resistor between the uC pin and the gate so it doesn't source more current than the pin can supply (something like 300 Ohms, R1 in the picture).

Here's a circuit I use all the time for driving motors and LED's. Just leave off D2 if you're not driving a motor as it's not necessary for non-inductive loads. Just connect your supply voltage to the Anode of your LED's and the LED Cathode to the Drain of your MOSFET. I like the IRL3714ZPBF, not the cheapest but has low rds On resistance and can be controlled with 5V on the gate. I've run large banks of LED's with these, 12V and 24 Amps, without problems.
 

Attachments

Thread Starter

dumle29

Joined Jun 26, 2011
45
Could i use a 10k resistor on the collector of the BC547 and then use a 330R resistor on the base? even though thats way more current on the basepin than needed, wouldnt that work?
 

Audioguru

Joined Dec 20, 2007
11,251
Could i use a 10k resistor on the collector of the BC547 and then use a 330R resistor on the base? even though thats way more current on the basepin than needed, wouldnt that work?
A Mosfet has a high gate to source capacitance. When the base is driven with a resistor with a high value like 10k ohms then the capacitance takes a long time to charge from the resistor.

Do not use a 330 ohm resistor to feed the base because then the current is almost the maximum allowed current from a microcontroller.
 

Thread Starter

dumle29

Joined Jun 26, 2011
45
Thanks a lot for your help, would i be able to PWM the gate of the FET with a 500Hz signal, if i used a 10k resistor? My problem is that i have a hard time to get components. Where i live, theres 10 km to where i can get parts, and since im 17 (and cant get a car) i dont really feel like riding 10 km on my bike in -8 °C for 3 resistors :/

About the current on the µcontroller pins.
Im using a ATmega328 for this, which has a absolute max of 40 mA on each pin, so 15 mA is fine for me :)
 

Audioguru

Joined Dec 20, 2007
11,251
Thanks a lot for your help, would i be able to PWM the gate of the FET with a 500Hz signal, if i used a 10k resistor?
With a resistor as high as 10k ohms then the gate voltage of the Mosfet will ramp up too slowly for a frequency as high as 500Hz. Even the 2.2k resistor in my sketch has a value too high because I selected it for a Mosfet that turns on and turns off occasionally.
Usually two transistors drive the gate of a Mosfet with plenty of current to quickly charge and discharge the gate capacitance like this:
 

Attachments

Thread Starter

dumle29

Joined Jun 26, 2011
45
oh, thats why i should have started with making this on a breadboard...

so i think i will just pick up 3 logic level mosfetts whenever i buy parts the next time :/

the other schematic looks too complicated
 

Thread Starter

dumle29

Joined Jun 26, 2011
45
so i ended up buying a bunch of logic levet fets, and they work nicely :)

thanks for you help though. It will come in handy when im gonna make a H-bridge controller for me and my pals electric racer :p
 

Thread Starter

dumle29

Joined Jun 26, 2011
45
Oh. I had started thinking about the voltage to apply to the gates, and am i correct to say 12volts will be too little to apply to the high side FETS when switching 36 volts?

Should I start looking at p-channel fets for the high side? Or could I apply 48v to the gate, without blowing the FET since the Vgs then would be 12-13 volts? Or would the Vgs start at 48v before the FET opened?
 
Last edited:

Audioguru

Joined Dec 20, 2007
11,251
Why are you now talking about switching 36V?

A door opens and closes. But a Mosfet turns on and turns off.

Look at the absolute maximum allowed gate to source voltage of your logic level Mosfet on their datasheet.
 

Thread Starter

dumle29

Joined Jun 26, 2011
45
im sorry, its another thing. Me and my friends are making an electric car thing. The max Vgs is 20v. My question is, will the Vgs then start out at 48v, since the FET isnt yet on, or will it be 12v, since the source potetial will be 36v?
 

Audioguru

Joined Dec 20, 2007
11,251
If you use an N-channel Mosfet then connect the motor between the drain and the positive supply voltage. If the Mosfet is a logic-level one then when the gate is +5V the Mosfet is turned on and when the gate is near 0V the Mosfet is turned off.
 
Top