enter image description hereenter image description hereI want to make a discharger for 18650 batteries so I can store them at a specific voltage.

I built a comparator (LM393) with a voltage reference to 3.8V at the inverting input and the voltage of the battery on the noninverting input. The circuit has its own power supply (9V battery). Grounds are connected.

The comparator works fine, but when I connect it to the gate of the mosfet, its output voltage drops from around 9V to just 1V or so.

Also when I disconected the power from the Drain, the voltage appeared again.

I am using a pullup resistor on the output of the comparator (10k, tried 1k and it was the same). I also tried to put the load (5V 5W resistor) on the Drain or on the source, both worked the same. The mosfet can be opened, but the voltage on the non inverting input must be around 6V instead of the 3.8 and higher. And when I apply the higher voltage, at some point the mosfet opens and the voltage on the non inverting input drops to that 3.9V. The mosfet is IRLZ44N.

Please tell me what's going on and what I am doing wrong. enter image description here

  • 2
    \$\begingroup\$ Use the tool, edit your question and draw a schematic with the tool. Thanks \$\endgroup\$
    – Voltage Spike
    May 21, 2019 at 18:18
  • 1
    \$\begingroup\$ yes! You probably built something pretty clever, but I really don't know what – without a schematic showing exactly what you've built, we couldn't even sensibly guess at what is happening. Please use the built-in schematic editor that comes with the question editor. \$\endgroup\$ May 21, 2019 at 18:19
  • \$\begingroup\$ are you pulling down the gate? there's not a good reason the voltage should drop when connected to an insulated gate. \$\endgroup\$
    – dandavis
    May 21, 2019 at 18:27
  • \$\begingroup\$ Iam actually pulling it down, because the comparator just pulls it down, without the pullup resistor i have constant 0 at the output \$\endgroup\$ May 21, 2019 at 18:41
  • \$\begingroup\$ Miskate in your schematic? R4 should go to 9V. \$\endgroup\$
    – bobflux
    May 21, 2019 at 18:47

1 Answer 1


Add hysteresis to comparator level to stop oscillation

Some of the comments have correctly identified the need for hysteresis in your circuit because the battery terminal voltage will increase when you turn off Q1.
First, what you got right in your design:

  1. A comparator is the correct choice for the task (not an opamp). The LM393 is quite appropriate.
  2. You implemented a good stable voltage reference using the TL341L

One potentially easy way to implement the hysteresis is to place it in series with your voltage sensing input.
Under normal discharge operation you want the switching point to be accurately 3.8V, so you want to implement asymmetrical hysteresis. As the battery terminal voltage moves below the 3.8V threshold and Q1 turns off you want to reduce the sensed voltage by whatever hysteresis you want.

The circuit would then look like this:


simulate this circuit – Schematic created using CircuitLab

With R3 and R4 as shown you will have about 100mV hysteresis. The discharger may still turn on and off several times as the battery voltage recovers, but eventually the terminal voltage will closely approach the 3.8V reference. R3 could be made an adjustable resistor if you wanted.

  • \$\begingroup\$ I tried that and it still doesnt work. Till 4.6V there are little waves on the osciloscope and on 4.6V and higher there are big waves that open the mosfet a little bit and then it smoothens out at 5.6V \$\endgroup\$ May 22, 2019 at 10:00
  • \$\begingroup\$ Then that is a simulation artifact since the battery is NOT going to rise to 4.6V. It's up to ou to make sure your simulation elements are realistic. \$\endgroup\$ May 22, 2019 at 15:29
  • \$\begingroup\$ I have everythink on my breadboard, Iam not doing any simulations. Iam using laboratory powersupply as a "battery" and as I sayed, when I join the real battery with 4.2V the mosfet wont even open \$\endgroup\$ May 22, 2019 at 15:53
  • \$\begingroup\$ OK....do you really think a power supply reacts the same as a chemically based battery. Turning on M1 depends on the measured voltage so if the battery voltage is around 4.2V then the device should turn on. However there is something major wrong with the use a power supply since you should NEVER get voltages above 4.2V and at 4.2V M1 should turn on. \$\endgroup\$ May 22, 2019 at 16:11
  • \$\begingroup\$ I know that power supply doesnt act the same as the battery, but I just want to test out, if it works. If I join the battery and its voltage is higher that 3.8V the mosfet should open and discharge the battery throu the R5, when its 3.8V or below, it should close the mosfet. So Iam using the powersupply to imitate the battery voltage, I can easily change the voltage of the powersupply to test if the circuit works. So i dont think it is the problem that Iam using the powersupply instead of the battery. \$\endgroup\$ May 22, 2019 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.