Comparator - Odd behavior in circuit - Page 1
Forum section: electronics / beginners

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 06:08:14 am
content: I built this circuit on a breadboard. See schematic. I substituted a LED and 1K resistor to represent the e-load.I used an op amp tester to verify that the comparator functions properly. This schematic is provided, also.I have verified that all of the proper voltages are present on the comparator’s physical pins.The voltage of +IN is one volt greater than the voltage of -IN, so OUT should go high. It does not. Please remember that this same chip tests as good.I have done all of the typical troubleshooting that I know to do. I am stumped.Thoughts and suggestions, please and thank you.

author: floobydust
author_rank: Super Contributor
timestamp: December 27, 2019, 06:11:10 am
content: LM339 has open-collector output, so you need pullup resistor there to source current. I'd also add a little hysteresis resistor so it doesn't oscillate.

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 06:19:59 am
content: Thank you, floobydust, for the amazingly fast response. I will have to google your instructions, to understand what needs to be done, but I very much appreciate you pointing me in the correct direction.

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 06:37:33 am
content: Okay, floobydust... Open Loop means no feedback loop... Got it.I think this is what you want for the pull up resistor, correct?https://www.electronics-tutorials.ws/opamp/op-amp-comparator.htmlSo, the comparator output is a sink, not a source. The pull up resistor holds the pin high, until the sink pin turns on and grounds out the MOSFET gate voltage, correct?Thank you for your help and support.

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 06:43:50 am
content: Quote from: floobydust on December 27, 2019, 06:11:10 amUmm... To add hysteresis, don't I use an inductor? If so, what value? If not, please explain what you mean. Thank you.

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 06:54:25 am
content: Corrected circuit. Will this do?For hysteresis, do you mean an extra low value resistor on the pot, to always have some current limitation on that leg, even when the pot is set to zero?

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 06:56:09 am
content: No, that change can not work... Give me a minute more...

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 07:01:51 am
content: Okay... This will accomplish setting the reference and holding the pin high. But, I still don't know about the hysteresis...

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 07:14:25 am
content: Hmm... Seems that to address the hysteresis issue, I need to add a feedback resistor loop from the output pin to the battery voltage reference pin. The formula is shown. This article also suggests adding a cap across the feedback resistor, I think... I only scanned the article... If the cap is a good idea, what value? Am I on the right track?https://www.analog.com/en/analog-dialogue/articles/curing-comparator-instability-with-hysteresis.html#

author: floobydust
author_rank: Super Contributor
timestamp: December 27, 2019, 07:35:38 am
content: I don't know the whole circuit, it has a few traps that I can see.You are on the right track. You don't want the comparator to chatter or oscillate at the trip point. It is customary to add a hysteresis resistor ~1M-10M from LM339 output to (+) input to give positive feedback and cause it to switch solid. But your R1 1k resistor is small to allow that - how much hysteresis you need kind of depends on the battery voltage under test. I would increase your R1 to 10k with a 1M hys. resistor as a start.Chatter will be a problem here in another way - once a battery's voltage drops and the comparator shuts off the MOSFET, the battery's voltage will creep up with no load and then circuit turns on the load and then off and then on, you see it hiccup. A latch is usually added so the MOSFET stays off once the comparator trips.I think the MOSFET switch might not work as you intend. MTP3055VL would like at least 3.5V VGS for over 8A.If you add a 1k-10k pullup resistor from the LM339 output to VREF_PS (+5V), the gate can go to +5V... but you do not have the source grounded, instead it goes to the load. So the source could be up a volt or two or three? In which case 5V on the gate is not enough to turn the MOSFET fully on as a switch, and it will run hot. The LED and its resistor are no good for a pullup because the LED drops a couple volts. You might want to consider a P-ch MOSFET or moving the load to the drain-side of the N-ch MOSFET if that is possible, the load not minding not being connected to the GND.

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 08:10:50 am
content: Thank you, floobydust. I will study this information and try to apply it.I was trying to keep my opening question to the point. But, here's my objective... I have a lot of low voltage equipment - walkie talkies, GoPro camera, etc. - that doesn't get used all that often. I want to cycle the batteries to help keep them fresh. And, I have an electronic load. I am trying to build a Low Voltage Cutoff switch to interface the batteries with the e-load. Any suggestions are appreciated.

author: t1d
author_rank: Super Contributor
timestamp: December 27, 2019, 08:48:19 am
content: Quote from: floobydust on December 27, 2019, 07:35:38 amHere is the whole schematic, with some of the changes you suggest. Please advise.Quote from: floobydust on December 27, 2019, 07:35:38 amDone. Please review changes.Quote from: floobydust on December 27, 2019, 07:35:38 amExcellent point! I will add a latch, but not tonight.Quote from: floobydust on December 27, 2019, 07:35:38 amI moved the MOSFET as you advised and added a note to the supply that regulator should not be less than 5 volts.I must stop, now, but I look forward to continuing with you. My many thanks!