Touch sensor lamp connected with ESPHome - cannot read brightness status because of low voltage levels

I noticed a new portable lamp in my livingroom. It’s touch controlled with three rotating brightness levels and it balances bold forms: newworks.dk/en/productsheet/kizu-portable-table-lamp-2

It was not connectible to Home Assistant, so it needed to be fixed.

testing with a dev nodemcu esp8266 (led just for connectivity testing):

  1. voltage on this pin seems to change with the brightness level
    1.1. the voltage range is off/full/med/low → 0mV / 1.2mV / 0.6mV / 0.3mV, measured pretty consistently with a multimeter
    1.2. I tested getting a reading with the A0 adc pin (without the vcc measuring that was added later), but it barely read the brightest setting as 0.00098V, 0V for the other levels. Also not consistent, at least without soldering.
  2. luckily a touch could be simulated by connecting the touch rod directly to an esp8266 pin
    2.1. found info about using mode: OUTPUT_OPEN_DRAIN from Simulate touch (capacitive) button from nodemcu
ESPhome config
esphome:
  name: new-works-kizu
  friendly_name: New Works Kizu

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "X"

ota:
  - platform: esphome
    password: "5"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "New-Works-Kizu Fallback Hotspot"
    password: "b"

captive_portal:

# New Works Kizu portable lamp's circuit has a pin with a voltage corresponding to the brightness,
# but it is out of the ADC range of ESP8266 (~0.075V to ~3.12V)
# off:      0 mV
# full:  ~1.2 mV
# med:   ~0.6 mV
# low:   ~0.3 mV
#sensor:
#  - platform: adc
#    pin: GPIO17
#    name: "Voltage sensor"
#    update_interval: 1.0s

switch:
  - platform: gpio
    pin:
      number: GPIO05
      mode: OUTPUT_OPEN_DRAIN
    id: kizu_touch
    device_class: switch
    restore_mode: RESTORE_DEFAULT_ON

button:
  - platform: template
    name: "Kizu touch"
    on_press:
      then:
        - switch.turn_off: kizu_touch
        - delay: 300ms
        - switch.turn_on: kizu_touch

sensor:
  - platform: adc
    pin: VCC
    name: "VCC Voltage"

Final fitting was with a WeMos D1 Mini esp8266, with no brightness reading.

The lamp has a battery that outputs 4.2V, and that’s connected to the esp8266 5V pin. Appears to work, the VCC sensor reads about 2.9V.

Is there a way to use those low voltage levels to read the brightness settings, maybe with some additional components? Or is there a place that could have a more suitable voltage on the lamp circuit? I think I tested all the connectors, but maybe I missed it:

image of lamp circuit

How you know it’s analog voltage and not PWM? Multimeter doesn’t see difference.
Also, Esp ADC is not able to read ~1mV voltages.

That’s an interesting thought - I don’t know what the circuit outputs. ADC just came to my mind, as I was initially thinking that the output to the LEDs could be measured from the circuit.

Could a platform: pulse_width sensor then read the possible PWM value, even if it looks like a very low voltage analogwise? I’m not very electronics savvy, so I have no idea if a “narrow” width PWM would look like a mV voltage when measured with a multimeter.

Good question. Documentation is next to nothing.
Esphome doesn’t seem to have a component that can measure frequency and duty cycle of PWM.
Maybe tricking remote_receiver with raw output

I soldered the promising pin to the esp8266 and tried all the digital sensor platforms from ESPHome Docs — ESPHome. No luck, no signal. I’ll call this a win (with the remote touch) and maybe try again with another lamp.

That means you have analog voltage, unfortunately not measurable by Esp ADC.
By the way, what you need it for?

Low voltage levels affecting brightness status detection might be mitigated with a better proximity sensor like PR18-5DN. Its stable output can help maintain consistent readings in ESPHome setups. Have you tried using a sensor with stronger signal integrity to improve your lamp’s responsiveness?