ESPHome at the CT Clamp (sct-013-030)

I have set up my Wemos D1 Mini for reading only current, as per https://learn.openenergymonitor.org/electricity-monitoring/ct-sensors/how-to-build-an-arduino-energy-monitor-measuring-current-only.

Without reading the documentation, I cut and paste the following sensor code from an online discussion.

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Washing Machine Current Sensor"
    update_interval: 10s
    filters:
      - calibrate_linear:
          - 0 -> 0
          - 0.12 -> 17.4    
      - lambda: return x * 230.0 / 1000;
    unit_of_measurement: "kw"      
    
  - platform: adc
    pin: A0
    id: adc_sensor

The output stayed more or less the same wether power was on or off

[22:00:41][C][mdns:085]:   Hostname: washing-machine
[22:00:43][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 104 different samples (520 SPS)
[22:00:43][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.08101 kw with 2 decimals of accuracy
[22:00:53][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 96 different samples (480 SPS)
[22:00:53][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.06590 kw with 2 decimals of accuracy
[22:01:03][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 101 different samples (505 SPS)
[22:01:03][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.08162 kw with 2 decimals of accuracy
[22:01:13][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 93 different samples (465 SPS)
[22:01:13][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07237 kw with 2 decimals of accuracy
[22:01:22][D][sensor:125]: 'adc_sensor': Sending state 0.50879 V with 2 decimals of accuracy
[22:01:23][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 83 different samples (415 SPS)
[22:01:23][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07440 kw with 2 decimals of accuracy
[22:01:33][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 94 different samples (470 SPS)
[22:01:33][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.06411 kw with 2 decimals of accuracy
[22:01:43][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 90 different samples (450 SPS)
[22:01:43][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07852 kw with 2 decimals of accuracy
[22:01:53][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.005A after 114 different samples (570 SPS)
[22:01:53][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.17349 kw with 2 decimals of accuracy
[22:02:03][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 96 different samples (480 SPS)
[22:02:03][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07915 kw with 2 decimals of accuracy
[22:02:13][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 103 different samples (515 SPS)
[22:02:13][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07098 kw with 2 decimals of accuracy
[22:02:22][D][sensor:125]: 'adc_sensor': Sending state 0.50879 V with 2 decimals of accuracy
[22:02:23][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 78 different samples (390 SPS)
[22:02:23][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07936 kw with 2 decimals of accuracy
[22:02:33][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 82 different samples (410 SPS)
[22:02:33][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07529 kw with 2 decimals of accuracy
[22:02:43][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 95 different samples (475 SPS)
[22:02:43][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.06120 kw with 2 decimals of accuracy

I therefore decided to read the docs found here: https://github.com/esphome/esphome-docs/blob/e869ce49cdf6a4b8793e20bc65ce4dd65b08d39a/components/sensor/ct_clamp.rst.

I got lost at this point as I am not sure what they are telling me to do. “First, you need to set up a voltage sensor source (:doc:ADC sensor <adc>, but for example also :doc:ADS1115 <ads1115>) and pass it to the CT clamp sensor with the sensor option.” (clicking on the links did not seem to take me anywhere. As I am using the “only current” schematic I am not sure how or where to add the voltage sensor or what I even use for that.

How is the CT-clamp “connected”?
Can you take a picture of it?

It is clamped around the live wire of an extensions lead. I have then plugged in a soldering ion that also has a hot air gun on it. That said I have just tried some code that worked yesterday using a standard Arduino app with the EmonLib library and that no longer appears to be working.

I will get some sleep and then recheck my circuit to see if I have any cold joints.

I found a dodgy resistor, soldering everything together so that I don’t have any cold joints.

Ignore the LED below that represents where the CT Clamp attaches :wink: Also, the resistors are 10K.


Schemtic

I then changed my code to

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Washing Machine Current Sensor"
    update_interval: 10s
    filters:
      - calibrate_linear:
          - 0 -> 0
          - 0.12 -> 17.4    
    
  - platform: adc
    pin: A0
    id: adc_sensor

And the output was not much better

[09:50:17][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 83 different samples (415 SPS)
[09:50:17][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy
[09:50:27][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 105 different samples (525 SPS)
[09:50:27][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy
[09:50:33][D][sensor:125]: 'adc_sensor': Sending state 0.00293 V with 2 decimals of accuracy
[09:50:37][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 81 different samples (405 SPS)
[09:50:37][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy
[09:50:47][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 116 different samples (580 SPS)
[09:50:47][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy
[09:50:57][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 141 different samples (705 SPS)
[09:50:57][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy
[09:51:07][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 91 different samples (455 SPS)
[09:51:07][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy
[09:51:17][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 103 different samples (515 SPS)
[09:51:17][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy
[09:51:27][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 65 different samples (325 SPS)
[09:51:27][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07079 A with 2 decimals of accuracy
[09:51:33][D][sensor:125]: 'adc_sensor': Sending state 0.00293 V with 2 decimals of accuracy
[09:51:37][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.000A after 95 different samples (475 SPS)
[09:51:37][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07080 A with 2 decimals of accuracy

As the sct-013-30 as an inbuilt burden resistor, I have not included one.

Hi
I have the same problem.
would you please help me?