Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AC voltage and calibration
#11
Hi,

I'm sorry but I don't know how to perform a calibration when I have these values. What values am I supposed to use?
I tried with different attenuation settings for the ADC but always end up with jumpy values:


- no load connected: 'ai1': Sending state 1.03200 V with 3 decimals of accuracy
- 100W light bulb: 1.0360V
- 500W light bulb: 1.0310V

So I don't really see sensible values.  Power factor of test devices is 100.
Jumper setting is set to V instead of A.  Even tried switching them but don't see differences in the values.

From code example I see:

      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608


=> but I don't have input values for the mapping. They are all random and in the same range regardless if there is load connected or how heavy it is.
Is something missing in the code/config?
Reply
#12
1. when AC cureent is 0A, then see your LOG what's RAW value "X".
2. use a large power AC load, use multi meter to test AC current value "Z". then see your LOG what's RAW value "Y".

use these two value make the map.
- X -> 0
- Y -> Z
Reply
#13
(12-19-2023, 11:12 AM)admin Wrote: 1. when AC cureent is 0A, then see your LOG what's RAW value "X".
2. use a large power AC load, use multi meter to test AC current value "Z". then see your LOG what's RAW value "Y".

use these two value make the map.
- X -> 0
- Y -> Z

My apologies, but I was confused and thought the calibration was done with the voltages of the ADC.  The "raw" amps in the output make more sense and are steady.
So I was confused there.

Will do the mappings like that and report back.
Reply
#14
you can try it, hope you work fine.
Reply
#15
Hi,

While doing the calibration I see that for some measurements I have more samples. These measurements are much more accurate compared to these with for example only 50 SPS.
Makes sense, and therefore I want to perform calibration with all higher settings since I'm using constant loads with power factor 100.

But I don't find how I can configure esphome to have all measurements with higher SPS values.
If've tried sample_interval for the ct_clamp sensor but that doesn't seem to have effect.
I do see a lot of entries of "switch to input X" which follow eachother very quickly, maybe I need to delay that somehow?

Line 638: [20:51:05][D][ct_clamp:041]: 'Measured Current-16' - Raw AC Value: 0.015A after 469 different samples (2345 SPS)
Line 651: [20:51:05][D][ct_clamp:041]: 'Measured Current-8' - Raw AC Value: 0.014A after 324 different samples (1620 SPS)
Line 702: [20:51:06][D][ct_clamp:041]: 'Measured Current-14' - Raw AC Value: 0.012A after 10 different samples (50 SPS)
Line 704: [20:51:06][D][ct_clamp:041]: 'Measured Current-13' - Raw AC Value: 0.015A after 10 different samples (50 SPS)
Line 706: [20:51:06][D][ct_clamp:041]: 'Measured Current-3' - Raw AC Value: 0.029A after 10 different samples (50 SPS)
Line 708: [20:51:06][D][ct_clamp:041]: 'Measured Current-9' - Raw AC Value: 0.013A after 8 different samples (40 SPS)
Line 715: [20:51:06][D][ct_clamp:041]: 'Measured Current-5' - Raw AC Value: 0.025A after 370 different samples (1850 SPS)


Any tips on how to get high SPS values like clamp 16, 8 and 5 in example above?

Regards,
Nick
Reply
#16
sorry, M16v2 work at this level of accuracy, we are developing a higher precision board --M30.
Reply
#17
(12-31-2023, 02:03 PM)admin Wrote: sorry, M16v2 work at this level of accuracy, we are developing a higher precision board --M30.

Hi,

I do get more stable results when I only enable 4 or 5 CT's in the config. I don't know much about electronics but I guess it's more of a timing issue when the multiplexer switches between the 16 inputs. Maybe this could be improved in software by using some kind of manual iteration/control over which inputs are being read?
Can you share some high level details about the future M30 board?  What would essentially be different with this board?

Now that I know this, I will try to finalize my setup and later report back on the results?

Regards,
Nick
Reply
#18
you can set some delay for multiplexer switches, not read too fast.
M30 board will use BL0910 energy chip to read all data, integrate to home assistant by ESPHome.
Reply
#19
Hi again,

I spent some time performing calibration and the results are quite ok in terms of accuracy. I understand with the M16v2 it cannot offer higher accuracy.

This is what I did:
- during calibration I only enabled 4 CT-clamps at a time with 10 second update interval => this gave me nice consistent readings.
- used different stable loads and measured 4 values each => these were all very consistent (good!)
- Sample entry for one of the clamps (a SCT003 1v 20A)
Code:
  - platform: ct_clamp
    sensor: ai16
    id: Measured_Current_16
    name: "Measured Current-16"
    sample_duration: 500ms
    update_interval: 20s
    filters:
    - calibrate_linear:
      - 0.005060 -> 0
      - 0.009490 -> 0.253
      - 0.013850 -> 0.409
      - 0.056480 -> 1.775
      - 0.114445 -> 3.61
      - 0.204695 -> 6.49
      - 0.286630 -> 9.01
      - 0.340460 -> 10.684
      - 0.535860 -> 16.89


So values are ok and stable when I only enable a few CT's at a time.  CT's 12/13/14/15/16 are enabled in example below.
I get stable log entries like this:

Code:
[11:01:44][D][ct_clamp:049]: 'Measured Current-14' - Raw AC Value: 0.009A after 1098 different samples (2196 SPS)
[11:01:44][D][sensor:094]: 'Measured Current-14': Sending state 0.21913 A with 2 decimals of accuracy
[11:01:45][D][cd74hc4067:036]: switch to input 15
[11:01:45][D][ct_clamp:049]: 'Measured Current-16' - Raw AC Value: 0.009A after 1123 different samples (2246 SPS)
[11:01:45][D][sensor:094]: 'Measured Current-16': Sending state 0.24789 A with 2 decimals of accuracy
[11:01:56][D][cd74hc4067:036]: switch to input 14
[11:01:57][D][ct_clamp:049]: 'Measured Current-15' - Raw AC Value: 0.009A after 1100 different samples (2200 SPS)
[11:01:57][D][sensor:094]: 'Measured Current-15': Sending state 0.23451 A with 2 decimals of accuracy
[11:01:59][D][cd74hc4067:036]: switch to input 12
[11:02:00][D][ct_clamp:049]: 'Measured Current-13' - Raw AC Value: 0.009A after 1056 different samples (2112 SPS)
[11:02:00][D][sensor:094]: 'Measured Current-13': Sending state 0.25112 A with 2 decimals of accuracy
[11:02:01][D][cd74hc4067:036]: switch to input 11
[11:02:02][D][ct_clamp:049]: 'Measured Current-12' - Raw AC Value: 0.009A after 1119 different samples (2238 SPS)
[11:02:02][D][sensor:094]: 'Measured Current-12': Sending state 0.22835 A with 2 decimals of accuracy
[11:02:03][D][cd74hc4067:036]: switch to input 13
[11:02:04][D][ct_clamp:049]: 'Measured Current-14' - Raw AC Value: 0.009A after 1105 different samples (2210 SPS)
[11:02:04][D][sensor:094]: 'Measured Current-14': Sending state 0.20907 A with 2 decimals of accuracy
[11:02:05][D][cd74hc4067:036]: switch to input 15
[11:02:05][D][ct_clamp:049]: 'Measured Current-16' - Raw AC Value: 0.009A after 1130 different samples (2260 SPS)
[11:02:05][D][sensor:094]: 'Measured Current-16': Sending state 0.24624 A with 2 decimals of accuracy
[11:02:16][D][cd74hc4067:036]: switch to input 14
[11:02:17][D][ct_clamp:049]: 'Measured Current-15' - Raw AC Value: 0.009A after 1108 different samples (2216 SPS)
[11:02:17][D][sensor:094]: 'Measured Current-15': Sending state 0.23638 A with 2 decimals of accuracy
[11:02:19][D][cd74hc4067:036]: switch to input 12
[11:02:20][D][ct_clamp:049]: 'Measured Current-13' - Raw AC Value: 0.008A after 1074 different samples (2148 SPS)
[11:02:20][D][sensor:094]: 'Measured Current-13': Sending state 0.24264 A with 2 decimals of accuracy
[11:02:21][D][cd74hc4067:036]: switch to input 11
[11:02:22][D][ct_clamp:049]: 'Measured Current-12' - Raw AC Value: 0.009A after 1136 different samples (2272 SPS)
[11:02:22][D][sensor:094]: 'Measured Current-12': Sending state 0.23493 A with 2 decimals of accuracy
[11:02:23][D][cd74hc4067:036]: switch to input 13
[11:02:24][D][ct_clamp:049]: 'Measured Current-14' - Raw AC Value: 0.009A after 1099 different samples (2198 SPS)
[11:02:24][D][sensor:094]: 'Measured Current-14': Sending state 0.21810 A with 2 decimals of accuracy
[11:02:25][D][cd74hc4067:036]: switch to input 15
[11:02:25][D][ct_clamp:049]: 'Measured Current-16' - Raw AC Value: 0.009A after 1135 different samples (2270 SPS)
[11:02:25][D][sensor:094]: 'Measured Current-16': Sending state 0.24192 A with 2 decimals of accuracy


So just switching inputs one time and high enough SPS values.
Variations in readings are ok.


But when I enable additional CT's it seems it start flipping on switching between certain inputs.
I get multiple "switch to input" lines at the same second.
Code:
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:13][D][cd74hc4067:036]: switch to input 9
[11:16:13][D][cd74hc4067:036]: switch to input 12
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 12
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 12
[11:16:14][D][ct_clamp:049]: 'Measured Current-13' - Raw AC Value: 0.008A after 52 different samples (104 SPS)
[11:16:14][D][sensor:094]: 'Measured Current-13': Sending state 0.23959 A with 2 decimals of accuracy
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 13
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 13
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 13
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 13
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 13
[11:16:14][D][cd74hc4067:036]: switch to input 9
[11:16:14][D][cd74hc4067:036]: switch to input 13
[11:16:14][D][ct_clamp:049]: 'Measured Current-10' - Raw AC Value: 0.009A after 535 different samples (1070 SPS)
[11:16:14][D][sensor:094]: 'Measured Current-10': Sending state 0.21895 A with 2 decimals of accuracy
[11:16:14][D][ct_clamp:049]: 'Measured Current-14' - Raw AC Value: 0.009A after 973 different samples (1946 SPS)
[11:16:14][D][sensor:094]: 'Measured Current-14': Sending state 0.21384 A with 2 decimals of accuracy
[11:16:15][D][cd74hc4067:036]: switch to input 7
[11:16:15][D][cd74hc4067:036]: switch to input 8
[11:16:15][D][cd74hc4067:036]: switch to input 7
[11:16:15][D][cd74hc4067:036]: switch to input 8
[11:16:15][D][cd74hc4067:036]: switch to input 7
[11:16:15][D][cd74hc4067:036]: switch to input 8
[11:16:15][D][cd74hc4067:036]: switch to input 7
[11:16:15][D][cd74hc4067:036]: switch to input 8

And this results in lower SPS values/less samples.
[11:16:14][D][ct_clamp:049]: 'Measured Current-13' - Raw AC Value: 0.008A after 52 different samples (104 SPS)


I guess this is a timing issue in esphome. I'm not a developer. 
So once you start using too many clamps at the same time you get this behavior and when you have lower samples/SPS you get fluctuating readings.


Isn't there a way to control this switching?
Regardless of the update_interval you get this.  Maybe there is a way to poll each CT manually and define your own timings?
Like with 16 CT's that you would poll each second that would give you good enough results I think.

I guess this is a generic esphome timing issue, but hopefully somebody has any suggestions.

Regards,
Nick
Reply
#20
thanks for sharing your result. maybe you can also post this problem to ESPHome forum.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)