Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Voltage output from DAC module, Obtaining the Pk-Pk Value

  1. Apr 8, 2016 #1
    I have a sine wave produced as an output, which varies. This sine wave has been filtered by a moving average filter. From this output, coming out of a DAC module, I need to obtain the the voltage peak-peak value and store it preferably in an array.
    How can I do this?
    More importantly how can I obtain my voltage peak-peak value?
  2. jcsd
  3. Apr 8, 2016 #2


    Staff: Mentor

    That depends entirely on how the moving average filter works . Can you tell us more?
  4. Apr 8, 2016 #3
    The moving average filter is done via code. Essentially I am taking data points from the ADC module and storing these into an array. Each time I get a new data point the moving average is calculated. The calculated data is then passed onto the DAC module to deal with and output it.

    Essentially this is being done to filter out noise.
  5. Apr 8, 2016 #4


    Staff: Mentor

    • I'm confused. You have a signal that you filter and send to a DAC as an output. Then you want the peak value of the output to input again to store in an array.
    • The average of a sin over an integer number of cycles is zero by definition.
    • Despite the confusion I think RMS is your answer. Calculate the RMS of the sin and multiply by ##\sqrt 2## to get peak. Look up RMS on Wikipedia to see how to do that. Your sampling rate should be more than 10x the frequency of the sin.
  6. Apr 9, 2016 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    A moving average filter is a low pass filter. If the period over which the average is taken is small relative to the period of the sin wave then it will have little effect on the peak to peak value. At the other extreme (long averaging time) you get zero output as anorlunda says.

    However all this appears irrelevant to your question which is...

    You could put the analogue output of the DAC through an ADC and use code to calculate and log the peak to peak value. Peaks can be detected by looking for the point at which the slope changes from positive to negative or negative to positive.

    If you already have access to the digital data going to the DAC (eg all this is being done on one microprocessor) you could process that data to measure the peak to peak values avoiding the need for an ADC.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted