A generic guide to LED-e-fying things

I get asked about how my projects work all the time! I thought I would write up a small guide for anyone wanting to start doing this sort of stuff or anyone just interested in how this stuff works.

LEDs

There are 2 types of addressable LED strips on the market at the moment that are really well suited for portable, wearable, low power, awesome results. There are a bunch more different LED strips out there but ill talk specifically about my 2 favorites and some variants

All of these come in 5050 (5 mm x 5 mm) and 3535(3 mm x 3 mm) LED Pixel Variants.

3 Pin WS2812 – Manufactured by World Semi – These are also called Neopixels by Adafruit and by the general maker population of the world. You can get these as individual pixels or set up on strips like the ones i use. The strips come in several different layouts like 30, 60, and 144 pixels per Meter. Each Pixel has 3 LEDs inside, RED, Green and Blue and a tiny little chip that controls it. To light up this type, you need to power it with 5V and send in a tightly timed signal to the data pin. Instructions on this can be found in the datasheet, but all the really low level stuff can taken care of by the FastLED library for Arduino, but ill talk about this later. These are relatively cheap in comparison to the APA102. That’s really the only reason to use these. I recommend only using them for small projects where you have a good power source with little noise. Because they use a tightly timed data signal, there is a high chance of noise and degradation when you line up these pixels in the hundreds.

3 Pin SK6812 – These are a recent clone of the WS2812 and WD2812B. they have slightly different timings but are essentially the same as the WS2812 and can be driven my FastLED and many other libraries.

4 Pin APA102 – Manufactured by APA Electronics – These are called SuperLED or APA102c. You can get these as individual pixels or set up on strips like the ones I use. The strips come in several different layouts like 30, 60, and 144 pixels per Meter. Each Pixel has 3 LEDs inside, RED, Green and Blue and a tiny little chip that controls it. To light up this type, you need to power it with 5v but unlike the WS2812, you send in a CLOCK and DATA signal. This means the signal is very hard to degrade over really long chains of pixels. Im talking in the thousands! The Wow suit currently utilises these LEDs and has 1920 pixels! As with the above, the low level control details can be found int he datasheet linked in the name above. These are the costly of the 2, but they have significant benefits. You can chain them up to ridiculously long chains, you can use FastLED or any device that has SPI which opens up the kind of controller you can use.

4 PIN SK9822 – A new clone of the APA102 and APA102C pixel. These can be driven at 30MHZ!!!

At the end of the day, both types have pretty much the same colour rendition, and power use.

Hardware/Micro Controllers

This really comes down to what you know, and what you are comfortable in coding. Ill start with the simplest and go to more advanced devices. I will leave out a ton of devices, I’m just writing about the ones I have used and recommend.

Arduino Uno or Nano with an ATmega328 will cater to most people. They are super easy to hook up, and program. Both the WS2812/SK6812 and the APA102/SK9822 are supported by the FastLED Library and both can control the APA102/SK9822 without the library just using SPI! The both use very little power and are small enough to be concealed as wearable devices. There are countless versions os the Arduino wearable platform. The daw back with these is the amount of SRAM they have. At 2000 bytes, you start to really appreciate every byte when you start writing software for LED Strips. If you want to make something simple with under 300 LEDs and no MAPPING(will discuss this in the software part) these are perfect.

Arduino Mega with an ATmega1280 will cater to larger projects where you may want to MAP your LEDs to a surface or just have more than 500 LEDs do interesting stuff. Again its supported by the FastLED Library and it can control the APA102/SK9822 without the library just using SPI!

The Teensy is an amazing piece of kit fully supported by the FastLED Library. These are slightly more expensive, but have tons of SRAM, are faster, use less power and are TINY!

The NodeMCU with an ESP8266 can be had for $15AUD Is tiny, has BUILT IN WIFI and can be coded in the Arduino IDE or via the LUA language. These are currently supported by the FastLED Library. There is a working library for the WS2812/SK6812 that works by using Pin 4 to control the LEDS but take note this controller has 3.3v logic. You can also control the APA102/SK9822 directly via the Controllers SPI device. Again, you will have to write you own driver.

The Raspberry Pi is nifty if you want heaps of grunt with a full Linux OS under the hood. It has an SPI device that can control APA102/SK9822 Strips, not 100% sure about the WS2812/SK6812 support. Take note that the RPi also has 3.3v logic. I wouldn’t recommend using these unless you had a specific use case. I have instructions on my blog on how to set up an RPI A+ with the MRAA library in NodeJS to control APA102 pixels (thats how the Wow Suit works at the moment)

Software

The best thing to happen to LED strips is the FastLED Library! Go check it out. You can have a huge strip of LEDs running on 10 lines of code! I use FastLED to control both the WS2812 and the APA102 LEDs on all Arduino based boards.

When i use boards that don’t have FastLED support like the NodeMCU, I usually use the SPI protocol and utilise the APA102 strips instead of the WS2812. There are 2 (probably more) different ways that you can drive LED strips.

Direct Drive your LEDs by writing software that directly write to the LED strip in real time when your LEDs are connected together with no special shapes. For example, lets say you have a strip of 50 LEDs  inside a hulla hoop. You don’t really need anything fancy, just an array of bytes for each LEDs colour. You then modify ledArray[ledIndex].colour=red and render the LEDs

Mapped Drive is when your LEDs are physically mapped to a specific surface and connected together in complicated chains. Lets say you want to put a bunch of led strips onto a glove on each finger. How to you address the and connect the strips? You line them up and record the order in which each LED is connected. You then create a MAP of your LED addresses bases on their real world Addresses and render to them like so. This is a really complicated topic so i wont write too much, I suggest looking it up online….or if you want more info shoot me an email!