EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Enea on February 23, 2017, 01:50:21 pm

Title: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: Enea on February 23, 2017, 01:50:21 pm
Hi folks,
I would like to use a comparator LM339 to drive a power MOSFET.

If the input voltage is above my threshold  -> gate HIGH - mosfet ON - the motor runs - LEDON ON - LED OFF OFF
If input voltage is below the threshold -> gate LOW - mosfet OFF - the motor stops - LEDOFF ON - LEDON OFF

LEDs are driven correctly.

But Pin1 that drives the MOSFET is LOW and I am not able to drive the MOSFET. WHYYYYYYY ??? What I am doing so wrong ???

For example, VIN = 11V ----> V2 = 9.6V (so the leds work just fine) BUT the pin for the  gate has V1 = 0 !!

Many thanks in advance for your help!!!

Notes.
Yes I am aware the mosfet I use is not a logic transistor who need 10V and proper temperature management ... but is ok in my application even if Vgs is in line with VCC <10V
Title: Re: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: Andy Watson on February 23, 2017, 02:00:53 pm
The output of a LM339 is open-collector, it will only sink current. It needs an external source to pull-up the output.
Title: Re: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: mjs on February 23, 2017, 02:02:17 pm
LM339 like most comparators has an open collector output. Your LEDs work, because they're between VCC and OC output.

Change the R8 to be between gate and VCC instead of gate and GND.
Title: Re: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: RoGeorge on February 23, 2017, 02:02:43 pm
LM339 has open collector outputs, which means it can sink current coming from the V+, but it can not source (generate) current to V-.

To generate a positive output voltage from LM339 (as needed to control a FET), you need to put a resistor between the LM339 output and V+.
Title: Re: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: Codebird on February 23, 2017, 02:37:22 pm
"If the input voltage is above my threshold  -> gate HIGH - mosfet ON - the motor runs"
... and immediately drops the supply voltage, causing it to turn off and your circuit to oscillate in weird and unpleasant manner.

Getting the LM339 to switch a MOSFET is easy, but for your voltage-triggered-switch application you'll need a little hysteresis. Otherwise it'll be unstable.
Title: Re: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: Seekonk on February 23, 2017, 02:44:22 pm
And I'd use that extra comparator to add a time delay.  Any motor turning on will seriously drag down the voltage for a period of time. Don't forget the diode on the motor.
Title: Re: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: Richard Head on February 23, 2017, 02:47:07 pm
Also, all the hash from the motor needs to be filtered with a decent sized electrolytic so it doesn't upset the comparator. Alternatively RC filter just the comparator supply.
Title: Re: Driving a Mosfet with a compartor LM339 ... What I am doing wrong ???
Post by: Enea on February 23, 2017, 05:49:00 pm
Hi folks,
many thanks to everyone for all the answers. Now the circuit works !!!

I appreciated also all the extra tips, and yes the diode was not in the schematic but was included in the project.

 :-+ :-+ :-+ :-+ :-+ :-+ :-+

Thanks all once more !!!