Desklamp salvaged with ESPHome

3 minute read Published: 2024-06-22

The following is a quick project write-up. It is mainly for my own notes but I'm posting publicly so that others can maybe glean something useful or get the courage to start on their first ESPHome project

Sometime during COVID I bought this desk lamp/ring light. And, as the more recent reviews seem to indicate, the mean time to failure for the buttons seems to be around a couple of months. Mine died after 5 or 6 months and had been sitting in my box "fix me" box for the past 3 years.

Here is a close up of the MCU (buttons are on the other side):

Well I finally got around to fixing it! Upon opening the control box I quickly decided I didn't want to mess around with the original microcontroller and that I'd just replace all of the physical controls with some transistors and an ESP12 running ESPHome. I really can't recommend ESPHome enough. Even if you're not much of a hardware person it makes bringing random projects into Home Assistant such a breeze.

Using my bench power supply it was easy enough to figure out that the light had one wire for the cool LEDs and one for the warm LEDs. I also figured out that there was a current limiting resistor somewhere on the LED PCB.

Close up of original MCU

After chopping out the failed physical buttons and the original MCU, a fritzing of the circuit looks like this: fritzing of the circuit

And here is it all soldered together on some protoboard.

Assembled project on protoboard

And then with the following ESPHome YAML magic:

esphome:
  name: ringlight
  friendly_name: "RingLight"

esp8266:
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  safe_mode: true
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

switch:
  - platform: gpio
    pin: GPIO5
    name: "Cool"
    id: light1
  - platform: gpio
    pin: GPIO4
    name: "Warm"
    id: light2

it shows up in Home Assistant where I can add further automations. Home Assistant Screenshot

Add a case and this project is done!

project enclosure with lid on

My case model is up on printables.

Wrap up

This started as a project that I thought I could totally finish in a night using parts I had in my parts-drawer. I got it working in one night but it took quite a few revisions to get the case where I wanted it. In the end, it was probably only a couple of additional hours of actual work but it took a week-ish of wall clock time to print and test revisions. And then another couple of weeks to get around to this write up. I am happy it is out of the fix me box and I'm extra happy I actually documented it.

warm light on