CaseLightsPublished at December 30, 2015.
Last updated at June 07, 2020.
I’ve recently (accidentally) bought a dead-simple 12V RGB LED strip, aiming to mount it on my Quadcopter, thinking it would be made of individually addressable LEDs. Of course, I didn’t read the description and was wrong. So, what to do?
As you may remember, I’ve built a new computer in January with a very spacious case. It already had two UV lights that were controlled manually using a switch in a PCI slot. Both the RGB LED strip and my computer seem to be a match made in heaven :P
Incidentally, there’s still a unused RS232 port directly on my Motherboard that I never wired to the outside. That could be used to talk to an Arduino controlling the RGB LEDs and the UV lights. And there are plenty of free 12V rails of course.
So I bought a five-pack of cheap Arduino Pro Mini clones from china. I still had some IRF530 N-Channel MOSFETS left over from the LED-Cube that can be used for this. And I needed to build a small RS232-TTL converter (using 2N3904 and 2N3906 as Transistors).
Here’s the protocol used to communicate over RS232. It is line-based ASCII and only supports two commands:
RGB r g b UV x
Where r, g and b are ASCII decimal values from 0 to 255 and x can be ASCII 0 or 1.
Currently the user can only turn the UV lights on or off using the CaseLights App. In the future, I may implement some automatism based on the time of day or something like this.
The RGB Lights can be set to some static colors, with a modifiable brightness. Alternatively, a simple color-fade in RGB or HSV color space can be selected.
Using the included JSystemInfoKit, different things like CPU/GPU/RAM/VRAM usage or hardware temperatures can be visualized with colors from red, over yellow, to green.
You can also select a display output device connected to the Mac. The CaseLights App will then create a Screenshot 10-times per second and display the average color.
And you can select one of the system audio input devices to visualize sounds and music. To be able to directly route the system audio output into CaseLights, use the open kernel extension Soundflower.
You can find all Arduino and Mac code in the CaseLights GitHub repository.
In August of 2019, I also added a Linux version of the host control software, as a PyQt status bar app. The code for that is in the repo as well.