Power monitoring
Calculating power using P=VI
Volts (V)
Voltage in the UK is controlled at 230V, Ofgem permits a tolerance of -6% to +10%, which gives a voltage range of 216V to 253V.
I've assumed a constant 230V.
Current (I)
“Intensität” German for intensity... I had to look that up. I've never known.
I'm using an SCT-013 (specifcally a 10A per V) current clamp and ADS1115 ADC in differential mode read via python over I²C.
Circuit Hardware
This is the circuit, compared to the thing I produced the only item not included a 5v->3v DCDC buck converter because I wanted to run 5v up and into the roof rather than 3.3v.
The 5v + I²C run is around 3m with very fine (telco) 2 pair cable. The SCT-013 has a 1m lead.
The ADS1115 ADC is wired and read in differential mode to get an integer result that varies about 0.
The resistors (10k) and capacitor (10µF) create a "center" voltage of half the 3v3 supply to ensure that the ADC does not see the swing a -ve voltage with respect to 0v. The clamp I used is a 10A per V which means I probably can't safely read must more than 15A.
Python Code
This python script runs in a loop
import time
import board
import busio
import adafruit_ads1x15.ads1115 as ads1115
import rrdtool
i2c = busio.I2C(board.SCL, board.SDA)
ADS = ads1115.ADS1115(i2c, gain=1, data_rate=860, mode=ads1115.Mode.CONTINUOUS, address=0x48)
n = 15000
tot = 0
for i in range(0, n, 1):
s = ADS.read(0, True)
tot = tot + s**2
time.sleep (0.0004)
tot=tot/n
tot=tot**0.5
tot=int(tot*1.315)
rrdtool.update('/cisbin/rrd/ma.rrd', 'N:'+str(int(tot)))
time.sleep (1)
Calibration
The 1.315 above is a scalling factor I arrived at using an in line averaging RMS DVM and a haridryer to generate a 7A load that would produce a sine wave,
This allowed for accurate "calibration" of the True RMS scalling factor to match the reading on the DVM.
When the hairdryer is turned off the wave is no longer a sine wave. In the left port of the wave the DVM and True RMV calc were within 1% of each other, but after the hairdryer is turned off DVM under-reads - specifically during the last portion of the DVM shows 292mA vs the true RMS calc of 429mA. A more significant difference!