Which filter should I use for analogous light sensor

Hello,

I use a TEMT6000 light sensor (link) to detect the current light level in my room using the ADC input:

  - platform: adc
    pin: A0
    name: Wohnzimmer Helligkeit
    update_interval: 1s
    id: wohnzimmer_helligkeit
    unit_of_measurement: "lx"
    icon: mdi:sun-wireless-outline
    state_class: measurement
    device_class: illuminance
    accuracy_decimals: 2
    filters:
      #10000kΩ, 2 µA
      - lambda: return (x / 10000.0) * 2000000.0;

In principle, the sensor is working fine and shows the light level, but sometimes, the data are very noisy and somhow bouncing.

I already tried different filters (both, sequentially and simultaneously), but I can’t get a sufficient smoothing of the data.

    filters:
      #10000kΩ, 2 µA
      - lambda: return (x / 10000.0) * 2000000.0;
      - sliding_window_moving_average:
          window_size: 30
          send_every: 30
      - exponential_moving_average:
          send_every: 30
          send_first_at: 15
          alpha: 0.1
      - quantile:
          window_size: 60
          send_every: 10
          send_first_at: 5
          quantile: .8

The ‘hopping’ is the much bigger problem, the slight noise is not disturbing.

Do you have an idea, which filter or filter combination should I use?

Thanks a lot!

I’m actually looking for the same thing for the same sensor.

Try a median using 3 and then 5 datapoints.