Electronic – RMS value calculation using micro-controller

microcontroller

how to calculate the RMS value of an AC signal (220v,50c/s) using micro-controller.
i m using stm32f3 controller and its A/D convertor has 72MHZ clock frequency.

Best Answer

You can digitize samples of the waveform at a high frequency, square them, then feed that into a low-pass filter. Take the square root of the output of the LPF.

The cutoff frequency (and order) of the low pass filter is a trade-off between output ripple and response time (for example, after the input waveform changes). A simple IIR low pass filter might be sufficient.

Since you know the mains frequency there are faster-responding filters such as the boxcar filter Andy suggests, assuming you have enough RAM to support that approach and arrange things to have an integer number of samples in a power line cycle.