Sunday, January 6, 2020

OSC-controlled DMX LED Par fixtures

Hey remember these cool RGB + Amber LED fixtures I got... whoa... 5 years ago? I finally put them on WiFi for home lighting: take that Philips Hue!

insides of RGBY

These are semi-pro fixtures intended for small clubs or theaters, so they are controlled by the DMX protocol. This is a straightforward serial protocol easily generated by most microprocessors. I used an ESP8266 for the brains, because it has built-in WiFi and is very inexpensive. Plus there are handy libraries to generate the DMX signals, as well as Open Sound Control (OSC). Putting the parts together, I now have four WiFi-controllable, full color (red-green-yellow-amber) 30W LED fixtures.

But that's not all! Since these are for my house, I wanted to deal with the the fans which are quiet but not silent, and not usually necessary. My original plan was to control them thermostatically using a DS1820 temperature sensor, which would let the ESP8266 activate the fan when the temperature was above a certain set point and keep it off otherwise. But there are cheap thermostat controllers widely available, so laziness prevailed and I used those. Plus they have a digital temperature readout and buttons to change the setpoint. In practice the temperature only rises when all LEDs are on at a fairly high brightness. Since I mostly use them dimmed and at somewhat saturated colors, the heatsink always suffices. So I have yet to see (or rather hear) the fans turn on, but it's good to know that cooling is available if needed, and I certainly tested them all by running them at full blast until the fans kicked in.

But wait, one more thing! These lights have convenient 120V outlets so they can be daisy-chained. I don't need to do that, but I do have some other lights and artworks that it would be handy to switch remotely, so I added some relay boards so I can each output from WiFi commands as well.

Normally for something this involved I would design a PCB, but all the parts were available on breakout boards and they fit together pretty well using had screw terminals for nice gas-tight connections. Here's a picture of a fixture fully kitted out. The ESP8266 board is mostly hidden by the RS485 level converter board, soldered upside down to the ESP8266. Miraculously, the header on the RS485 board -- +5, D+, D-, GND -- matched the existing plug perfectly. Boards were attached using standoffs or the fabulous 3M outdoor mounting tape.

insides of RGBY

For future reference, here's a list of parts. Very little soldering was required: just power, ground, and TX to/from the ESP8266, most other connections were screw terminals or headers.

I wrote the firmware from scratch, but the heavy lifting is done by the Arduino OSC library, the DMX library from Rickegg, and the FastLED library for the gamma correction method dim8_raw(). For natural color control, I used the hue-saturation-value to RGBY conversion I worked out here:

My firmware is on github here. On the server side, I have a Python script that can send the OSC commands. Some special commands can enable gamma correction, ramp time (between color changes) and dithering. I'm especially proud of the dithering which uses error diffusion to smooth the transitions between colors. Because DMX is only 8-bit resolution, this makes the visual transitions, especially dimming, far more pleasing.



Archives:


Topics:


RSSicon.png  RSS feed