GravityTroubleshooting

SEN0214 Junk Data

userHead Russell.Manning 2025-01-28 10:50:20 17 Views0 Replies

I haven't put a lot of time into it with other projects I've been working on but efforts in getting any useful data out of this SEN0214 has failed.  It ether doesn't really change with power draw or none, or it floats around super low values.  The GPIO's used are correct along with the wiring for measuring.

 

Snippet from Home Assistant for this sensor:

sensor:

  - platform: adc

    pin: GPIO33  # Use an ADC pin available on the ESP32

    id: current_sensor_adc

    name: "Current Sensor Raw Voltage"

    unit_of_measurement: "V"

    accuracy_decimals: 3

    attenuation: 11db  # Allow 3.3V input

    update_interval: 1s


 

  - platform: template

    name: "Measured Current (DC)"

    unit_of_measurement: "A"

    accuracy_decimals: 2

    update_interval: 1s

    lambda: |-

      // Read ADC voltage

      float v_adc = id(current_sensor_adc).state;

     

      // Reference Voltage (5V supply for SEN0214)

      const float Vref = 5.0;  // Sensor power supply

     

      // Midpoint Voltage (0A)

      const float midpoint = Vref / 2.0;  // 2.5V

     

      // Sensitivity

      const float sensitivity = 0.1;  // 100mV per amp

     

      // Calculate current

      float current = (v_adc - midpoint) / sensitivity;

      return abs(current) > 0.05 ? current : 0.0;  // Filter small noise values

Any pointers?