# Need help driving N FET gate from LM393 comparator output

I am working on a charge controller circuit idea I had. The circuit 'works' meaning it achieved desired output voltage but the fet doesn't seem to be turning all the way on so lots of heat is generated.

I am using an LM393 dual comparator to measure the voltage at the junction of the zener and series resistor R1, compare it to the voltage at the - pin of the capacitor, and switch the enhancement mode FET on and off accordingly. I built the circuit on a breadboard and was elated when I measured the output and was able to connect a solar panel and battery. The fet needs about 5v at the gate. For some reason i only measure 2 or 3 v at the gate. Can you drive this FET direct from the output pin of the LM393 directly or will I have to amplify the output somehow to make sure the fet turns all the way off and on? Also, I am powering the LM393 directly from the input. I wonder if that could be a problem. Am I going about this all wrong? Any help would be much appreciated. It 'works' but wastes power by the fet presenting resistance. Please take a look.

Input is 16.5 v PV panel
zener is 12V
output is 12v lead acid battery
R1 is 1k, R2 has been 3k and 10k
The FET is a typical enhancement mode N channel, RL2203N or RFP50N06

-
 The link to the pic doesn't work for me. You'll want a hysteresis in your comparator, otherwise it may switch on and off all the time if the input voltage is near the zener's voltage. – stevenvh Apr 11 '12 at 13:36 Thanks steven, link should work now. Is there any harm in waiting until i get the fet turning on all the way first? Also whats the best way to add hysteresis? Im a little new with comparators. – Destin Dorman Apr 11 '12 at 13:44 Adding Extra Hysteresis to Comparators. You add part of the comparator's output to its non-inverting input, so that the voltage at the input is a bit higher or lower, depending on the comparator's output. – stevenvh Apr 11 '12 at 13:54 Looks basically OK. BUT saying "typical ehnancement ..." totally destroys the value of your circuit as it is an unknown "black box" that could be ideal or useless. Part number please. I think hand drawn diagrams are fine (I would :-) ) if neat and tidy and readable BUT use a ruler or square. LM393 – Russell McMahon Apr 11 '12 at 13:57 I tried an RL2203N as well as a RFP50N06, I have a ton of em. – Destin Dorman Apr 11 '12 at 14:01
show 1 more comment

This doesn't answer your question about the low gate voltage, but I want to explain the hysteresis I suggested in comment you might add.

Suppose the diode ladder creates a voltage difference of 10V, then the inverting comparator input is at 6.5V. Also let's start with the situation where the capacitor is fully charged to 16.5V, then the non-inverting input is at 0V. So output is low, FET doesn't conduct, and C1 is allowed to discharge through its load. When the voltage across C1 becomes 9.99V the non-inverting comparator input becomes 6.51V and the FET starts to conduct, so that C1 gets charged. This means $V_{OUT}$ will start to decrease, falling below 6.5V again and the FET will switch off again. Charging will stop, and C1 will again discharge until it reaches 6.51V again. Same things happen: FET switches on, $V_{OUT}$ will descrease and FET will switch off again. And so on.

That's the theory. I made my comment before I had seen your schematic, based on the description. Now since you charge C1 over a very low resistance its voltage may go pretty low before the FET switches off again, but things may also occur as described above.

What can you do about it? This is where the hysteresis comes in. Like I said you add part of the comparator's output voltage to the non-inverting input. Place a resistor between $V_{OUT}$ and the non-inverting input, and one between the output and the input. Now if the FET is off the output is low, and the resistors will form a divider, so that the non-inverting input sees only part of $V_{OUT}$. That's your comparison level. You'll have to adjust the reference voltage on the other input. Say that you're now comparing with +5V. OK, C1 discharges until it reaches 5.01V. Output becomes high and C1 starts to charge. Now this is important, via the resistor divider the high output will set the non-inverting input to a level much higher than the 5.01V. This means that the output will remain active for a longer time (C1 voltage has to charge all the way down to 5V). This will ensure that C1 gets fully charged via the FET's internal resistance, before the FET gets shut off again.

-
 Excellent explanation. – Federico Russo Apr 11 '12 at 15:12 All true, except that because there's no inductor in the circuit, the switch is going to charge the capacitor all the way to the supply (or at least partway to the supply depending on FET on-time) and cause a surge current from the supply, rather than regulating the output smoothly. – Jason S Apr 11 '12 at 15:25 Awesome answer! Thanks. As i said I will post any updates. – Destin Dorman Apr 11 '12 at 15:27 @Jason - Comparators in general are fast (way faster than opamps). How quickly C1 charges will depend on the FET's $R_{DS(ON)}$ and the gate's capacitance. – stevenvh Apr 11 '12 at 15:31 Sure, exactly. But my point is, that this behavior probably isn't what the OP wants. What circuit element limits the current through C1, if the FET gate is turned fully on? If the supply has a very low impedance, the FET is in its constant current mode (NOT Rdson) and dissipating a lot of power. If the supply has moderate impedance, the FET is acting as a low Rdson switch, and will cause the supply to sag while it's charging up the capacitor. Either of those alternatives are undesirable. – Jason S Apr 11 '12 at 15:58

The problem you're running into is that you're using negative feedback around the comparator: the MOSFET effectively inverts its gate signal (increase in gate voltage causes decrease in drain voltage), so feedback into the "+" pin actually creates negative feedback instead of positive feedback.

Negative feedback is great for regulation (probably your idea) but not what you want if you want switching behavior rather than linear behavior.

I suggest you keep negative feedback as an outer loop but use positive feedback as an inner loop.

One way to do this fairly easily is to split up the input into the comparator "+" input as follows:

• For DC/low-frequency negative feedback (outer loop), connect the "-OUT" node to "+" via a fairly high-value resistor Rfb (e.g. 100K or 1M) -- be careful here though because LM393s are bipolar so beware of bias current. You may choose to use a CMOS comparator such as a TLC393 instead, or put a similar resistor in series with the comparator "-" node to balance the input impedances.

• For high-frequency positive feedback (inner loop), connect the comparator output to the "+" node via a series RC circuit. The value of C is chosen so that Rfb*C gives you a crossover time T (= 1/2/pi/frequency); the value of R is just to make sure that the "+" node doesn't get whacked and damaged, so a 1K resistor should be fine.

The crossover time T roughly corresponds to a switching period in PWM -- this is sort of a hysteretic controller rather than a fixed-frequency switching controller, but it's the same idea. (It should be chosen so it's not too high.)

Because you'd be running in a switching mode rather than a linear mode, you'd also need inductance somewhere in this circuit (presumably between FET drain and "OUT" node), otherwise a FET switching fully on across the capacitor on the output will cause large surge currents. And you'd also need a freewheeling diode to conduct the current when the FET switches off.

If you do really want linear behavior, use an op-amp rather than a comparator.

Good luck!

-
Thank you very much. I will post any updates. Also how am i reinventing the charge controller exactly? Is there an easier way to go about this without buying a controller? – Destin Dorman Apr 11 '12 at 14:42
? I didn't mention reinventing the charge controller; that was Russ's comment. – Jason S Apr 11 '12 at 14:45
If by linear you mean the fet would be partially on at times, i want to avoid that. I want it full on or off to avoid a lot of heat dissipation. I figured the circuit would just switch however fast it needed to....im not exactly clear on why the fet gate voltage is low though. – Destin Dorman Apr 11 '12 at 14:51
Because you're apparently presently in linear mode at a point of stable equilibrium. The comparator isn't acting like a comparator, it's acting like an op-amp because there's negative feedback. (increase in comparator output causes increase in gate voltage causes decrease in drain voltage causes decrease at "+" pin which causes decrease in comparator output causes decrease in gate voltage etc.) When FETs are in their linear mode, the gate voltage is small; they're not fully turned on, just on enough to let the appropriate amount of current flow. – Jason S Apr 11 '12 at 15:06
Not a typo. Right now -OUT is connected directly to "+". I'm just saying to create two feedback paths, one analogous to what's happening now, with a resistor inserted, the other feedback path is new. "This is going to be basically a switch-mode converter". Yes, in my opinion, either this circuit (as is) should be fixed to be a linear regulator, or it should be fixed to be a switch-mode converter, or it's a circuit with errors. – Jason S Apr 11 '12 at 16:10

Looks basically OK.
You need to know what you are trying to do.
what this tries to do is limit battery voltage to that of zener + diode string ~= 14.5V. This is OK in some circumstances but too high for normal use.

The fact that FET gate voltage is low suggests that you are not doing as circuit shows. You need some sort of load to test this - battery is OK.

This sort of circuit must either be wasteful or turn on an off hard at limit. Battery will droop when power taken off so will turn on and charge and then power off and drop and.
To add hysteresis add a resistor say R3 = 1k from -out to opamp non inverting and then a resistor R4 from opamp out to opamp non inverting. Value relative to R3 controls hysteresis voltage swing. Maybe 10k- 47k range. Pot may be best.

You are re-re-re-reinventing the solar battery charger wheel. You need to have a good reason to do so. Have you?

Show all component values on diagram. Saying "typical ehnancement ..." totally destroys the value of your circuit as it is an unknown "black box" that could be ideal or useless.

I think hand drawn diagrams are fine (I would :-) ) if neat and tidy and readable BUT use a ruler or square.

providing links to datasheets is desirable. LM393 datasheet here
LM393 is open collector so R2 is gate drive source.
Vin can not go closer than 2V or so to Vdd but your powering looks OK.

Zener plus diodes is strange - unless it's all you have. Vzener+diodes ~= 14.5V+. Could be 15V+. Better to use a zener only or a cheap semi precision reference such as a TL431.

Resistor of maybe 1k from out- to ground may help cct behave when no load present.

~

-
 Thanks everyone. One thing: I didn't think i was 'reinventing' anything. Perhaps someone could enlighten me on another way to do this without using a dummy load. – Destin Dorman Apr 11 '12 at 14:28 I tried a resistor from out to gnd. Thing is the lm393 outputs low only, that is when the output is high the only source for positive voltage is the pull up resistor. So the gate gets grounded everytime the output is low. – Destin Dorman Apr 11 '12 at 14:32 I was using YOUR terminology. Ot- = load-ve terminal = MOSFET drain. If MOSFET is off and there is no load the comparator inverting input floats and may cause mal-operation by floarong into forbidden common mode range near Vcc.Comparator MAY work well when Vin is > Vcommon mode in idle state but maybe not. – Russell McMahon Apr 11 '12 at 14:55