Author Topic: How to detect the peak of a sinusoidal waveform of varying amplitude?  (Read 4898 times)

0 Members and 1 Guest are viewing this topic.

Offline smoothVTerTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: us
I want to detect the peak of an arbitrary amplitude sine wave.    If the amplitude were fixed, I could easily construct a comparator circuit to give me a pulse output when some target voltage is reached on the sinusoid's cycle.

In my application however, the signal can vary in amplitude from a minimum of 100mV to a maximum of 3V.

How would one construct a signal conditioning circuit so that I can always have a predictable peak amplitude output for feeding into a comparator?   AGC?   VGA?    I'm not well versed in this type of circuitry so any insight is appreciated. 

 

Offline Supercharged

  • Regular Contributor
  • *
  • Posts: 61
  • Country: ch
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #1 on: March 14, 2017, 08:27:02 pm »
I think a differentiator circuit could do the trick for you. If the output of the differentiator is exactly zero and the input signal is bigger than zero. NOTE: This is assuming a "normal" sine wave.
Science is about what is, engeneering is about what can be.
-Neil Armstrong
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14172
  • Country: de
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #2 on: March 14, 2017, 08:31:38 pm »
Bringing the amplitude to a reasonable range is different from detecting the amplitude.

A suitable circuit would be a kind of AGC - so automatic adjustment of gain.

There are different methods to do this - depending on the frequency and amplitude range.
Just for feeding the signal to an comparator (e.g. for something like a frequency counter ?) it would be enough to do rather coarse gain steps, possibly a little like an auto-ranging AC voltmeter.
 

Offline smoothVTerTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: us
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #3 on: March 14, 2017, 08:39:37 pm »
Exactly ... the end application is indeed a frequency counter.    Fairly low frequency too:   I'm looking at a max sine frequency of 2kHz
 

Offline w2aew

  • Super Contributor
  • ***
  • Posts: 1780
  • Country: us
  • I usTa cuDnt speL enjinere, noW I aR wuN
    • My YouTube Channel
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #4 on: March 14, 2017, 08:41:54 pm »
Exactly ... the end application is indeed a frequency counter.    Fairly low frequency too:   I'm looking at a max sine frequency of 2kHz

Then you don't really need to detect the peaks - you can detect the zero-crossings.  You can amplify the signal to the point of limiting, or use a comparator to turn it into a square wave, then detect frequency of that.
YouTube channel: https://www.youtube.com/w2aew
FAE for Tektronix
Technical Coordinator for the ARRL Northern NJ Section
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #5 on: March 14, 2017, 08:43:13 pm »
I'm not certain I understand the question.
Do you want to detect the peak amplitude (level)?
Or do you want to detect when the sine peaks?

 

Offline smoothVTerTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: us
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #6 on: March 14, 2017, 09:10:01 pm »
I need to know when the sine wave peaks, regardless of its amplitude.   

I do not need to know about the absolute voltage level this peak occurs.

The note above about a zero-crossing detector:   This could work just fine, but I'd have to remove the DC offset first.  I'll give it a whirl!

« Last Edit: March 14, 2017, 09:27:18 pm by smoothVTer »
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #7 on: March 14, 2017, 09:27:15 pm »
Quote
I need to know when the sine wave peaks, regardless of its amplitude.

Forget that, think about how smooth the top of a sinewave is, no way to detect the top accurately.

Zero-crossing is the way to go, and is how all commercial frequency counters work.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #8 on: March 15, 2017, 12:51:35 am »
I think a differentiator circuit could do the trick for you. If the output of the differentiator is exactly zero and the input signal is bigger than zero. NOTE: This is assuming a "normal" sine wave.

I have done it this way but differentiators are noisy.  There is an alternative design which uses a pair of integrators to produce the same result.  I do not think this is what the original poster wants though.

The note above about a zero-crossing detector:   This could work just fine, but I'd have to remove the DC offset first.  I'll give it a whirl!

This is what an AC coupling capacitor is for.

If there is an issue with duty cycle causing baseline wander which will not happen with any reasonable  sine wave, then there is an alternative using two peak detectors which produces the same results as AC coupling but without this problem but I doubt you need it.  It is used where the waveform could be anything.
 

Offline smoothVTerTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: us
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #9 on: March 15, 2017, 01:32:39 pm »
I've simulated a possible circuit implementation of the zero-crossing detector using LTSpice.  I used an LT1006 because of prior experience, however, perhaps a different op amp would be a better choice.   Results indicate successful zero crossing detection with amplitudes as small as 100mV:

 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #10 on: March 15, 2017, 03:14:17 pm »
Quote
I need to know when the sine wave peaks, regardless of its amplitude.

Forget that, think about how smooth the top of a sinewave is, no way to detect the top accurately.

Zero-crossing is the way to go, and is how all commercial frequency counters work.

No argument with zero crossing, definitely the way to go, but I have to point out that the "precision peak detector" is a very well known circuit and it's quite possible to accurately detect the top of a sinewave to arbitrary accuracy, limited only by the usual disappointing characteristics of real world (as opposed to ideal) components.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #11 on: March 15, 2017, 03:15:22 pm »
If it's for a frequency counter, there's no need for all the fancy stuff. Just amplify and clip, you'll get a nice square output with at least one of the edges useful for reference timing.
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #12 on: March 15, 2017, 03:38:02 pm »
If it's for a frequency counter, there's no need for all the fancy stuff. Just amplify and clip, you'll get a nice square output with at least one of the edges useful for reference timing.

I wasn't suggesting making it any more complicated. As I said, zero crossing is the way to go. I was merely correcting your:

Forget that, think about how smooth the top of a sinewave is, no way to detect the top accurately.

because this is the beginner's topic and we don't want a beginner wandering off with the impression that something that's been solved so often that there are standard textbook circuits to do it is somehow impossible.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #13 on: March 15, 2017, 03:41:58 pm »
I've simulated a possible circuit implementation of the zero-crossing detector using LTSpice.  I used an LT1006 because of prior experience, however, perhaps a different op amp would be a better choice.   Results indicate successful zero crossing detection with amplitudes as small as 100mV:



You might want to have a think about the common mode input limits of the op amp, the output limits of the op amp and the way those are going to interact with that diode you've strapped between ground and the non-inverting input of the amp. Hint: very few op amp inputs or outputs are happy working within 0.3V of any rail.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #14 on: March 15, 2017, 03:52:05 pm »
Quote
because this is the beginner's topic and we don't want a beginner wandering off with the impression that something that's been solved so often that there are standard textbook circuits to do it is somehow impossible

In theory you're right, but the effort would in no way justify the result. If I wanted to find the top, I'd cosine the signal and zero-cross detect the cosine. And then we're back to square one...
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #15 on: March 15, 2017, 04:15:54 pm »
Quote
because this is the beginner's topic and we don't want a beginner wandering off with the impression that something that's been solved so often that there are standard textbook circuits to do it is somehow impossible

In theory you're right, but the effort would in no way justify the result. If I wanted to find the top, I'd cosine the signal and zero-cross detect the cosine. And then we're back to square one...

You're going round in circles just to avoid saying "Whoops, careless thing I said there." We all casually say things that are wrong, or less precise than we ought to. When we do and someone points it out the best thing to do is either graciously or quietly just accept it. My advice, stop digging.

Now, can we please stop this before we wonder way off topic into engineer/pig mud wrestling.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: us
Re: How to detect the peak of a sinusoidal waveform of varying amplitude?
« Reply #16 on: March 15, 2017, 04:21:29 pm »
Use a simple peak detector

Paul


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf