Oscillating comparator: simpler schmitt calculations? - Page 1
Forum section: electronics / projects

author: bitbanger
author_rank: Regular Contributor
timestamp: February 18, 2018, 09:49:42 pm
content: Hi folks-I'm working on a comparator circuit that switches in and out a FET based on supply/battery level. I didn't originally add any hysteresis because (basically) I thought that circuit loading (due to what the FET was switching) would only help my cause and I could get by without.Of course immediately I saw oscillations beginning at, and until I get well away from, my reference threshold. I added some quick and dirty hysteresis and while this got me out of the woods I didn't end up with the right hsyteresis levels.Sat down and hand calculated the circuit and my calculations match what I'm seeing. Problem is they seem pretty arduous, especially now to back calculate for targeted thresholds. Not to mention I'll need to add hysteresis to the second comparator, serving to further complicate things. Just curious if there's a better design approach to this? I'm sure I could brute force the calculations and throw them into an excel sheet to guess/check/revise, but mix in standard resistor values and it quickly seems light a nightmare. Any general suggestions on approach here?FYI without hysteresis:Capturing the oscillation when increasing Vin to >7.8V:(oscillations remain until Vin>~8.18V)CH2 (GRN) = "Trak" (1/10th of Vin)CH3 (BLU) = "Thr2" (fixed 0.78V)MATH (PNK) = CH3-CH2CH4 (RED) = "SW2" (comparator output)Closer exam:not necc. the same capture (I later reduced the comp pullup to 4.7k to decrease output risetime)Anyway onto the addition of some feedback(R1/R2): problem was I initially failed to account for R14/R15 in my R1/R2 calcsLastly the calcs to confirm what I was seeing: the upper threhold was raised nearly half a volt, far too high.(excuse the poor cell phone shot)

author: Wimberleytech
author_rank: Super Contributor
timestamp: February 18, 2018, 10:32:41 pm
content: Why not simplify things by making two R14/R15 dividers--one for each comparator. Then use two hysteresis resistors--one from each comparator output to its respective divider. You don't need the extra R1 resistor in either comparator circuit.

author: Benta
author_rank: Super Contributor
timestamp: February 18, 2018, 10:48:07 pm
content: Yep, that's the way to get it to work.As you've drawn it, your positive feedback influences both comparators with unpredictable outcome.

author: bitbanger
author_rank: Regular Contributor
timestamp: February 18, 2018, 10:57:51 pm
content: Totally makes sense, thanks. (To be clear I hadn't made any changes to the SW1 comparator yet, just trying to sort out SW2 first)

author: Wimberleytech
author_rank: Super Contributor
timestamp: February 18, 2018, 11:25:24 pm
content: Quote from: bitbanger on February 18, 2018, 10:57:51 pmI put this sim together...just for kicks.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 18, 2018, 11:54:21 pm
content: This may be relevant / helpful:http://www.seventransistorlabs.com/Calc/ResDiv.html#threeTim

author: danadak
author_rank: Super Contributor
timestamp: February 19, 2018, 12:02:06 am
content: Java calculator for calculating hysteresis.http://www.daycounter.com/Calculators/Comparator-Hystereses-Calculator.phtmlRegards, Dana.

author: Wimberleytech
author_rank: Super Contributor
timestamp: February 19, 2018, 12:43:29 am
content: Quote from: T3sl4co1l on February 18, 2018, 11:54:21 pmCool. I clicked through your website. I guessed that "7 transistor" harkened back to the old transistor radio days...but alas...I see you are way too young for that! Ever heard of Madman Muntz?Nice work...keep it up!

author: bitbanger
author_rank: Regular Contributor
timestamp: February 19, 2018, 02:21:23 am
content: Quote from: T3sl4co1l on February 18, 2018, 11:54:21 pmYou know I've been shown this site before but didn't even consider how useful it could be for this situation - thanks!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 19, 2018, 02:29:17 am
content: Quote from: Wimberleytech on February 19, 2018, 12:43:29 amHeh, I have... keep cutting out parts until it just stops working!Quote from: bitbanger on February 19, 2018, 02:21:23 amCheers -- if you have any ideas for simple calculators you can't find anywhere else, let me know.Tim

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 19, 2018, 05:27:30 am
content: Quote from: bitbanger on February 18, 2018, 09:49:42 pmwhat you want to achieve? more oscillation? (i assume ADJ is connected in someway to Vin)Quote from: bitbanger on February 18, 2018, 09:49:42 pmreducing pullup will only make output (Vin?) falltime faster. if you want to decrease output (Vin?) risetime, increase R18 value.