Square wave peak voltage value

Thread Starter

Dollarday

Joined Jan 25, 2012
32
Hi people! :D

Can you please help me with the following problem:

I have an aperiodic square wave communication signal of 3.3V.

The signal has variable (and unknown) DC offset.

I would like to make a circuit that outputs the peak voltage of the signal at ANY given moment.
(For example, if the DC offset voltage is 2,2V, the peak of the square wave is 3,3 + 2,2 = 5,5V and the circuit should output 5,5V)
If the DC offset voltage changes to 1,1 the peak voltage of the square wave is 3,3 + 1,0 = 4,3V and the circuit should output 4,3V)

Any ideas how I might achieve this?

Preferably an analogue solution, the only thing I can come up with is:
a) Use an ADC to sample the voltage over a small timeframe
b) Use a microcontroller and code to find the highest voltage in that timeframe
c) Use a DAC to display the peak voltage

I'm sure someone out there has a more elegant solution :cool:

Regards,
Dollarday
 

wayneh

Joined Sep 9, 2010
16,834
So, you want your offset to be determined by ONLY the most recent "low", as opposed to, say, an average of the last 3 lows?

I think your approach is about right. Just keep sampling and accumulate an average (for better precision, to minimize noise) into avgLO unless/until you see a new sample with a value more than, say, 20% higher. Resample into a new container avgHI to accumulate the new average. At any time, you could grab avgHI-avgLO as your best estimate of the ∆.
 

ramancini8

Joined Jul 18, 2012
473
Put your signal into an ac amplifier to strip out the dc content, then differentiate the signal (can be one circuit) to obtain a leading edge pulse, Use this pulse to trigger a peak sample hold, use the trailing edge pulse to reset the PSH. All of these circuits can be found in the National Semiconductor Linear Applications book.
 
Top