!!!The MOSFET in the given circuit is N-Channel - i changed mine accordingly (put the LED on the source-side of the MOSFET).
The Arduino is powered by USB - but has a common ground with the circuit.
The circuits V+ is 3.3V.
The code to drive the MOSFET is the Blink-Demo from the Arduino examples.
And here is the Problem:
When the Arduino triggers the MOSFET the Led changes their intensity (alternating to the debug Led on the Arduino -> p-channel has switched logic) correctly, but it never turns off completely!
As i can see the circuit does the job - but the Led still lights a tiny bit when in should be turned off. If i change the voltage, the brightness in the Led-off-State changes, too.
I found this problem in one other related Post - but no solution was given...can you help me to turn off my evil Led?
You need one more n-channel mosfet or BJT transistor to drive p-channel mosfet: http://ruggedcircuits.com/html/circuit__11.html
How much current your led's consume? Probably it would be easier to use just BJT or ULN2003 driver.
Magician:
You need one more n-channel mosfet or BJT transistor to drive p-channel mosfet: http://ruggedcircuits.com/html/circuit__11.html
How much current your led's consume? Probably it would be easier to use just BJT or ULN2003 driver.
Additional N-channel mosfet is not needed! Just pulling the P-chan mosfets gate to the ground (ie the avr can send a digital low) should be sufficint to switch it on. http://ruggedcircuits.com/html/circuit__16.html
You are right, it's sufficient to turn it on. But the problem is to turn it off...
When arduino send "high" - 5V, there would be still voltage between source-gate equal :
Vsg = Vleds - Vhigh
Circuit #16 is o'k till Vpower = 5V. If it goes up (12V or higher for a few leds) the would be an issue
Magician:
You are right, it's sufficient to turn it on. But the problem is to turn it off...
When arduino send "high" - 5V, there would be still voltage between source-gate equal :
Vsg = Vleds - Vhigh
Circuit #16 is o'k till Vpower = 5V. If it goes up (12V or higher for a few leds) the would be an issue
How about connecting the r3 resistor from the gate to the ground, instead of the current configuration in which it is connected to the positive. That way the p-chan is always on, but when the arduino send a digital high, it wil the gate will be pulled high and it will be switched off.
Source of the p-mosfet connected to +Vleds, and what making mosfet to conduct is difference between Vgate and Vsource.
Vsg = Vleds - Vhigh
Vhigh (max 5V, real 4.4V) , mosfet will be conductive if Vgs > 2 - 3 V(depends on type of mosfet), or if we turn it around when Vleds > 4.4 + 2 ... 3 V ~= 6.4 ... 7.4V
Hi again!
Thanks for your ideas!
I tried Circuit16 (the first one) but the result is the same - in fact it doesn't matter weather i pull the gate low or high :~
...and what making mosfet to conduct is difference between Vgate and Vsource.
Is it possible that my Led power consumption is to low to get the MOSFET triggering off again? Could you explain this difference-thing again? I read Wikipedia twice and watched some nice Video-Tuts - but i didn't get the point yet, i guess.
How much current your led's consume?
The Led needs about 3.3V and 20mA. The further plan is to set up an Led matrix, controlled by MOSFETS on each row and column to get each Led adressable.
Note the source is connected to the 12V supply and the drain to your load. The gate is connected to the +12V supply so normally it is off. When the gate is connected to ground the FET turns on. That is the job of the transistor. You can't connect the gate directly to the arduino pin because it will only supply 5V which is not enough to turn the FET off.
Is it possible that my Led power consumption is to low to get the MOSFET triggering off again
I build it (with a transistor - as you described) as given in Circuit11 but it's still the same - the led just dims a little bit when it should be turned off. Im quite new to all this as you probably see - perhaps i'm just doing the same mistake over and over... =(
The alternating connection between GND/V++ and the Gate can be measured by a circuitanalyser - but the MOSFET does "anything??"...
I also understand why there is an transistor for triggering the MOSFET but i don't get it why the Led isn't turned off completely...
OK forget the arduino and the transistor, just have the resistor between gate and 12V, with the source to 12V and led & resistor between drain and ground.
If the LED is still not off then you have blown up the FET and need to get another one.
Then dab a wire from the gate to ground. The LED should light up fully. If not again you have blown up the FET.
Alternatives to having blown up the FET are that you have miss identified the FET connectors or wired it up wrong.
Ok - i feel cheated by a little piece of silicon
I tried grumpy_mikes "direct way" and NOTHING HAPPENS?! I tried it with 5 different MOSFETs of the same type....so blown up is nearly impossible. I checked the datasheet twice - it's quite hard to misunderstand the Gate-Drain-Source diagram... Intelligent Power and Sensing Technologies | onsemi - perhaps sby can lift the secret of my weird MOSFET.
And the strangest thing at last - it DID some kind of triggering with the arduino! But none when it's connected directly?! I'm so confused...gnah - why it's always depressing when it starts to be interesting....
Sry grumpy_mike for my highly unprecise answer!
I took 2 pictures of my circuit to make things easier! - Take a look at the attachment...
These show the wireing of the FET and the Led. The pictures were taken at 12V.
Interesting about this: It doesn't matter if the Gate (leftmost pin i suppose -> datasheet) is positive or gnd!
Datasheet and FET are the same! I checked this again...
I hope the pictures will help! I suppose it's exactly as you say...
often the problem is not actually where you are looking
TO220 MOSFETs are G-D-S from left to right. The one in the picture is wired with drain and source swapped so that the integral diode is forward biased and taking the current. The gate cannot do anything about that!
Hey you all!
This was the solution!!! - and a fairly embarassing mistake of me
I also figured out that my MOSFET ist not working on logic level - so i will have to put a transistor before...
Thanks a lot to all the people giving a helping hand!