Trying to read LED state with ESP - Making a 'dumb' device 'smart'

I have a dehumidifier that I’m trying to make ‘smart’ with an ESP32 board.

• I can control the control buttons by bridging them with a relay controlled by the ESP.

• I’m trying to read the ‘state’ of the dehumidifier by taking the power signal from multiple LEDs on the dehumidifier panel and feed that into the ESP via the ADC GPIOs.

The LEDs are multiplexed by the IC on the PCB so this is making ti difficult for me to find a HIGH signal to trigger the ESP.

Issue: The power coming from the (+) of the LEDs seems to be fluctuate very erratically (from 0.3v to 2.20v) regardless if the LED is lit/on or not.
(voltages jump around when measuring with ESP or multimeter).

I currently have the ESP monitoring x3 LED’s on the dehumidifier and it is impossible to tell what one of the three is on and what ones are off due to the voltage bouncing around so much.
The (-) side of the LED’s share a common trace in the PCB so can not measure off that side.

I’m at a loss of how to achieve this and hopeful that you lot are much smarter than me here :sweat_smile:.

Additional info:

ESP is powered via a 5v circuit inside the dehumidifier.

ESP Config I’m using for testing:

captive_portal:

binary_sensor:
  - platform: template
    name: "TEST Probe32 Triggered"
    id: mb_b
    lambda: |-
      if (id(test_pin32_probe).state > id(test_probe32_trigger_level).state) {
        return true;
      } else {
        return false;
      }
  - platform: template
    name: "TEST Probe33 Triggered"
    id: mb_c
    lambda: |-
      if (id(test_pin33_probe).state > id(test_probe33_trigger_level).state) {
        return true;
      } else {
        return false;
      }
  - platform: template
    name: "TEST Probe34 Triggered"
    id: mb_a
    lambda: |-
      if (id(test_pin34_probe).state > id(test_probe34_trigger_level).state) {
        return true;
      } else {
        return false;
      }

sensor:
  - platform: adc
    pin: GPIO32
    attenuation: auto
    name: "TEST Pin32 Probe"
    id: "test_pin32_probe"
    icon: mdi:lightning-bolt
    update_interval: 0.1s
    filters:
      - sliding_window_moving_average:
          window_size: 30
          send_every: 5

  - platform: homeassistant
    name: "TEST Probe32 Trigger Level"
    id: "test_probe32_trigger_level"
    entity_id: input_number.test_probe32_trigger_level 

  - platform: adc
    pin: GPIO33
    attenuation: auto
    name: "TEST Pin33 Probe"
    id: "test_pin33_probe"
    icon: mdi:lightning-bolt
    update_interval: 0.1s
    filters:
      - sliding_window_moving_average:
          window_size: 30
          send_every: 5

  - platform: homeassistant
    name: "TEST Probe33 Trigger Level"
    id: "test_probe33_trigger_level"
    entity_id: input_number.test_probe33_trigger_level 

  - platform: adc
    pin: GPIO34
    attenuation: auto
    name: "TEST Pin34 Probe"
    id: "test_pin34_probe"
    icon: mdi:lightning-bolt
    update_interval: 0.1s
    filters:
      - sliding_window_moving_average:
          window_size: 30
          send_every: 5

  - platform: homeassistant
    name: "TEST Probe34 Trigger Level"
    id: "test_probe34_trigger_level"
    entity_id: input_number.test_probe34_trigger_level 

Photo of the control PCB:


It could be “charlieplexed”.

If you look at the PCB trace for the anode of D8, D16, D20, D27 and D22, they are all connected. Same goes for the other LEDs. Also there seems to be no obvious series current limiting resistors.

You may get away with individual opto couplers on each LED but that will be an extra load that the controller chip may not like.

Do you have common GND between Esp32 and led board?
Without that it can’t work…
You could also try with digital input and pulldown instead of ADC

I think for my skill set, settling for octocouplers or possibly small NPN transistors in parallel with each individual LED might just be the easiest/better solution.

I’ll have a crack during the week.

I was able to source the power for the ESP from the unit itself so, the ground is common on the PCB I believe.

The task definitely looked much easier before I realised all the LEDs are multiplexed.
Got a couple of other suggestions to try over the coming days now. :crossed_fingers:t2::crossed_fingers:t2:

Yep.

So either you need to read the multiplexed lines (like 4 high side lines and 4 gnd lines) or read individually with optocouplers.