Hi. I am doing a project that requires measuring the power output of a phase powered controller (Kemo Controller). By looking at the current output using a oscilloscope, I can confirm that this controller works on the principle of a SCR, i.e this is what it does to the output current:

For measuring the power, I am using a ESP32 coupled with a voltage transformer and a current transformer. I also tried on of the hall current sensors. For the software part I am using the EmonLib from OpenEnergyMonitor modified for the ESP32 ADC (GitHub of said library). I followed the calibration procedure, using an external power meter for reference and managed to calibrate the current sensor for a maximum usage current of 7A. Here is the code with the instructions on how to calibrate the current sensor:
/* Calibrates the current sensor (SCT013)*/
/* ----------------------------------------------------*/
/* Instructions:
1. Set up the hardware, the potentiometer of the voltage sensor should be already adjusted.
2. Find an "almost pure" resistive load (no motors, no reactors, no electromagnets, no LEDs). Examples: heater, boiler, electric shower, electric oven, kettle...
3. Install a voltmeter and ammeter to use as reference.
4. Connect the voltage measurement and current measurement sensors.
5. Edit the sketch *calibrate-vi.ino* and set the correct GPIO pins for the sensors.
6. Set the calibration coefficients CV1, CV2, CV3, CI1, CI2 and CI3 to 1000 in the same file.
7. Compile and update the code from Arduino IDE.
8. Watch the values in the serial terminal and wait for them to stabilize. Use 115200bps as baud rate.
9. Take a note of the measured current (I) and voltage (V) from the ESP32 and the current and voltage from the reference voltmeter (Vr) and ammeter (Ir).
10. Calculate the calibration factors: CVnew = Vr*CVold/V, CInew = Ir*CIold/I where CVold and CIold are the previous calibrations from the sketch (initially 1000).
11. Change the values under the "Calibration" section of the code to the calculated ones (CInew and CVnew).
12. Compile and upload the code again, watch the serial monitor until the data stabilizes and then check if the measurements are correct.
13. Repeat steps 8 to 12 if necessary.
*/
#include "EmonLib.h" // Include Emon Library
#define ESP32
// Pin configuration
// #define V1 34
// #define I1 35
#define V2 34
#define I2 35
// Calibration settings (allways start with 1000)
#define CV1 872
#define CI1 10.00
#define CV2 872
#define CI2 10.01
EnergyMonitor emon1;
EnergyMonitor emon2;
void setup() {
Serial.begin(115200);
/*
Analog attenuation:
ADC_0db: sets no attenuation. ADC can measure up to approximately 800 mV (1V input = ADC reading of 1088).
ADC_2_5db: The input voltage of ADC will be attenuated, extending the range of measurement to up to approx. 1100 mV. (1V input = ADC reading of 3722).
ADC_6db: The input voltage of ADC will be attenuated, extending the range of measurement to up to approx. 1350 mV. (1V input = ADC reading of 3033).
ADC_11db (default): The input voltage of ADC will be attenuated, extending the range of measurement to up to approx. 2600 mV. (1V input = ADC reading of 1575).
*/
// analogSetPinAttenuation(V1, ADC_11db);
// analogSetPinAttenuation(I1, ADC_11db);
// Phase 1
// emon1.voltage(V1, CV1, 1.7); // Voltage: input pin, calibration, phase_shift
// emon1.current(I1, CI1); // Current: input pin, calibration.
// Phase 2
emon2.voltage(V2, CV2, 1.732); // Voltage: input pin, calibration, phase_shift
emon2.current(I2, CI2); // Current: input pin, calibration.
// Phase 3
// emon3.voltage(V3, CV3, 1.732); // Voltage: input pin, calibration, phase_shift
// emon3.current(I3, CI3); // Current: input pin, calibration.
}
void loop() {
Serial.println("------------");
// emon1.calcVI(120, 2000); // Calculate all. No.of half wavelengths (crossings), time-out
// emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
// Serial.printf("V1: %.2f, I1: %.2f \n", emon1.Vrms, emon1.Irms);
// Serial.printf("realPower: %.2f, apparentPower: %.2f, powerFactor: %.2f \n", emon1.realPower, emon1.apparentPower, emon1.powerFactor);
emon2.calcVI(60, 1000); // Calculate all. No.of half wavelengths (crossings), time-out
Serial.printf("V2: %.2f, I2: %.2f \n", emon2.Vrms, emon2.Irms);
Serial.printf("realPower: %.2f, apparentPower: %.2f, powerFactor: %.2f \n", emon2.realPower, emon2.apparentPower, emon2.powerFactor);
}
With this I managed to get a steady and accurate reading of 7A. However when I adjust the output power (which is connected to a heating element), so as to change the load current, I notice that the accuracy is severely compromised when I move from the calibrated value. For example at 1A output current on the power meter, the ESP32 reads 2A.
Could the SCR output waveform have any effect on the accuracy of using the EmonLib with a ESP32? I have tried with different current sensors and the end result is the same... Also, when comparing commercial power meters I find that while the power measurement is basically the same, the current measurement is very different. I used a Voltcraft power meter ($75) and a Wago power meter ($250) and the current measured at 6A on the Voltcraft was 4A on the Wago....
Any input or ideas on how to tackle this project would be highly appreciated!
Best,
Pablo
