A collection of lighting projects controlled by microcontrollers.
Low-voltage LED Lamps are easy to control from a microcontroller when you know what properties you need to be aware of. In fact, there are so many low-voltage sources on the market now that you can manage most indoor lighting needs without needing to control high-voltage AC sources.
This list of parts is not comprehensive, it’s just a list of some of the parts I’ve used in building this repository.
Single-channel and multi-channel LED strips are very popular these days, and pretty easy to control with a microcontroller and a few transistors. You can find LED strips in a variety of combinations:
There are a number of addressable LED components on the market now, and they come in a variety of form factors. Covered here are a couple of the most popular, the WS28xx/SK68xx LEDs, and the APA102C LEDs. Adafruit calls their products that use these LEDs NeoPixels and DotStars, respectively. SparkFun calls their APA102C line Lumenati. Whatever you call them, they’re relatively easy to use, and there are many good tools for controlling them. Addressable strips can be found in the many of the same variations as non-addressable strips, including RGB, RGBW, RGBAW, and WWA.
The examples below are written mostly using Adafruit’s NeoPixel and DotStar libraries. Since they have mostly the same API, you can convert any of the sketches from one protocol to the other with minimal changes.
The relationship between perceived brightness and the power controlling a light source is non-linear. In otherwise, if you fade an LED source in a straight line, it won’t appear to you to be fading evenly in time. Depending on the effect you’re looking for, you might want a light source to start fading slowly and then speed up, or slow down at the end of its fade. It helps to have methods for a few different fade curves available.
Whether you’re working with tunable white lighting sources or color sources, it’s useful to understand a few things about Color Spaces and Color Temperature in order to get the most our of your sources.
I’ve also written a ColorConverter library that converts RGB and RGBW values to hue, saturation, and intensity (HSI values); and converts HSI values to RGB.
The examples below use the ColorConverter library to control a WWA strip by calculating relative mix of warm, cool, and amber as hue. Intensity can then be controlled independently of color temperature. Examples:
Sometimes you need to make patterns for lighting fixtures. Here are some examples.