01-07-2024, 10:29 AM
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)
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:
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.
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
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