Current clamp sensor reading never changes

Hi everyone, I’m looking for some help with my current clamp sensor project that I’m struggling to get working.

I have an ESP32 board, known as the “esp32doit-devkit-v1” to esphome and is branded “esp-wroom-32”.
The current clamp sensor I have is an SCT013 100A/50mA.

I have put together the components on strip board from this guide: How to Build a DIY Household Energy Monitor Using ESP8266. The pin I’m using is marked 34 on the esp32.

For now the only code I have is for the adc platform like this:

- platform: adc
  pin: A0
  id: adc_sensor

If I have the clamp either around no wire, around a wire with no load, or a wire with a load the adc sensor always reads 0.07500 volts.

I’m not 100% certain A0 is the correct pin as I could not find any documentation on how the pins are referred to in esphome, however, if I specify pin 34 I get NaN V instead.

Any help would be very much appreciated.

Thanks

A0 is pin 36.

See lower down on this page:

Pin 34 is a digital input only pin.

Hi Tom thanks for your reply.

I had stumbled across that page during my troubleshooting but I’m still at a loss. I presume A0 means ADC1 CH0? Below is the pin out for my exact board.
I also tried pin 3 referenced as A3, pin 32 as A4 and 34 as A6 all had similar results of a reading which doesn’t change when putting a load through the clamp.

Correct.

Pin 3 / GPIO13 is ADC2_CH4 which is not A4 (note the ADC channel 2).

Pin 12 / GPIO34 is A6.

If that did not work then it could be a wiring fault.

Also you may need to set the attenuation level.

I’m gonna go out on a limb and suggest you need to rectify, smooth, and load the output of that clamp.
I just looked at what claims to be a datasheet for it, and what I saw is a coil and a resistor. That means the signal it provides is AC, just as the only kind of current it will sense is AC.

Actually no, all you need is a noise bypass capacitor and a voltage divider. The ESP takes care of the RMS measurement.

This circuit:

Where R1 and R2 are both the same value (anything between 10K and 22K) should work with this config:

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "My Current Sensor"
  - platform: adc
    pin: A6
    id: adc_sensor
1 Like

Oh, right. I forgot that the esp can sample way faster than the ac period.