Fixing a Small Gotcha With Adafruit's NeoPixels

A slight problem may have taken out one of Max Maxfield's Adafruit NeoPixel rings. Happily, there is a solution.

For the past couple of weeks, I've been happily playing with Adafruit's NeoPixels. Sad to relate, I just ran into a slight problem, which may have taken out one of my NeoPixel Rings. Fortunately, there is a solution.

Now, before we plunge headfirst into the fray, I'd like to start by saying that I have the utmost respect for the stuff (products, tutorials, and whatnot) from the folks at Adafruit. Quite apart from anything else, I really like the way the company seems to anticipate things I need. As a simple example, I recently purchased a 5V 10A switching power supply to power my NeoPixels (about which, more below).

As we can see, the output from this power supply is delivered via a 2.1mm male plug. In the past, I would typically have cut this plug off (which I hate doing) and connected the wires directly into my project, but this gets to be a pain when one wishes to move the supply from one project to another. So you can only imagine my surprise and delight to discover that Adafruit also offers a female DC power adapter (a 2.1mm socket with a screw terminal block) as shown below.

I don't know if this is an Adafruit special, or if you can find such devices all over the place. What I do know is that I've never seen one before, but I love the idea. I immediately ordered one, and I will be adding a bunch more to my next order (which I will be placing sooner rather than later, I have no doubt).

But that's not what I wanted to talk to you about. A couple of weeks ago, I decided to make an infinity mirror. This is when I first became aware of Adafruit's NeoPixels, which are an incredibly cool idea. Each NeoPixel is presented in a small (3/16" square) package that includes red, green, and blue LEDs along with pulse-width modulated controllers. Furthermore, each NeoPixel has only four external terminals: 5V, 0V (ground), data-in, and data-out, which allows you to daisy chain a bunch of them together. For example, consider the Adafruit NeoPixel Digital RGB LED strip, which contains 60 NeoPixels per meter. You actually purchase this by the meter.

Using the Arduino library that you download from the Adafruit website, you can control the color and brightness of each pixel individually -- and the amazing thing is that all this requires only a single digital output pin on your Arduino microcontroller.

While I was playing with such a strip in the context of my infinity mirror, I thought, "Just a minute. These NeoPixels would be ideal for my pedagogical and phantasmagorical inamorata prognostication engine. I've had this project on the back burner for a couple of years. The problem is that I need to be able to monitor a lot of switches and knobs and control a lot of LEDs and analog meters. Every time I've turned my attention to this in the past, things have quickly grown too cumbersome, and my attention has drifted away again. But it struck me that I could use an Arduino to control all the LEDs using a single output pin. Also, I can use the Arduino's PWM outputs to control my analog meters and its analog inputs to monitor my rotary potentiometers.

The image below shows my first-pass layout for the control panel. Things have evolved a little since I took this picture, but the overall feel is the same.

Currently, I think we are looking at using 116 LEDs. In the case of standalone LEDs, I might simply cut them off a NeoPixel strip like the one shown above. Alternatively, I might be tempted to use the individually presented Flora NeoPixels shown below.

@sdtrent: You should not trash your NeoPixel ring just yet. Try powering the ring and sending your data into the data-in line on the second pixel, or third, etc. There is a chance that the first pixel is damaged and not flowing the signal data to the next pixel in the chain.

That's actually a really good idea -- and, in fact, if that works, then it probably wouldn't be too difficult to simply replace the first pixel... thanks for the suggestion.

You should not trash your NeoPixel ring just yet. Try powering the ring and sending your data into the data-in line on the second pixel, or third, etc. There is a chance that the first pixel is damaged and not flowing the signal data to the next pixel in the chain. Other than overvoltage, I would be surprised if you managed to kill all of the pixels.

Also, part of the perceived update speed is that the pixel LED data is updated for the desired pixels before SHOW is used to update the output currents of the whole strip at one time. This allows a flicker free update because you are not seeing the changes in each pixel each time the individual pixel's data is updated.

@Marty: I've pondered putting a small FPGA board between an Arduino (or RPi, or something else) and using it as a high-speed dedicated controller for my WS2812-based ring, matrix and strip.

Thanks for the great information -- very interesting -- and if you do use an FPGA to do this, I woudl LOVE for you to write the project up and to post it for others to peruse and ponder here on EE Times.

I was messing around with these LEDs long before they were called "NeoPixels". First, the LED units are the WS2812 (or WS2812b, which is better suited to the higher current paths large strips and arrays demand). That unit consists of a 5050 SMT RGB LED combined with a WS2811 controller.

The WS2811 protocol is detailed in the datasheets as well as numerous sites (I found http://hackaday.com/2012/12/07/driving-a-ws2811-rgb-led-pixel/ to be helpful when I was getting started with it). Conceptually, it works like this: at any point after a 50 us quiet period (data line held low) a given led is ready for input. The first WS2811 in the chain reads 24 bits (8 bits each for red, green, and blue), and after that it just forwards the rest of the bits downstream. The next WS2811 does the same, and so forth, until you stop sending data (obviously extra data beyond the last LED goes nowhere).

You can search for the WS2811 datasheet and see the exact timings involved (there's both a low and a high speed mode).

Keep in mind that the AVR at 16 MHz doesn't allow a lot of overhead for data processing. I managed at one point to marry the strip with a controller... but there wasn't a lot of room to do anything else:

Adafruit sells products of their own design and products of someone else's design. What I really like about them is the amount of value that add to whatever it is they're selling. The libraries and tutorials they provide are pretty incredible in terms of quality and breadth. They also give a lot of support to what used to be a re-emerging hobby community, but is now also a re-emerging small start-up business community.