Author Topic: Oscillating comparator: simpler schmitt calculations?  (Read 2146 times)

0 Members and 2 Guests are viewing this topic.

Offline bitbangerTopic starter

  • Regular Contributor
  • *
  • Posts: 164
Oscillating comparator: simpler schmitt calculations?
« on: February 18, 2018, 09:49:42 pm »
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-CH2
CH4 (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 calcs


Lastly 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)
« Last Edit: February 18, 2018, 10:37:18 pm by bitbanger »
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1135
  • Country: us
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #1 on: February 18, 2018, 10:32:41 pm »
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.
« Last Edit: February 18, 2018, 10:44:34 pm by Wimberleytech »
 
The following users thanked this post: bitbanger

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7179
  • Country: de
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #2 on: February 18, 2018, 10:48:07 pm »
Yep, that's the way to get it to work.
As you've drawn it, your positive feedback influences both comparators with unpredictable outcome.
 

Offline bitbangerTopic starter

  • Regular Contributor
  • *
  • Posts: 164
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #3 on: February 18, 2018, 10:57:51 pm »
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)
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1135
  • Country: us
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #4 on: February 18, 2018, 11:25:24 pm »
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)

I put this sim together...just for kicks.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #5 on: February 18, 2018, 11:54:21 pm »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #6 on: February 19, 2018, 12:02:06 am »
Java calculator for calculating hysteresis.


http://www.daycounter.com/Calculators/Comparator-Hystereses-Calculator.phtml


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1135
  • Country: us
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #7 on: February 19, 2018, 12:43:29 am »
This may be relevant / helpful:
http://www.seventransistorlabs.com/Calc/ResDiv.html#three

Tim

Cool.  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!
 

Offline bitbangerTopic starter

  • Regular Contributor
  • *
  • Posts: 164
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #8 on: February 19, 2018, 02:21:23 am »
This may be relevant / helpful:
http://www.seventransistorlabs.com/Calc/ResDiv.html#three

Tim

You know I've been shown this site before but didn't even consider how useful it could be for this situation - thanks!
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #9 on: February 19, 2018, 02:29:17 am »
This may be relevant / helpful:
http://www.seventransistorlabs.com/Calc/ResDiv.html#three

Tim

Cool.  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!

Heh, I have... keep cutting out parts until it just stops working!

You know I've been shown this site before but didn't even consider how useful it could be for this situation - thanks!

Cheers -- if you have any ideas for simple calculators you can't find anywhere else, let me know. :)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: Wimberleytech

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11725
  • Country: my
  • reassessing directives...
Re: Oscillating comparator: simpler schmitt calculations?
« Reply #10 on: February 19, 2018, 05:27:30 am »
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.
what you want to achieve? more oscillation? (i assume ADJ is connected in someway to Vin)

Closer exam: not necc. the same capture (I later reduced the comp pullup to 4.7k to decrease output risetime)
reducing pullup will only make output (Vin?) falltime faster. if you want to decrease output (Vin?) risetime, increase R18 value.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->