DIY Smart Lighting

Posted at — Jul 12, 2019

When we moved in to this house ~16 months ago, the kitchen was… there. I coped with it, my partner low-key detested it. The plan was to replace it eventually, but price and priority meant it was nowhere near the top of a long list of work we wanted to do here.

One of K’s big complaints was that low hanging wall cabinets, combined with a single not-very-bright ceiling light, meant most of the bench top workspace was very dark. So while waiting for the kitchen rebuild I got tasked with installing lighting under the wall cabinets. I used two rows of WS2812B LED strips and a 5V 14A power supply from aliexpress for this. For the controller, I already had a Raspberry Pi Zero W sitting in a corner of the kitchen (to control my sous vide cooker), so built a simple level shifter to let the Pi talk to the lights, and wrote a quick python service to drive the lights and listen for commands over MQTT. The resulting contraption was very bright, incredibly useful, and switched on and off solely by a manual push button in my home assistant UI, or via Google Home when I wasn’t too paranoid about Google knowing when I was making dinner.

For the last six weeks we’ve been renovating our kitchen. We’re down to the finicky bits now, and even though the ceiling light has been replaced with something actually useful, we both still want to replace the LED lighting. So I’m circling back to thinking about how I want this system to work, and thinking hard about how to improve on the first attempt.

Using a real microcontroller

The Pi works fine, but it’s hardly a robust solution. I want this system to keep working, for at least the basics, long after we’ve moved out of here, and Raspberry Pis are notorious for eating SD cards. I could put the hard work in to prolonging SD card life, or I could just move the light control to a simpler controller. An ESP8266 with firmware that can be directly controlled across the network sounds appealing, but future useability isn’t the best (the wifi will be either useless, or broadcasting a WiFiManager portal that will allow some strangers full access to some other stranger’s lights). The other option will be an Arduino running the lights, and being controlled over serial from the existing Pi. This model was hugely successful on my contribution to the Bitbucket Server Starter Bucket shipit.

Lighting run

The last run used two rows of lights under the wall cabinets. This time around I’ll only be using one row, at the same density. Two was a lot in the old kitchen, with a lot more illumination from other places one should be more than enough this time.

We’ll also be adding more runs. I want to put lights in the corner cupboards, which are kinda dim. They’ll have reed switches on the doors to control them. And I’ll be adding a decorative run above the wall cabinets. Because they’ll probably look nice and I’m a huge sucker for blinkenlights.

RGBW lights

The last run used standard RGB WS2812 strips. These were OK, but seeing as the vast majority of their use is for white illumination, I can probably do better. This time around I want to use RGBW (or the warm white variant, RGBWW). That’ll probably mean SK6812 lights.

Hardware buttons

I have a cheap Android tablet mounted on a wall in our kitchen, running the Home Assistant interface, and we almost always used that to turn the bench lights on and off. It worked, but kind of sucked. We’re putting Ikea TRÅDFRI remotes around our house right now, and will have another one for the kitchen lights soon. But I still want a couple of physical buttons, convenient to the bench tops, just to turn the lighting for them on and off. I’m thinking illuminated pushbuttons similar to Jon Oxer’s superhouse switch panels, but I’d also like an extra dimmer knob for brightness. That’ll end up being a rotary encoder rather than just a plain pot, because naturally brightness will also be controllable over the network.