ESP Fairy Light Driver

This one is kind of hilariously simple. We have a string of fairly lights in the bedroom that is nice to have as it provides just enough ambient light to read with. It came with a cheap IR remote that is prevalent in a lot of amazon light products. Since we never used it from far it didn't really make sense, and the bad buttons made it easy to accidently set it flashing.

So I ripped out the older controller module and replaced it with an M5 ESP32 Stamp driving a single MOSFET which modulates the 5V drive to the LED. In addition a single key switch provides a button to turn on and off the lights. But, since it connects up to home-assistant via ESPHome we can control it through our google home voice assistant.

Thankfully, the LED string itself provides current limiting resistors, which I wasn't quite certain of when I tried this out, luckily they didn't blow up! The whole thing is fixed to draw half an amp at 5V, which the esp board seems to be happy providing through its traces to the usb port.

The whole thing is held together by copious hot glue, it ain't pretty, but it works and is normally tucked away so we're not looking at it!

front back

Whole thing gets flashed with ESPHome and configured with the following yaml:

#PWM Channel
output:
  - platform: ledc
    pin: GPIO09
    id: ledout
    frequency: "4882Hz"

#PWM Controlled Light
light:
  - platform: monochromatic
    output: ledout
    id: twinkles
    name: "Twinkles"

  - platform: esp32_rmt_led_strip
    chipset: SK6812
    rgb_order: GRB
    pin: GPIO02
    num_leds: 1
    name: "Twinkle Status"

binary_sensor:
  - platform: gpio
    internal: true
    pin:
      number: GPIO4
      mode:
        pullup: true
        input: true
    id: button
    filters:
      - delayed_on: 10ms
    on_press:
      then:
        - light.toggle:
            id: twinkles
            transition_length: 0.5s