This is possible.
Full wave rectifier circuit (Rail to rail op-amps).
Op-amp supply voltage 2 x the Arduino supply voltage.
I am using a small circuit a "full wave" rectifier circuit to change the sine wave signal from a signal going from a positive value to a negativ value oround zero to a signal going from zero to the peak value of the signal.
By using an op-amp designed as a rail-to-rail op-amp the specifications for the signal handling can be as high as a peak - peak value of 9.8V / peak value 4.9V of the measured signal.
To handle this signal the op-amp is driven by a supply volte of +/- 5V.
This is not a problem for the Arduino analog input because the rectifier ensures the output voltage of the circuit is never less then zero and the op-amp will be clipping peak signals higher 5V.
The calculation also run faster on Arduino, because the Arduino "see" the signal at double frequency, which means the sample time can be reduced up to 50% or the measuring presicion can be significant improved.
This can be used for measuring:
• RMS
• Peak-Peak
• Peak
• Average
voltage of a sine signal
This is a code used for measuring the rectified sine voltage.
// --- sub variables --------------------------------------
int uMax = 0, Uin = 0, SampleTime = 50;
unsigned long startMillis = millis();
// --- sampling -------------------------------------------
while (millis() - startMillis < SampleTime){
Uin = analogRead(0);
uMax = max(uMax, Uin);
}
// --- voltage calculation -------------------------------
mVrms = (uMax * 5.0 * 1000 / 1024) / sqrt(2);
mVpp = (uMax * 5.0 * 1000 / 1024) * 2;
mVp = (uMax * 5.0 * 1000 / 1024);
mVavg = (uMax * 5.0 * 1000 / 1024) * (2 / 3.14);
edit: this is the idea of the use of a full wave rectifier for Arduino ADC