ESPHome ACS758 ESP32

Has anyone had the opportunity to measure the ACS758 current?

  - platform: adc
    id: "prad_silnikow_trackera"
    name: "Prąd Silników trackera ADC0"
    update_interval: 250 ms
#    unit_of_measurement: "A"
    pin: GPIO36
    filters:
      - median:
          window_size: 8
          send_every: 2
          send_first_at: 2
#    attenuation: auto 
#    accuracy_decimals: 3

I forget that ESP32 measures 0-1V, but I practically see no change in voltage
I found How To Measure Current Using XIAO ESP32 And ACS758 Sensor | A Step By Step Guide - Open Green Energy
and I don’t see any pullup resistor and the voltage is around 0.4V

The question is how to define it

const float VOLTAGE_REFERENCE = 3.3; // Change to 5 if using 5V VCC
const float SENSITIVITY = 0.04; // 40mV/A -Sensitivity of ACS758 (check the datasheet for your ACS758 model)
const float OFFSET_VOLT = VOLTAGE_REFERENCE / 2; // Zero-current output voltage ( Offset Voltage)

Hi did you ever found a solution for this sensor ?

You could do it like this:


  # ACS758 Rohspannung (ADC)
  - platform: adc
    pin: GPIO34
    id: acs758_voltage
    attenuation: 12db
    update_interval: ${adc_update}
    accuracy_decimals: 3
    internal: true
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 1

  # Strom aus ACS758 (A)
  - platform: template
    id: acs758_current
    update_interval: ${templ_update}
    accuracy_decimals: 2
    unit_of_measurement: "A"
    device_class: current
    state_class: measurement
    internal: true
    lambda: |-
      return id(acs758_voltage).state;
    filters:
      - calibrate_linear:
          - 1.00000  -> -19.63
          - 1.86233  ->   0.00
          - 2.50000  ->  14.52

I like to have my adc pin and the resulting value out of it in separat sensors. You could also put the calibrate_linear: directly into the platform: adc sensor.

Basicly a good start is the following:

      - calibrate_linear:
          - 0.65  -> -25
          - 1.65  ->   0.00
          - 2.65 ->  25

Record some statistics with a working and calibrated sensor and give both plots to an AI and it will solve it for you.

With attenuation: 12db you can measure up to 3v3 on the adc pin.