While browsing the internet as a modelrailroad enthousiast, I regularly stumble upon different ways to control “lights” on the modelrailroad itself … Most of them are limited in quantity, brightness or color. What if I tell you there is a really easy way to control as much LEDs as you want, by using only one pin on an Arduino (or 2 pins, depending on the chosen chipset), and you will be able to control each LED individually, control its brightness and control its color ?
This tutorial is about such “control” 🙂
First of all, we now life in a world where everything contains a microcontroller, even LEDs ! Yes, you heard this correct, LEDs with built-in (very small) microcontrollers ! We even have them in different tastes, the so called “chipsets”.
1. Types “chipsets” for LEDs
There are roughly 2 types of chipsets (the IC inside the LED, that takes care of the brightness/color) used inside those RGB LEDs.
group 1: SPI based
Those are LEDs controlled by 4 wires: GND / +5V / data / clock
So these LEDs use 2 IO-pins on your Arduino, and are all wired in “one big chain”, by 4 wires.
The following chipsets use this “interface”: LPD8806 / WS2801 / SM16716 / APA102
group 2: 3-wire chipsets
Those are LEDs controlled by 3 wires: GND / +5V / data
So you only need 1 IO-pin from your Arduino. And all are wired in “one big chain”, by 3 wires.
The following chipsets use this “interface”: NeoPixel (WS2811 / WS2812 / WS2812B) / TM1803 / TM1804 / TM1809 / UCS1903 / UCS1903B /
UCS1904 / UCS2903 / GW8205 / LPD1886
For almost any type of these chipsets, you will find an Arduino library, but my advise is to buy the ones based on WS2811/WS2812/WS2812B.
Those are the most popular types, widely available. And due to its popularity, you will find them for a nice price.
And instead of looking for different types of libraries, I advice you the use the “FastLed” Library. This library is a mature library, with top-notch “speed”, ease of usage and supporting the most common types of LED chipsets. You only need to modify one line of code, to migrate your complete project
from one type of LEDs to another type !
In the following picture, you can clearly notice the difference between a group-2 (3 wires) and a group-1 (4-wires) LED-strip.
You will probably be amazed by the above picture, because we started talking about LEDs, and the first picture I show you, is a LED-strip 🙂
Well, to be honest, those addressable LEDs, do come in a variety of shapes !
2. Variety of shapes of LEDs
To be continued tomorrow …