Ankur Kashyap said:
I have a variable amplitude 0-5V square wave of variable freq .5 - 10
MHz with 50% duty cycle. I need to find the peak voltage level
accurately to .1V precision. How can i do this. Remember voltage &
freq range.
Ah, thank you for answering the questions!
There is a fundamental issue you will run into with any approach you take,
which is that it's in principle impossible to measure the "DC" value of any
changing signal, because you'd have to sample it for an infinite amount of
time; but in practice, this just means that you have to choose a time
constant and call anything that happens faster than that "AC" and anything
that happens slower "DC". To understand the problem, think about what
reading you want to get during the times when the signal level is changing -
for instance, if you quickly moved the signal level back and forth between
1v or 5v. What is the "DC" level you want in that case? Do you want to see
a constant 3V, or do you want to see a square wave going between 1V and 5V?
What does "quickly" mean in this context?
Anyway, here are some practical approaches:
- use an RC low-pass filter, with a cutoff appreciably below your operating
frequency, to measure the average DC value. Then multiply by 2. The
response time of this approach is related to the RC time constant: that is,
if you have a filter where R*C = 100msec, and the signal level changes, it
will take a few hundred msec for the new value to stabilize. So, use an RC
time constant around 1 msec, and that way you will filter out virtually all
of your signal's AC content and you will still get a stable reading within
10 msec or so of a change. (Make sure your R is appreciably larger than the
source impedance, or else use a buffer of some sort.)
- use a peak detector - basically a diode and a capacitor, wrapped by an
opamp; look in National Semiconductor's linear application notes or Google
for "peak detector" to find circuits. You still have to choose a time
constant; in this case it is the time that the peak is held (you can't hold
it forever, or else when the signal level goes down you'll still be reading
the old value). As long as you hold the peak within 1% for 1usec, your spec
will be met.
- get fancy and do something with DSP. But I wouldn't bother. The RC
filter is a simple and very adequate approach, depending on how fast you
need to be able to detect changes in the signal level, and it only takes two
inexpensive components!