Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
m16v2 energy meter - calibration issues
#1
Hi, hopefully someone can help where I'm having issues calibrating the m16v2 energy meter in the UK which is on 240v with 1 phase.

Currently I am only focusing on CT_15 which is the Grid, I have a Shelly EM using a 120a1v CT clamp which is on the same line as CT_15.

When attempting to calibrate with 2 resistive loads (not at the same time) it just simply falls out of line when then seeing real world usage after, for example I had turned on a 3000w kettle, the Shelly shown the correct load so I then calibrated the figures as recommended in Kincony code, then I tried a 1500w electric heater but instead of the load being somewhat close to the expected reading, it was instead 1900w.

Additionally, when on normal realworld load where the house has typical appliances on which would bring it to about 300w on the Shelly, the m16 instead reports that its 600w.

I can confirm that I have connected the m16 to the consumer unit as recommended so then it shows what the voltage is, which I can confirm is accurate when compared against the Shelly which reports basically the exact same voltage.

All clamps are 1v, and are shown in order of what they're used for along with the amp:
  • 1 - Shower - 50a
  • 2 - Cooker - 50a
  • 3 - Kithcen Ring - 30a
  • 4 - Dish Washer - 30a
  • 5 - Washing Machine - 20a
  • 6 - Tumble Dryer -  30a
  • 7 - Reserved
  • 8 - Reserved
  • 9 - Fridge - 20a
  • 10 - Reserved
  • 11 - Reserved
  • 12 - Reserved
  • 13 - Reserved
  • 14 - General Ring - 30a
  • 15 - Grid - 100a
  • 16 - Reserved


I've attached code currently being used.

Code:
esphome:
  name: m16v2

esp32:
  board: esp32dev
  framework:
    type: arduino

ota:
  - platform: esphome

external_components:
  - source:
      type: git
      url: https://github.com/hzkincony/esphome-zmpt101b
      ref: v2.1.0

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "D69bY/GXlmjYkovak6WIhgmbOH8vwyqvMxIHBriYoaY="

# Wifi Configuration
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true

i2c:
  sda: 4
  scl: 5
  scan: true
  id: bus_a

cd74hc4067:
  - id: cd74hc4067_1
    pin_s0: 32
    pin_s1: 33
    pin_s2: 13
    pin_s3: 16

web_server:
  port: 80

font:

  - file: "gfonts://Roboto"
    id: roboto
    size: 16

sensor:
  - platform: adc
    pin: 34
    id: adc34
    update_interval: never
    attenuation: 12db

  - platform: adc
    pin: 36
    id: adc36
    update_interval: never
    attenuation: 12db

  - platform: adc
    pin: 39
    id: adc39
    update_interval: never
    attenuation: 12db

  - platform: zmpt101b
    name: "L1 Voltage"
    # name: "m16--AI zmpt 34"
    sensor: adc34
    id: voltage_1
    sensitivity: 538

  - platform: adc
    pin: 35
    id: adc35
    update_interval: never
    attenuation: 12db

  - platform: cd74hc4067
    id: ai1
    number: 0
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai2
    number: 1
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai3
    number: 2
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai4
    number: 3
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai5
    number: 4
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai6
    number: 5
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai9
    number: 8
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai14
    number: 13
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai15
    number: 14
    sensor: adc35
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai1
    id: CT_1_Current
    name: "CT 1 Current"
    update_interval: 5s
    filters:
      # 50a 1v CT clamp on a known 8.5kw shower
      - calibrate_linear:
          - 0 -> 0
          - 1 -> 50
      - lambda: if(x < 0.2) return 0; else return x;

  - platform: template
    id: CT_1_Power
    name: "CT 1 Power"
    lambda: return id(CT_1_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai2
    id: CT_2_Current
    name: "CT 2 Current"
    update_interval: 5s
    filters:
      # 50a 1v CT clamp on a cooker
      - calibrate_linear:
          - 0 -> 0
          - 1 -> 50
      - lambda: if(x < 0.25) return 0; else return x;

  - platform: template
    id: CT_2_Power
    name: "CT 2 Power"
    lambda: return id(CT_2_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai3
    id: CT_3_Current
    name: "CT 3 Current"
    update_interval: 5s
    filters:
      - calibrate_linear:
          - 0 -> 0
          - 8.24 -> 11.68
      - lambda: if(x < 0.05) return 0; else return x;

  - platform: template
    id: CT_3_Power
    name: "CT 3 Power"
    lambda: return id(CT_3_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai4
    id: CT_4_Current
    name: "CT 4 Current"
    update_interval: 5s
    filters:
      # 30a 1v CT clamp - Dish Washer
      - calibrate_linear:
          - 0 -> 0
          - 1 -> 30
      - lambda: if(x < 0.1) return 0; else return x;

  - platform: template
    id: CT_4_Power
    name: "CT 4 Power"
    lambda: return id(CT_4_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai5
    id: CT_5_Current
    name: "CT 5 Current"
    update_interval: 5s
    filters:
      # 20a 1v CT clamp - washing machine
      - calibrate_linear:
          - 0 -> 0
          - 1 -> 20
      - lambda: if(x < 0.1) return 0; else return x;

  - platform: template
    id: CT_5_Power
    name: "CT 5 Power"
    lambda: return id(CT_5_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai6
    id: CT_6_Current
    name: "CT 6 Current"
    update_interval: 5s
    filters:
      # 30a 1v CT clamp - tumble dryer
      - calibrate_linear:
          - 0 -> 0
          - 1 -> 30
      - lambda: if(x < 0.1) return 0; else return x;

  - platform: template
    id: CT_6_Power
    name: "CT 6 Power"
    lambda: return id(CT_6_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai9
    id: CT_9_Current
    name: "CT 9 Current"
    update_interval: 5s
    filters:
      # 20a 1v CT clamp - Fridge
      - calibrate_linear:
          - 0 -> 0
          - 1 -> 20
      - lambda: if(x < 0.05) return 0; else return x;

  - platform: template
    id: CT_9_Power
    name: "CT 9 Power"
    lambda: return id(CT_9_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai14
    id: CT_14_Current
    name: "CT 14 Current"
    update_interval: 5s
    filters:
      # 30a 1v CT clamp - General ring
      - calibrate_linear:
          - 0 -> 0
          - 1 -> 30
      - lambda: if(x < 0.05) return 0; else return x;

  - platform: template
    id: CT_14_Power
    name: "CT 14 Power"
    lambda: return id(CT_14_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s

  - platform: ct_clamp
    sensor: ai15
    id: CT_15_Current
    name: "CT 15 Current"
    update_interval: 5s
    filters:
      - calibrate_linear:
          method: exact
          datapoints:
            - 0.0 -> 0.0
            - 0.016 -> 1.62
            - 4.85 -> 5.88
            - 8.26 -> 13.58
 
  - platform: template
    id: CT_15_Power
    name: "CT 15 Power"
    lambda: return id(CT_15_Current).state * id(voltage_1).state;
    device_class: power
    unit_of_measurement: "W"
    update_interval: 5s
 
  - platform: total_daily_energy
    name: "CT 15 Total Daily Energy"
    power_id: CT_15_Power
    unit_of_measurement: kWh
    accuracy_decimals: 3
    device_class: energy
    state_class: total_increasing
    filters:
      - multiply: 0.001

time:
  - platform: sntp
    id: my_time
Reply
#2
Add more calibrations
different current data, Because it's not a linear relationship. The more calibration data, the more accurate it is.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)