Sinusoidal AC Voltage Measurement

I need help with making an Arduino sketch to measure the ADC1 input, and determine how many digits I should display beyond the decimal point based on the ADC accuracy. I need to set the sampling rate to 125kHz and use Free Running mode to determine the minimum voltage, the maximum voltage, and the period and display the results on the Serial Monitor every second

That post is SO specific, it reads like a class assignment.


I need to set the sampling rate to 125kHz

The regular Arduino (ATmega chip) can’t sample that fast and above 15kHz you loose resolution.

And, it can be damaged by negative voltage (and it doesn’t read negative voltages) so you either need to bias the input, or protect the input from negative voltages and ignore the negative half of the waveform. (If you know you have a sine wave you don’t need the negative half cycle.

minimum voltage, the maximum voltage,

The "minimum " voltage of an AC waveform is zero. :wink: That’s assuming a regular unbiased AC waveform, or after the bias has been subtracted.

The minimum and maximum voltages are negative and positive respectively in an AC waveform.

Minimum amplitude or minimum rms voltage is something else entirely.