TrackPacer Part 3 - Controlling Thousands of LEDs

Eli Fatsi, Former Development Director

Article Category: #Code

Posted on

This is the last post in a 3 part series detailing the construction of our latest hardware project - TrackPacer. In this post, I'll cover the different ways you can control large numbers of LEDs using an Arduino and open source libraries, as well as describe the technique we settled on for efficiently managing 12,000 LEDs.

Background (Getting Started)

Note: This post will focus on interacting with NeoPixel LEDs.

led wall

Adafruit's NeoPixel LEDs are a joy to work with. You power them with 5 volts, they come in lengthy strips, and there are a number of libraries out there with great code examples so you can get up and running in no time at all. A great one to get started with is Adafruit's own NeoPixel library.

With the library, the code to control specific LEDs is quite easy:

#include <Adafruit_NeoPixel.h>
#define PIXELS 150
#define PIN 12
#define LED_TYPE (NEO_GRB + NEO_KHZ800)

Adafruit_NeoPixel leds = Adafruit_NeoPixel(PIXELS, PIN, LED_TYPE);

void setup() {

void loop() {
  for(int i = 0; i < PIXELS; i++) {
    leds.setPixelColor(i, 255, 0, 255); // (pixel, Red, Green, Blue);

If however you want to control more than a couple hundred, you can run into memory, power, or data integrity limitations. To successfully control larger numbers of LEDs, there are a few requirements to tackle.

Requirement #1: The Brain

Adafruit's NeoPixel library is very easy to use, in part because it holds a buffer of all of the lights in memory. 3 bytes for each light for the Red, Green, and Blue values. This memory buffer is great as it lets you individually set the values for specific lights in your strip, but it does chew into the limited space you have if you're on something like an Arduino Uno or Mega. There are a couple options to handle this.

Option #1: Bigger Brain


If you're ready to take the Arduino training wheels off, then look into the Teensy. While the Arduino Uno will top out at around 450 LEDs, the Teensy should bring you control of over 20,000 by my calculation. Of course, you'll start running into power issues at that level but at least you'll have the memory problem taken care of.

Option 2: More Efficient Brain

If you're stuck with limited memory, you can jump onto the road less travelled and ditch the memory buffer for the LEDs. Without all of your LEDs in memory, you lose the ability to write to specific LEDs and instead are forced to iterate over each LED and send the RGB command one by one.

There's an excellent post on which explains the ins and outs of how this works, and links to the code you can drop in yourself. The upside of this technique is that you can now control a limitless number of LEDs. The downside is your interface for doing so becomes trickier.

Option 3: Lots of Brains

This takes a bit more work, but if your project calls for it, it might be best to scale the number of your LED controlling microcontrollers. If you have the resources to do so, scaling horizontally is a great way to control lots of LEDs.

Combine this with a bigger or more efficient brain and you've got a mighty system. If you need some tips on how to get multiple microcontrollers talking to each other, check out Part 2 of this post series.

Requirement #2: Power

I have less tips and tricks for handling this requirement - it's more of a "just do it the right way" kind of thing. You want to make sure you're supplying enough current for your project.

LEDs pull the most amount of current when they're shining bright white - full intensity on Red, Blue, and Green. For NeoPixels, one pixel draws 60mA at bright white. Multiply that by whatever number of LEDs you're planning on using, and compare that with the current your power supply is capable of putting out. If it doesn't supply enough current, consider using a beefier power supply or introducing multiple different supplies to spread the load.

What We Did

For the Trackpacer project, we settled on a combination of techniques by chaining multiple Teensys together - Lots of Bigger Brains. Every Teensy has it's own power supply and is in charge of 1,200 LEDs (two strands of 600 to minimize voltage drop over the LED strips).

It's surely a sight to see that many LEDs all synchronized together. If you've managed a large scale LED setup, I'd love to hear about it in the comments below. And if you've found this interesting, check out the other posts in this series Part 1 - A Nerdy Overview, and Part 2 - Connecting Multiple Microcontrollers Using ICSC.

Related Articles