Author Topic: Peak "detector" to detect TIMING of peaks  (Read 1641 times)

0 Members and 1 Guest are viewing this topic.

Offline InfravioletTopic starter

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: gb
Peak "detector" to detect TIMING of peaks
« on: May 25, 2023, 07:31:11 pm »
I've been wondering what sort of circuits would be used for this application, but can't find them by searching because the obvious name "peak detector" is ofcourse already applied to circuits which hold the level of a peak.

I'm looking to produce a sharp rising edge (dropping back down after some chosen short* interval) when an incoming analogue signal goes through a (local) maximum**, something which will trigger this pulse just as a rising signal starts to become a falling signal again (I can low-pass filter this incoming signal enough to avoid noise peaks giving false triggers).

*exact time to be decided, but somewhere < 20% of the typical time usually expected as the shortest plausible between peaks
**any event where a rising signal has a change in dV/dt switches sign such as to have the signal start fallig again

I'm looking to do this with generic ICs mostly, op amps and that sort of thing, not specialised single purpose chips and not building up from individual transistors either.

Can anyone suggest good search terms to find this sot of circuit, given that the word "detector" is pretty much reserved for level holding circuits rather than ones which make a logic level transition at the time of the peak.

Thanks

EDIT: I've just realised I could probably do this with a differentiator circuit feeing in to a zero crossing detector, but is there a better way?


« Last Edit: May 25, 2023, 07:37:19 pm by Infraviolet »
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17407
  • Country: us
  • DavidH
Re: Peak "detector" to detect TIMING of peaks
« Reply #1 on: May 26, 2023, 06:48:32 am »
A differentiator can be used to reveal the peak of a pulse when its output crosses zero, however differentiators are prone to noise.
 

Offline artag

  • Super Contributor
  • ***
  • Posts: 1268
  • Country: gb
Re: Peak "detector" to detect TIMING of peaks
« Reply #2 on: May 26, 2023, 09:07:38 am »
A differentiator is pretty much the definition of this circuit. What you're trying to detect is the slope of zero, either by measuring the slope directly or by some indirect technique such as a peak-hold circuit followed by a comparator to detect when the present value is less than the peak.

It's problematic, as David says. You can help, bu first low-pass filtering and then differentiating. But that introduces delay. Such are the compromises you have to make when designing real-world circuits.
 

Offline InfravioletTopic starter

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: gb
Re: Peak "detector" to detect TIMING of peaks
« Reply #3 on: June 04, 2023, 08:56:20 pm »
Is there a nice way to make a zero crossing detector which only triggers on a rising edge? So one can check the differentiator's output to detect only maximums of the original signal, not minimums? Would one have to feed in to another differentiator to take 2nd derivatives, or is there a more straightforward way? What do microcontrollers actually have inside where they've got pins which can give an interrupt specifically on a rising/falling (delete as apropriate) edge but not a falling/rising (vice-versa) edge?
 

Offline dobsonr741

  • Frequent Contributor
  • **
  • Posts: 706
  • Country: us
Re: Peak "detector" to detect TIMING of peaks
« Reply #4 on: June 04, 2023, 10:35:08 pm »
MCU interrupt can be triggered by only one specific edge.
 

Offline InfravioletTopic starter

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: gb
Re: Peak "detector" to detect TIMING of peaks
« Reply #5 on: June 05, 2023, 01:15:35 am »
That's what I meant, in an MCU how does it know whether the edge it is seeing incoming is an edge in the direction you told it to watch for. If you have programmed it to act on a rising edge interrupt how does it know the diference between a rising and falling edge, the same method might be applicable to my situtaion.
 

Offline dobsonr741

  • Frequent Contributor
  • **
  • Posts: 706
  • Country: us
Re: Peak "detector" to detect TIMING of peaks
« Reply #6 on: June 05, 2023, 02:58:36 am »
Create a simple analog comparator for zero crossing. I assume your signal is bipolar. Use the output as the IRQ. Enable whichever direction of the transient you are interested.

If the signal is noisy add hysteresis larger than the pp noise.
 

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1163
  • Country: us
Re: Peak "detector" to detect TIMING of peaks
« Reply #7 on: June 05, 2023, 08:55:18 am »
A-D converter into a u-processor and detect the direction of change in software. Output a high pulse when that occurs. Some processors even have A-Ds built in.
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1163
  • Country: us
Re: Peak "detector" to detect TIMING of peaks
« Reply #8 on: June 05, 2023, 09:04:51 am »
How to tell up from down with analog detector? Diodes, of course. Capacitor passes HF component of an edge. You get pulses in both directions and a relatively low value resistor can bias them at ground. Then a diode to ground will short one polarity while leaving the other polarity alone. Easy-peasy!

But that assumes the transition is rapid and therefore has a HF component. If a slow change must be detected, then my answer above would be a lot better. Software can easily and reliably detect a one count downward change every single time it happens.



That's what I meant, in an MCU how does it know whether the edge it is seeing incoming is an edge in the direction you told it to watch for. If you have programmed it to act on a rising edge interrupt how does it know the diference between a rising and falling edge, the same method might be applicable to my situtaion.
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 

Online jpanhalt

  • Super Contributor
  • ***
  • Posts: 3985
  • Country: us
Re: Peak "detector" to detect TIMING of peaks
« Reply #9 on: June 05, 2023, 09:14:16 am »
That's what I meant, in an MCU how does it know whether the edge it is seeing incoming is an edge in the direction you told it to watch for. If you have programmed it to act on a rising edge interrupt how does it know the diference between a rising and falling edge, the same method might be applicable to my situtaion.

Microchip explains its method for edge and related tools here: https://onlinedocs.microchip.com/pr/GUID-C866D457-41E2-43C7-8442-2F1193FAAD9F-en-US-4/index.html?GUID-0F89E4C8-20A1-4788-8448-C67FB3569C68

EDIT:  This has a little more explanation:  https://electronics.stackexchange.com/questions/95504/how-does-this-synchronizing-edge-detector-logical-diagram-work
« Last Edit: June 05, 2023, 09:16:34 am by jpanhalt »
 

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1621
  • Country: gb
Re: Peak "detector" to detect TIMING of peaks
« Reply #10 on: June 05, 2023, 11:14:25 am »
To find a peak, differentiate the input signal using a high-pass analogue filter. Then zero-crossings of this filter output correspond to local extrema of the signal. A + to - crossing corresponds to a positive peak. Remember to allow for the delay through the high pass filter, and remember also the delay will vary with frequency.

You will need to apply some low pass filtering as well, to reduce the effect of noise, but this will not be enough by itself. The best way is to ‘mute’ the comparator digital output when the input signal is low. You can do this with another comparator, comparing the input signal with an adjustable threshold. You need some digital logic to allow an output (e.g. to trigger a monostable) only when the signal is ‘high’ and the zero crossing is in the ’right’ direction. This depends on your needs, but mostly you might want to detect maxima of a positive signal and/or minima of a negative signal. Note that if you need both, you will need two level comparators, with two different thresholds (positive & negative)

The logic can take the form of chips or of software, whichever you choose, as can the monostable.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9294
  • Country: fi
Re: Peak "detector" to detect TIMING of peaks
« Reply #11 on: June 05, 2023, 02:02:50 pm »
Is digital domain, e.g. a microcontroller, out of question? That would enable experimenting with different algorithms, filtration options etc.. In analog domain, you are pretty much limited to simple LPF followed by differentiator followed by comparator with hysteresis. Even just making them all adjustable is already quite some many components and trimpots.

What sort of times are we talking about? Millisecond, microsecond, nanosecond accuracy? How about rise/fall times of your signal?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf