Comparator causes ripples what can I do - Page 1
Forum section: electronics / beginners

author: hp3310a
author_rank: Regular Contributor
timestamp: November 30, 2024, 04:00:04 pm
content: Hi everyone,I'm working on a frequency counter and am fighting with the input stage up until the digital counter. For the longest time I couldn't figure out why the counter keeps counting way too many pulses in some situations. Using my new SDS804X I finally was able to figure it out (I think).First the simplified schematic, on the breadboard all ICs have decoupling capacitors on supply and ground pins. Supply is +5V (also -5V for the opamp), coming from lab power supply.Here's the big picture.Red=Signal inYellow=Opamp outGreen=comparator outNote the vertical lines right when the comparator switches.Closeup at 11kHz. The ripples move along with the event when the comparator is switching (when I change the threshold, the ripples move along), so I believe it's the comparator output that causes this.I believe what happens is this: When the comparator switches from one level to the other, the opamp output starts swinging (the span is 700mV with a 2V output signal), which in turn switches the comparator, then immediately back and so on, until the switching action no longer goes past the comparator's mid point. The LT1720 has a 3.5mV hysteresis which doesn't help enough.Closeup at 100kHz and 1MHz, since the time spent in the "switching zone" is shorter, there is less time for back and forth switching, so there are less ripples at 100kHz and almost nothing a 1MHz.Input comes from the frequency generator (HP3310a). The ripples are also visible on the input (red) which makes me think that ground is somehow offset by the switch.Probably this is all wrong, in which case it would be great to know what it is. And of course, how to fix it at the source.Thanks for any pointers! Just a quick reminder, I'm a rookie so please be gentle.

author: temperance
author_rank: Super Contributor
timestamp: November 30, 2024, 04:07:17 pm
content: What you need is this:https://www.ti.com/lit/ug/tidu020a/tidu020a.pdf?ts=1732982379194&ref_url=https%253A%252F%252Fwww.google.com%252F

author: palpurul
author_rank: Regular Contributor
timestamp: November 30, 2024, 05:09:11 pm
content: Looks like you need some hysteresis.I think as you increase the frequency of the input signal (while keeping the amplitude the same) you'll get less pulses and eventually pulses disappear.

author: PGPG
author_rank: Frequent Contributor
timestamp: November 30, 2024, 05:48:54 pm
content: If you increase hysteresis it will certainly help, but ruin your input sensitivity.Comparator output propagates to analog stage. It can be through 'air', or through supply or gnd. Do you have analog circuitry supply filtered from digital supply (comparator consumes supply current like digital IC).

author: BennoG
author_rank: Frequent Contributor
timestamp: December 01, 2024, 10:36:57 am
content: you forgot the PCB layout, this can be the big part of the problem.and decoupling capacitors as close as possible to the op amps.Benno

author: hp3310a
author_rank: Regular Contributor
timestamp: December 01, 2024, 11:56:11 am
content: Quote from: temperance on November 30, 2024, 04:07:17 pmQuote from: palpurul on November 30, 2024, 05:09:11 pmQuote from: PGPG on November 30, 2024, 05:48:54 pmIndeed! Thanks a lot! Adding additional hysteresis is even explained in the LT1720 data sheet but I failed to realize this applied here.It also solves the no-signal noise switching.I tried to calculate the resistor values according to the data sheet but ended up experimenting to get to a good result. For the record, I ended up with this configuration:Thanks again!