Noninverting comparator (LM397) circuit troubleshooting... - Page 1
Forum section: electronics / beginners

author: davethebossman
author_rank: Newbie
timestamp: January 25, 2024, 07:57:10 pm
content: Hi, all;First time posting, and I'm looking for assistance from some circuit experts. Recent EE graduate, here. Embarrassed that I can't get some simple circuits working! Any help is appreciated...Goals:- Make a noninverting comparator circuit. Vcc = ~12V, Vthreshold = ~10V..... these values are to be experimented with, once I get the circuit functioning.- not terribly committed to my hysteresis value yet, but <500mV would be nice- Comparator will eventually be used to trigger a 555 Timer (LM397 OUT will be attached to 555 TRIG, and *hopefully* Timer will be triggered on falling edge signal from LM397)Successes so far:- Inverting circuit (attached below) is functioning. I just eyeballed the resistors to get things going. Inverting circuit has values of VH = 11.1V, VL = 11.0V, with VCC = 12V.- ummm other successes..... I haven't melted the LM397 yet?Failures so far:- I don't care about the inverting circuit working... I want a noninverting comparator- noninverting comparator circuit refuses to light up, both by "playing around with values" and by mimicking TI's example circuit (PDF attached below)- significant attack on pride and confidenceRequests:- Please suggest how my noninverting circuit needs tweaking. As soon as I get it working at all, I should be okay to tweak.- if LM397 isn't the right fit, then please say so- Be nice, I'm trying.Notes:- yes my LED is facing the right way- yes I've checked my math (using TI's PDF, it was basically plug-and-play calculations), but please feel free to ask specific questions- have not used a scope on the circuit yetThank you for reading. Hopefully I've provided enough details!David

author: Benta
author_rank: Super Contributor
timestamp: January 25, 2024, 10:23:19 pm
content: Soo..."Open collector output stage". Google it. (and relate it to a 100k pullup for the LED)As for negative feedback for a comparator... not really useful.And, and, and.

author: MarkT
author_rank: Frequent Contributor
timestamp: January 26, 2024, 02:11:33 pm
content: Your first circuit has pins 1 and 5 shorted together - I don't think you meant that.Comparator circuits use only positive feedback, and usually only a small amount of it to ensure a crisp snap transistion. Typically a large value resistor from output to non-inverting input is used for this, although in many situations it can be omitted.Comparators compare, they don't invert (or non-invert).And don't be confused by the symbols, comparators are very different from opamps in several important ways. Using an opamp as a comparator is fraught with pitfalls, trying to use a comparator as an opamp is doomed as comparators are designed to be unstable and saturate the output.

author: davethebossman
author_rank: Newbie
timestamp: January 26, 2024, 04:40:32 pm
content: Well, I should update my progress:- first off, my comparator is now functioning! I pulled out my multimeter and started measuring nodes. I found some interesting results.- my inverting voltage divider was causing a very low node voltage.... around 1.5V..... I had been hoping for a Vthreshold of 10V- i noticed the odd behaviour that, when adjusting my Vsig, I would find Vthreshold changing as well. I didn't anticipate this (am I imagining things or was this true??)- the result was that, when I varied Vsig at the noninverting input, I could never reach the Vsig < VThreshold condition- upon changing my resistors to much lower values (<100k), I reached my desired Vthreshold- now, when changing Vsig, I could cross the Vthreshold boundary.....my comparator works!Remaining things to understand:- why were my original resistor values (~1M in some cases) giving trouble? The math says they should be fine. And TI's guide suggests that such high values will reduce power loss (not that I care, for my application)- should I consider a capacitor anywhere, to smooth my Vsig a bit? I'll be using a LM7812 to obtain Vref, so I'm not terribly worried about that part (though maybe it deserves a cap as well?).- now that this portion of the circuit is functioning, I've attached it to the 555 timer. I'm finding the 555 timer to be triggering randomly, which is clearly not good. Obviously it's receiving some falling edges from the comparator. I must investigate whether hysteresis or trigger input smoothing can be implemented.Thank you, users, for your suggestions! Will update as the circuit develops. Maybe it'll help someone else.David

author: davethebossman
author_rank: Newbie
timestamp: January 26, 2024, 04:42:13 pm
content: Quote from: Benta on January 25, 2024, 10:23:19 pmHi, Benta. Thank you for your reply!1. Can you give me a hint about what I should've noticed, when Googling? From my reading, it seems that the pullup resistor is necessary due to the open collector topology; this is good for me because I want the Vsig > Vthreshold condition to result in a high output. Please give me some hints what else I should notice.2. My mistake about the negative feedback. That resistor should indeed be connected to the noninverting input.... kicad had the symbol in the reverse order from I expected. Didn't notice til you pointed it out.Thanks again.

author: davethebossman
author_rank: Newbie
timestamp: January 26, 2024, 04:46:45 pm
content: Quote from: MarkT on January 26, 2024, 02:11:33 pmHi, MarkT;Thank you for your reply as well. A couple things...1. Actually I indeed meant to short pins 1 and 5. I was merely "getting the circuit going" and this happened to work... albeit with the reverse output. It's not part of my design, moving forward.2. I'm a bit confused about your "comparator don't invert" comment. I found that, when reversing the comparator inputs, I either got a normal-high output (for Vsig at noninverting input) or normal-off output (for Vsig at inverting input). Please help me understand better.3. Thank you for the clarification about opamps vs comparators. I know they're related but not alike. I'll keep this in mind for future. Any further comments on this matter would be appreciated, if you're willing.Thanks again.