Author Topic: Peak Detector Circuit  (Read 1522 times)

0 Members and 1 Guest are viewing this topic.

Offline mauijanTopic starter

  • Newbie
  • Posts: 1
  • Country: ch
Peak Detector Circuit
« on: October 26, 2022, 12:49:43 pm »
I am trying to design a peak detector circuit. But it needs to be a special kind of peak detector.
If a more positive peak arrives, of course the circuit needs to detect and hold it. But if a smaller, also positive peak comes, it needs to forget the last one and store this new, smaller peak. It basically needs to store every new max value. The signal is always positive.
The signal is a sinusoidal waveform with frequency of about 33 Hz. The frequency can also be lower but not higher. For every cycle the highest peak needs to be detected, even when the peaks are getting smaller in magnitude. I have attached an image that explains this behaviour...
Can anyone help?


 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Peak Detector Circuit
« Reply #1 on: October 26, 2022, 12:59:43 pm »
Hi mauijan, welcome to the forum.

For such a low frequency, I would use a microcontroller. You will have to bring the signal voltage in range of the ADC and write a bit of software.

On digital values it is easy to do this. Track the maximum, and hold it when the value drops below. Then track the minimum and when this is found start tracking a new maximum, and so on.

Doing it with electronics will require a fair bit of components I think. (Not really my field of expertise)

Online David Hess

  • Super Contributor
  • ***
  • Posts: 17428
  • Country: us
  • DavidH
Re: Peak Detector Circuit
« Reply #2 on: October 26, 2022, 03:42:35 pm »
For a hardware only implementation, I would use two peak detectors and a differentiator.  The differentiator sets or resets a flip-flop to select which peak detector is providing the output, and which peak detector is monitoring the input and needs to be reset.

The differentiator output goes high or low depending on the slope of the input signal, which drives edge sensitive logic to control the flip-flop.  This is a noisy operation so careful filtering will be required.
« Last Edit: October 27, 2022, 01:38:47 am by David Hess »
 

Offline MasterT

  • Frequent Contributor
  • **
  • !
  • Posts: 851
  • Country: ca
Re: Peak Detector Circuit
« Reply #3 on: October 26, 2022, 06:33:05 pm »
For maximum value in each period combine peak detector with zero-cross reset circuits
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Peak Detector Circuit
« Reply #4 on: October 26, 2022, 06:41:05 pm »
For maximum value in each period combine peak detector with zero-cross reset circuits

For this to work the signal should cross zero where as the original post states:

The signal is always positive.

The idea of David is interesting, but as I expected quite a bit of components to make it work.

Edit: For the software solution it is also needed to apply some filtering in the code, but that is not to difficult either.
« Last Edit: October 26, 2022, 06:43:17 pm by pcprogrammer »
 

Offline MasterT

  • Frequent Contributor
  • **
  • !
  • Posts: 851
  • Country: ca
Re: Peak Detector Circuit
« Reply #5 on: October 26, 2022, 06:49:36 pm »
For maximum value in each period combine peak detector with zero-cross reset circuits

For this to work the signal should cross zero where as the original post states:

The signal is always positive.
High Pass Filtering would make signal bipolar. Interesting, that HPF is a differentiator...
 

Offline Infraviolet

  • Super Contributor
  • ***
  • Posts: 1185
  • Country: gb
Re: Peak Detector Circuit
« Reply #6 on: October 26, 2022, 07:07:15 pm »
Just because the signal is always positive doesn't mean you can't produce a virtual ground rail against which to do the crossing detection.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Peak Detector Circuit
« Reply #7 on: October 26, 2022, 07:11:32 pm »
High Pass Filtering would make signal bipolar. Interesting, that HPF is a differentiator...

True, but you loose the level then of what it originally was.

Forgot to mention that with the microcontroller solution it would need an analog output to return the detected maximums. Can be done with PWM though.

Looking at the signal drawing it looks a bit like what a random voltage generator in a synthesizer would output. But I think these work with a clock, noise generator and a sample and hold circuit. Maybe it is possible to steal some bits of this idea?

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Peak Detector Circuit
« Reply #8 on: October 26, 2022, 07:15:14 pm »
Just because the signal is always positive doesn't mean you can't produce a virtual ground rail against which to do the crossing detection.

Depends on where the min and max levels will be in the signal. If a couple of maximums are below the virtual ground these might be missed.

Offline MasterT

  • Frequent Contributor
  • **
  • !
  • Posts: 851
  • Country: ca
Re: Peak Detector Circuit
« Reply #9 on: October 26, 2022, 07:22:31 pm »
High Pass Filtering would make signal bipolar. Interesting, that HPF is a differentiator...

True, but you loose the level then of what it originally was.
No, HPF is connected to zero-cross detector. Peak detector is running by input, no HPF on the line.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6403
  • Country: es
Re: Peak Detector Circuit
« Reply #10 on: October 26, 2022, 09:36:43 pm »
Not what I'd call simple using discrete parts.
If the wave is just 30Hz or so, use an ADC, 1KHz sample rate will be far enough and the software is nothing fancy.

But could be achieved using few inexpensive parts: 1x Quad Op-amp, 1x 74HC14, 1x 4016 cmos switch and some passives.
The clocks can be used to tell the MCU when start a conversion.
« Last Edit: October 26, 2022, 11:23:41 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline MathWizard

  • Super Contributor
  • ***
  • Posts: 1772
  • Country: ca
Re: Peak Detector Circuit
« Reply #11 on: October 28, 2022, 12:00:50 am »
Yeah you need something to reset your peak when the slope of the voltage changes negative again, then goes positive again.

That's probably pretty tricky, or the signal needs to be altered 1at to make it work better for the analog circuits. I've made basic op-amp integrator's/differentiator's, but I need to learn more on all that.

I bet with a microcontroller, and digital circuits, it's easy if you know programming.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf