Hey everyone,
I am currently trying to get a CT Clamp (SCT013-030) with a Wemos D1 Mini to work. I have set up the following circuit on a breadboard to get some test results:
Unfortunately i am always getting 1,643V on A0. It doesn’t matter how much current is drawn from my test lamp.
Can anyone tell me where my thinking error is?
If you’re using a SCT013-030, it should have an internal burden resistor, which I believe would make R1 unnecessary, IIRC…
R2 and R3 and being used to level shift the the output of the CT (RED) by +1.65V, as the output of the CT will vary from -1V to +1V.
Here is an example wiring diagram I found for a similar SCT013-020 CT. You can see that your “R1” resistor is included inside the CT packaging. Just be sure to not use 5V with an ESP8266 or ESP32. Use the 3.3V as wisely mentioned below my @tom_l.
Note: If you’re using a SCT013 CT that does not output a voltage, but rather outputs a current, you will need the R1 burden resistor shown in your circuit.
@ogiewon
Thanks for the detailed answer! I did know that the Clap has an resistor inside. So i have now removed mine.
Unfortunately it is the same as before. 1,643 Volts between GND and A0 (with a voltage divider with 10k resistors).
@tom_l
Yes VCC is misleading here. R2 is connected to 3.3V
How are you measuring the voltage? It should average to 1.643VDC, with a 50-60HZ AC signal on top of it. The ESP8266 will need to sample the analog input at very high frequencies to be able to ‘see’ the AC signal and convert it into a power reading.
With that i get the following readings (with a 60 Watt light bulb which should be around 260mA):
With load:
[08:18:43][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:43][D][sensor:092]: ‘adc_sensor’: Sending state 0.52051 V with 2 decimals of accuracy
[08:18:48][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:48][D][sensor:092]: ‘adc_sensor’: Sending state 0.52148 V with 2 decimals of accuracy
[08:18:51][D][ct_clamp:051]: ‘My Current Sensor’ - Raw Value: 0.00A
[08:18:51][D][sensor:092]: ‘My Current Sensor’: Sending state 0.00330 A with 2 decimals of accuracy
[08:18:53][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:53][D][sensor:092]: ‘adc_sensor’: Sending state 0.52148 V with 2 decimals of accuracy
[08:18:58][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:58][D][sensor:092]: ‘adc_sensor’: Sending state 0.52246 V with 2 decimals of accuracy
[08:19:01][D][ct_clamp:051]: ‘My Current Sensor’ - Raw Value: 0.00A
[08:19:01][D][sensor:092]: ‘My Current Sensor’: Sending state 0.00329 A with 2 decimals of accuracy
Without load:
[08:18:08][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:08][D][sensor:092]: ‘adc_sensor’: Sending state 0.52344 V with 2 decimals of accuracy
[08:18:11][D][ct_clamp:051]: ‘My Current Sensor’ - Raw Value: 0.00A
[08:18:11][D][sensor:092]: ‘My Current Sensor’: Sending state 0.00017 A with 2 decimals of accuracy
[08:18:13][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:13][D][sensor:092]: ‘adc_sensor’: Sending state 0.52344 V with 2 decimals of accuracy
[08:18:18][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:18][D][sensor:092]: ‘adc_sensor’: Sending state 0.52344 V with 2 decimals of accuracy
[08:18:21][D][ct_clamp:051]: ‘My Current Sensor’ - Raw Value: 0.00A
[08:18:21][D][sensor:092]: ‘My Current Sensor’: Sending state 0.00015 A with 2 decimals of accuracy
[08:18:23][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:23][D][sensor:092]: ‘adc_sensor’: Sending state 0.52344 V with 2 decimals of accuracy
[08:18:28][D][adc:056]: ‘adc_sensor’: Got voltage=0.52V
[08:18:28][D][sensor:092]: ‘adc_sensor’: Sending state 0.52344 V with 2 decimals of accuracy
[08:18:31][D][ct_clamp:051]: ‘My Current Sensor’ - Raw Value: 0.00A
[08:18:31][D][sensor:092]: ‘My Current Sensor’: Sending state 0.00015 A with 2 decimals of accuracy
i have now switched to an esp32 to measure three phases (the esp8266 was just for testing while I wait for my order to come in).
After wiring up the following circuit:
TBH I didn’t think your setup completely through, but when I saw your 1.10V reading, this immediately reminded me of a similar problem I had getting correct values from that sensor:
I’m not sure why you are getting the 1.10V even when the light bulb is off, but you should keep in mind, that you may just always see the maximum voltage an ESP32 ADC sensor returns with the attenuation set to default.
The ADC in the ESP32 has a range of 0 to 1.1v.
The voltage divider sets the midpoint between 0 and 3.3V (= 1.65v) as a DC bias.
1.65V is higher than the max V of the ADC so its saturated.
The ESP32 has an attenuator, and setting it to 11db may help…
I have been using the CT Clamp for over a year and I recently found that when my load is OFF (no current) I get nan - I think this did not happen in the past but not sure:
[D][ct_clamp:038]: 'Water Boiler Power Power [W]' - Raw AC Value: nanA after 2819 different samples (563 SPS)e
[D][sensor:113]: 'Water Boiler Power Power [W]': Sending state nan W with 1 decimals of accuracye
When It is on it seems to work fine
[D][ct_clamp:038]: 'Water Boiler Power Power [W]' - Raw AC Value: 0.106A after 6120 different samples (1224 SPS)e
[D][sensor:113]: 'Water Boiler Power Power [W]': Sending state 0.10638 W with 1 decimals of accuracye
My code is
- platform: ct_clamp
sensor: adc_sensor
name: "${friendly_name} Power [W]" #" Current [A]"
unit_of_measurement: "W"
sample_duration: 5s
update_interval: 10s
accuracy_decimals: 1
Sorry to ask this 12 months later - but why not use the 5V? I have set up a test with both 5V and 3.3V and both work. Is it for additional voltage from the CT? (I have measured this in case and it is miniscule)
You want to bias the ADC to half its supply rail voltage(3.3V/2 = 1.65 ) so it can pick up the maximum positive and negative voltage swing, +/- 1.65V. If you use the 5V rail it will be biased to 5/2 = 2.5V, allowing a 2.5V negative swing but only 3.3 - 2.5 = 0.8V positive swing.
If your generated voltage from the CT is small enough you won’t notice any difference. Unless the component uses this 1.65v in it’s calculations. However start generating AC voltages bigger than 0.8V and the positive value will clip, giving erroneous results.