Acs712 sensor esp32

Hello ,

I have a esp32 or a wemos mini and want to connect acs712 hall sensor to see my power consumention in home assistant power AC max 16 amp

But I can not find how to configure this trough esphome

Any news about this post ?

Would be interested as well. I want to check if my pump for underfloor heating is running or not.

Hello.

You could try the suggestions found at this link.

I am waiting for my ACS172-30A to arrive, so have not tried it myself yet.

Has anyone made any progress with the ACS712 on ESPHome? I’ve got one hooked up to my doorbell so that I can try and read when it gets pressed, but I haven’t had much luck.

Guys, It looks like its impossible. The ACS712 uses 5v output to the esp. It would give a wrong maximum. It would work correctly up to ~6.4 amps.

You only need to add a voltage divider.
On a NodeMCU board this is already present to scale the 3.3V down to 1V (That is the ESP’s maximum)
In this case you only need to add a 220k resistor on the A0-pin.

IF you usa a ESP where there is no divider present, just add 2 resistors like so :
image

I did al that, and works fine.
I’m am currently struggling wit the integration into ESPhome. I can’t get a good AC current measurement…

Is there a code for esphome sensor acs712 and monitoring 230v AC current?

I too am struggling with the integration. Cannot get any meaningful reading. Someone please help

Hi, Did you manage to integrate this already in HA?

Hello, I’ve just published a component:

It still needs code editing to suit your model. Have in mind that without voltage divider a 30A model will measure up to 20A.

Can you please explain what is voltage divider, i have lots of wemos d1 mini and esp32. As i understand the d1 mini have intergrated voltage divider inside i just need to put the multiply code in yaml. Am i correct or am i missing something.

sensor:
  - platform: adc
    # ...
    filters:
      - multiply: 3.3

I want to purchase several of this modules to monitor if my ac mini split is on or off, and im asking if i need to add more tings in my basket.

These sensors output 0 to 5v, with 0 amps at 2.5v. And esp 0 to 3.3v. Esp have a voltage divider to go from 3v3 to 1v.

I haven’t tested if the adc input tolerates 5V, but I’m pretty sure it does. I haven’t reached 3.3v so I don’t know.

So if you want to be sure, and capture the full range of the sensor you have to add a voltage divider to lower from 5v to 3v3.

Just to let you know, for AC you can use CT clamp integration. ACS spits out analog signal, as CT clamp do. You just have to calibrate (calibrate_linear) the ouput data. All is mentioned here:

There is no need another integration for ACS chips. Will be good, to just change the description for CT clamp to be more general. Like, AC Current Sensor. I recommend use the 3.3v ACS, but they are not as common as 5v ACS712.

2 Likes

Ouch. Will study it, thanks!

I tackled the same problem. Played around with @marianomd custom component and changed it here and there. My main problem:
The adc reading of my ESP32 is very unreliable!
Even tried esphome adc integration with my lolin s2 mini esp32 which should have 13 bit adc on board. then read 3.3V/2 from the board voltage supply and voltage divider, but readings are jumping around the “shall” value. I would have expected a constant output (as well for analogRead(pin)) for a constant voltage input. With this variety of ADC readings I do not even have to start measuring small currents. not even a capacitor of 100muF connected from ADC pin to ground provides constant analogRead values. Does anyone suffer the same problem?

when using the ct clamp integration the software part works flawlessly but due to really bad readings of the ADC my output looks like this (while having a constant load of 100W):


am I the only one with this adc problem? (tested several different lolin s2 mini)

I checked mine sensor, and the numbers are pretty stable for me. ± 0.0015 A. But I have 100 nF cap on the line to filter out the noise.