Measuring AC peak or rms

I have a voltage that is too small to be rectified that i want to read on the analog to digital converter. If i have a 1Vpp sine wave, can i program to only read the peak or rms value. I can add a dc offset so the midpoint is 2.5V, therefore the wave does not drop below 0 (or 1.5) so it should be in the 0-5VDC input range. I just need to know how to get the peak value from the wave. I cannot find any information on this online and would really appreciate some help

I also want to avoid using a voltage amplifier

Thanks

I actually posted about something very similar yesterday. See this post to describe how to calculate RMS of an AC waveform once it's been reduced to within 0-5V and centered at 2.5V -> http://forum.arduino.cc/index.php?topic=381177.msg2629008#msg2629008

To make this a peak algorithm, you'll need track the max and min sample of each cycle. You'll get a more accurate peak if you sample more often, but you'll find it doesn't get much better once you're at 64 samples per cycle. You can see this by playing around with the spreadsheet model in my post.

You shouldn't need a voltage amplifier. Sure more signal would improve accuracy, but 1V is plenty for a valid measurement.

To get the peak-to-peak value, sample very rapidly (at least 100x the input frequency) and take the maximum and minimum values.

jremington:
To get the peak-to-peak value, sample very rapidly (at least 100x the input frequency) and take the maximum and minimum values.

I just want peak value, so how do I just take the max value readings???

In pseudocode:

``````max = 0
loop {