Using ZMCT103C Current Transformer with ESPHome to Monitor AC Power Usage

I’m trying to set up a power meter to measure watts using one of these ZMCT103C modules. I have been trying to find online sources that could help me to get it working, but so far I haven’t been successful. The board is like the one in this listing: https://id.aliexpress.com/item/32862297933.html

The board has these pins:
GND
GND
OUT
VCC

I connected one of the GND pins to ground, the OUT to A0 on my ESP8266, and VCC to 5v. I tried using this example provided here https://esphome.io/components/sensor/ct_clamp.html

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Measured Current"
    update_interval: 60s

  - platform: adc
    pin: A0
    id: adc_sensor

The code runs without errors, and the sensor appears in HA. But I can’t get a correct reading from the sensor. Even without any load turned on it shows some random value instead of 0, and when I turn on my load for testing which is a light bulb, the reading changes but to a value that is incorrect. I tried calibrating it but I am still unable to get a correct reading. Did I improperly connect it? Do I need to add a resistor somewhere in the circuit? Or did I just not calibrate it right?

Has anyone ever had any experience using this sensor with ESPHome? Or maybe someone could point me to a link (website or forum) that could show how to correctly set this up? Any suggestions would be very appreciated. Thanks!

Where is the datasheet?

Hey just wondering if you got this to work?

I used the above sensor without the additional electronics and it seems to work with the code you shared above. The only change I made was that my GPIO pin was 34 and I set the update interval to 1s. I haven’t tested the output for accuracy, but the sensor does seem to be sending data consistently. When there is no power flowing through the wire, it displays 0.0amp. The only problem I noticed was that after switching off the circuit it still reads between 0.03 and 0.01amp for a few seconds before going back to zero.

Hi, I know this is old thread. I am trying to use this sensor for doing something similar. I dont want accuracy of the reading but to detect when there is AC current present or not. I saw you have mentioned GPIO 33. Are you using esp32 in that case? From the pin outs it looks like the pin you are mentioning is Input Only pin. Can you share the circuit/connection diagram and your YAML for the benefit of the community?

I’m using ZMCT103C currently with an esp32 and this code example:

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Measured Current"
    update_interval: 2s

  - platform: adc
    pin: 35
    id: adc_sensor

This is not so accurate and at 0 load is measuring 0.05A. But I use it to check if the sprinkler pump is runnig, by measuring the current > 1A

To “calibrate” you need to compare the load with the displayed measurement, and rotate the potentiometer until you are satisfied with the reading. A clamp meter is very helpful for that.
The connection is very simple:
GND to GND
VCC to 5v
OUT to pin 35

Thanks for sharing. I will check this in my environment.

I need to make some updates regarding my last comment, 10 days ago. For some reason I was so lucky when I was calibrating my sensor, that the output consumption was exact the expected result. But when testing with higher loads I discovered that I was so wrong :smiley:

So, forget about the code above. Might work only if you are lucky, but is wrong. So I’ll post the new code, and some explanation.I used the ESP2866 for this:

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Measured Current"
    id: current
    sample_duration: 600ms
    update_interval: 3000ms
    filters:
      - calibrate_linear:
          - 0.003 -> 0
          - 0.126 -> 3.64

  - platform: adc
    pin: A0
    id: adc_sensor
    update_interval: 3000ms

So, to calibrate it properly, you still a known load to attach at the line you are measuring.
First, when you upload the code, you can comment the filtering part, or leave it like it is.With no load you need to pay attention at “Raw AC Value” in my case 0.003:


And from this comes the first line in the code: - 0.003 → 0
Next step is to connect a know load, or you can measure the consumption with a dedicated multimeter.I have a pump that consumes 3.6A.When I start the pump
, this are the values I get in the logs:

Again, “Raw AC Value” is what we need. In my case 0.125. And this is the second value you need for the second line :- 0.126 → 3.64
I hope this helps with the confusion.

Also I have an esp32 example using the YHDC STC-013 0-30A, but the code is similar. The only difference on the esp32 you have to set the attenuation.

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Measured Current"
    id: current
    sample_duration: 600ms
    update_interval: 3000ms
    filters:
      - calibrate_linear:
          - 0.0015 -> 0
          - 0.20213 -> 6.23

  - platform: adc
    pin: GPIO35
    id: adc_sensor
    attenuation: 11db
    update_interval: 3000ms