In my previous project log, I wanted to send the calibration factor and the expected value directly to the teensy. I found it was easier to just calculate the conversion factor directly and send that value over. This saves some calculations and makes the overall program a little bit simpler.
And it works very well.
After plugging it in, you can measure the voltage with a multimeter (or just assume 230 V (more inaccurate)). The measured value van be entered into a value field.
The function the reads 10 values from the teensy and calculates the mean. The conversion factor is then calculated by
conv_factor = expected / rms_code .
Because the conversion factors are usually in the range of 10^-6 to 10^-5. Because of the necessary accuracy, the bitwidth for the fixed-point values was increased to 24 bit, with 23 fractional bits. With a press on the red button, this value is then sent to the teensy, which stores it in its EEPROM.
At startup of the GUI, when connecting to the teensy, these values are synchronized.
The IRMS calibration works analogous.
Here is a screenshot of the VRMS calibration: