Go Down

Topic: PWM with transistor and mosfet (Read 7953 times) previous topic - next topic

ibourdon

Oct 17, 2011, 07:13 pm Last Edit: Oct 17, 2011, 07:36 pm by ibourdon Reason: 1
Afternoon guys,
So I went away from my 5940's which did not have the current capacity I needed and am currently using IRF510 mosfets to power my LEDs.
These are rated @ 5.6A and 100V.
I cannot seem to get PWM working through this setup while allowing full brightness of my LEDs. If I just digitalWrite them high and low they are full power, then when I try to analogWrite they will not pwm at all just stay on full with intermittent quick flash as if it went on/off extremely quickly.
I can only get the pwm to work when I put a resistor on the FET gate to common ground, but then the are only about 1/4 bright if not less. Have tried resistor values between 2.2k - 10k with no difference.

current setup:

Arduino > NPN Transistor gate (collector connected to external +12v, emitter connected to FET gate) > FET (mosfet source connected to common ground, Drain connected to LED negative side. LED positive side connected to external +12v.

very simple code just to make sure things work as they should.
Code: [Select]
int fadevalues[] = {0, 2, 6, 8, 11, 16, 23, 32, 45, 55, 64, 78, 90, 109, 128, 140, 162, 181, 200, 222, 255};
const int led1 = 10;
const int led2 = 11;

void setup()
{
 pinMode(led1, OUTPUT);
 pinMode(led2, OUTPUT);
}
void loop()
{
 for (int i=0;i<20;i++)
 {
 analogWrite(led1,i);
 analogWrite(led2,i);
 delay(100);
 }
 for (int i=20;i>0;i--)
 {
 analogWrite(led1,i);
 analogWrite(led2,i);
 delay(100);
 }
}

Grumpy_Mike

Quote
am currently using IRF510 mosfets to power my LEDs

These are not logic level FETs so you need 10V to turn them on fully.
Use a logic level FET.

Magician

Modify your hardware setup:
arduino - resistor - base npn transistor;
emitter npn - ground.
collector npn - resistor - +12V;
collector - gate MOSFET;

ibourdon

Yes sir grumpy, I know they are not logic level thats why I'm running them off of the transistors. Yet even with the transistors switching +12v I can't get the full brightness with this setup and have PWM ability.

Magician:
If I put +12v to the transistor collector and then run the mosfet gate to the transistor collector wont it just get a solid +12v at the gate not allowing for pwm?

Grumpy_Mike

You are not using the transistors correctly. As you describe it you will only ever get +4.3V on the FETs gate.

Re read what Magician said again. You had an emitter follower circuit you need a common emitter circuit.

You fooled me by saying there was something going into the transistor's gate, as a transistor has a base and a FET has a gate, you had made a mistake. I guessed at the wrong one.

ibourdon

#5
Oct 17, 2011, 10:02 pm Last Edit: Oct 17, 2011, 10:13 pm by ibourdon Reason: 1
My fault, I will give Magician suggestion a try.


~EDIT~

I hooked up the circuit as you wrote Magician and I get full brightness but no PWM.

By collector - gate MOSFET; you mean NPN collector to MOSFET gate correct?

Grumpy_Mike

If you get full brightness but no PWM then you still have not wired it up right yet.

Magician

Yeas, check wiring again, is ground connected properly:
arduino gnd - emitter npn - source FET -  -12V power supply all together?
Or post your schematics / hand drawn picture .

ibourdon

Well, I must be looking over something small thats messing me up cause I have checked the wiring multiple times and have found nothing wrong. Even had an EE friend take a look and he said it looks right.

Its funny cause without the resistor from the FET gate to ground it works full brightness but no pwm.
When I have a resistor from the FET gate to ground no matter what size pwm works but with no brightness.

Hopefully one day I will get a hang of these dang circuits. These are supposed to be easy too, Im just wiring up LEDs for gosh sakes.

Excuse the crappy schematic, my first time using Fritzing.

Grumpy_Mike

Those resistors are in the wrong place as we keep telling you!!!

The resistor should be from the collector to +12V. The gate should go to the collector as well. The emitter should go to ground as should the source.

Quote
Even had an EE friend take a look and he said it looks right.

Not much of an EE is he?

Magician

Here you are:
http://www.neufeld.newton.ks.us/electronics/?p=133

Have you a current limiting resistors in series with leds or it's 12V led strip with resistors build in?

ibourdon


Not much of an EE is he?


Looks that way eh..

Hooked it up exactly like the schematic and how yall have said. Still no luck. Going to try a different breadboard, seems I have no luck with breadboards.

runaway_pancake

Perhaps this will help --



When the Pin is Low, the Gate is High and the FET is On.
When the Pin is High, the Gate is Low (at Gnd) and the FET is Off.

You could look into using a "FET driver" IC, but you should try and get this much right first.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

ibourdon

Thanks for the help guys. Not sure where I'm going wrong. this is very frustrating, still have not got that circuit going properly.
So I went out and got some logic level mosfets, using Fairchild FDP7030BL n-channel mosfets now.

I hooked up the circuit and was getting PWM yesterday but now today when I hook it up I get just constant full brightness no pwm.

Have a 2k2 across the gate and source on the mosftet then the gate of mosfet attached to pwm pin, source of mosfet attached to ground and drain to - side of LEDs with an external +12v to + side of leds. Grounds are together.

ibourdon

Changed the mosfet to an IRFIZ34EPBF and it works. WTF? Only thing changed was the type of mosfet. Tried multiples of the other and nothing.

Go Up