I have written a library to calculate true rms. It does not block or slow down the micro given that you don’t run the functions containing floating point math more than once a second.
I wrote this library for my own project where i have two circuits to reduce the sine wave into two voltages representing current and voltage. I have only run it on simulated sinewaves so i’m still expecting some work when i run it on the actual hardware.
Used an ESP32 to run the library during development and utilised second core to simulate two sinewaves. included an exaple sketch for the esp32.
The library contains four functions to calculate true RMS and two functions to get the power factor.
In addition to this there is four functions to get the approximated rms voltage. they require way less resources but only work if the wave to be measured is a perfect sinewave.
If anyone feels like having a look and telling me what you think that would be much appreciated.
Edit: added the library to a github repository : GitHub - RippoZero/WattCalc: General purpose AC wattmeter library
WattCalc.zip (4.48 KB)