Author Topic: Comparator problem  (Read 511 times)

0 Members and 1 Guest are viewing this topic.

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Comparator problem
« on: April 23, 2024, 08:00:55 am »
I am a bit stuck with solving the following problem. I have an input pulse of about 500ns and the amplitude of 500mV biased by +5V. I would like to compare the amplitude of this pulse (without taking into account the bias voltage) to some threshold value of let's say 100mV. The problem is that I use AD8561 with +5V single supply. I am looking for any suggestion on how to optimize the input pulse circuitry to have the input pulse with +5V bias removed. I tried to do it with a cap but somehow the comparator starts to violently oscillate when I assemble the circuit. Thanks a lot in advance.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4797
  • Country: pm
  • It's important to try new things..
Re: Comparator problem
« Reply #1 on: April 23, 2024, 08:09:37 am »
An input voltage divider, like two resistors such you get the input to say 2.5V with the 250mV pulse on top of it??
 
The following users thanked this post: elki

Online xvr

  • Regular Contributor
  • *
  • Posts: 173
  • Country: ie
    • LinkedIn
Re: Comparator problem
« Reply #2 on: April 23, 2024, 09:28:40 am »
> I tried to do it with a cap but somehow the comparator starts to violently oscillate when I assemble the circuit.

It should not. May be you place capacitor in wrong place? Please, provide us a schematic.
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #3 on: April 23, 2024, 09:38:30 am »
I did it like this.

> I tried to do it with a cap but somehow the comparator starts to violently oscillate when I assemble the circuit.

It should not. May be you place capacitor in wrong place? Please, provide us a schematic.
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6799
  • Country: pl
Re: Comparator problem
« Reply #4 on: April 23, 2024, 09:47:15 am »
You need a resistor connected between the capacitor and the comparator input, weakly pulling this circuit node to some well defined voltage within the valid input range of the chip and draining bias current of the input pin away from there.

Look up "highpass RC filter".
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #5 on: April 23, 2024, 09:57:18 am »
Thanks. I tried the RC option with connecting the resistor to the ground, but I guess the idea is to have a constant voltage instead.

You need a resistor connected between the capacitor and the comparator input, weakly pulling this circuit node to some well defined voltage within the valid input range of the chip and draining bias current of the input pin away from there.

Look up "highpass RC filter".
 

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #6 on: April 23, 2024, 11:29:27 am »
Thanks to your suggestions. Modified the circuit. I managed to make it work nearly fine if I add a 1k resistor on the supply of the comparator, which looks odd to me. Without this resistor, the circuit behaves oddly.
 

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #7 on: April 23, 2024, 11:31:01 am »
Attaching the pictures now ..
Yellow is input of the comparator, blue is output.
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1414
  • Country: ua
Re: Comparator problem
« Reply #8 on: April 23, 2024, 11:35:14 am »
Noise on the input? Try adding some hysteresis.
 
The following users thanked this post: elki

Online xvr

  • Regular Contributor
  • *
  • Posts: 173
  • Country: ie
    • LinkedIn
Re: Comparator problem
« Reply #9 on: April 23, 2024, 11:35:28 am »
Bias should be at least 0.5V (or more). Now your input pulse generates negative voltage on comparator pin.
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #10 on: April 23, 2024, 11:38:08 am »
Thank you. Could you please elaborate a bit more - where does this 0.5V come from - can it be inferred from the data sheet or it is specific to my case?

Bias should be at least 0.5V (or more). Now your input pulse generates negative voltage on comparator pin.
 

Online xvr

  • Regular Contributor
  • *
  • Posts: 173
  • Country: ie
    • LinkedIn
Re: Comparator problem
« Reply #11 on: April 23, 2024, 11:47:26 am »
>  where does this 0.5V come from

It's your input pulse amplitude (from OP)
 
The following users thanked this post: elki

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1414
  • Country: ua
Re: Comparator problem
« Reply #12 on: April 23, 2024, 11:49:45 am »
Bias should be at least 0.5V (or more). Now your input pulse generates negative voltage on comparator pin.
And then the 0.1V threshold voltage will always stay below the voltage on the non-inverting input.
later edit: maybe it'll actually be all right. Needs simulation, I'm failing to put it together in my head at the moment :)

One way to avoid applying too low a negative voltage to the non-inverting input pin is to connect a Schottky diode from ground to the non-inverting input.

At this point it becomes cumbersome enough so that the solution suggested earlier to use a resistor divider to bring the input signal level in the suitable range (around 2.5 V) starts to look more attractive. Of course, the threshold voltage source will then have to be adjusted accordingly.
« Last Edit: April 23, 2024, 11:52:05 am by shapirus »
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #13 on: April 23, 2024, 11:50:22 am »
What if the input pulse amplitude is expected to span from 0 to 5V? What would be the strategy for the bias in this case?

>  where does this 0.5V come from

It's your input pulse amplitude (from OP)
 

Online xvr

  • Regular Contributor
  • *
  • Posts: 173
  • Country: ie
    • LinkedIn
Re: Comparator problem
« Reply #14 on: April 23, 2024, 11:54:19 am »
> What if the input pulse amplitude is expected to span from 0 to 5V? What would be the strategy for the bias in this case?

Set small bias (about the same 0.5V) and add protection schottky diode from comparator input to ground (anode to ground, cathode to input)
 
The following users thanked this post: elki

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1414
  • Country: ua
Re: Comparator problem
« Reply #15 on: April 23, 2024, 12:01:32 pm »
It's worth mentioning, though, that the protection diode will have a capacitance that may be non-negligible, when fast signals are considered, which actually appears to be the case here. That's where things start to become tricky.
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #16 on: April 23, 2024, 12:10:48 pm »
Thanks again for all the ideas. Saga continues. Added a Schottky diode, raised the bias. Things work somewhat better but I don't get it why the input signal gets distorted - the input signal is simply raising and then falling. The comparator makes it zigzag like.
 

Online xvr

  • Regular Contributor
  • *
  • Posts: 173
  • Country: ie
    • LinkedIn
Re: Comparator problem
« Reply #17 on: April 23, 2024, 12:19:34 pm »
Your pulse is quite big (2V). This comparator has +3.0V input common range - your definitely hit it.
From DS:
Quote
Note that signals much greater than 3.0 V will result increased
input currents and may cause the device to operate more slowly.
Seems that input capacitor discharged by current surge.
You can add series resistor (for C1) to form voltage divider with R1 to reduce pulse level to acceptable. But in this case pulses of low level can be affected :(
And speed also will be affected.
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #18 on: April 23, 2024, 12:25:29 pm »
Tried with input voltage divider as suggested in the first post. This approach also works, and is maybe more straightforward, however, the same effect of the input signal getting distorted as in the 'biased' version.
 

Online xvr

  • Regular Contributor
  • *
  • Posts: 173
  • Country: ie
    • LinkedIn
Re: Comparator problem
« Reply #19 on: April 23, 2024, 12:27:05 pm »
> however, the same effect of the input signal getting distorted as in the 'biased' version.

Check the voltage on comparator input pin. It should not exceed 3.0V
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #20 on: April 23, 2024, 12:37:24 pm »
The maximum voltage on the input pin does not exceed 1.5V. The issue might be elsewhere. Any other suggestions on how to protect the input signal are welcome.

> however, the same effect of the input signal getting distorted as in the 'biased' version.

Check the voltage on comparator input pin. It should not exceed 3.0V
 

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #21 on: April 23, 2024, 12:51:45 pm »
Further investigations revealed that indeed the voltage goes above 3V on the input pin of the comparator, however, the initial pulse is below 1.5V. Looks like comparator drives it to the rail. Adding a 1k resistor to the supply rail fixes the problem at the cost of reducing the comparator output to about 1V. Not ideal.
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6799
  • Country: pl
Re: Comparator problem
« Reply #22 on: April 23, 2024, 02:32:06 pm »
Stupid question: do you have 100nF between the comparator's VCC and GND pins?
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 110
  • Country: be
Re: Comparator problem
« Reply #23 on: April 23, 2024, 03:17:42 pm »
Yes :)

Stupid question: do you have 100nF between the comparator's VCC and GND pins?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf