NeoPixels Revealed: Eavesdroping on signal reshaping between pixels

This is Part 3 in a series. Read Part 1 here.

 

One of the things that makes NeoPixels so useful is that you can connect huge numbers of them end to end and they will faithfully relay your data on down the line. According to the Englishish datasheet, “Built-in signal reshaping circuit, after wave reshaping to the next driver, ensure wave-form distortion not accumulate”.

To see how this actually works, we need to go NSA on a couple of Neopixels and intercept their communications…

 

Going NSA on a Neopixel

Going NSA on a Neopixel

I’ve placed a wiretap on the trace that connects the data-out from the near NeoPixel to the data-in of the far one.

Here is some fine reshaping action…

Channel Color Connection
1 Yellow trigger (ignore)
2 Blue Pixel #1 DIN Data
3 Purple Pixel #1 DOUT Data (also Pixel #2 DIN Data)

 

NewFile6

Here an out-of-spec 186ns 0-bit runt gets stretched into lovely in-spec 386ns 0-bit.

 

NewFile0

Here an out-of-spec 560ns 0-bit whale gets compressed down into lovely in-spec 376ns 0-bit.

So, it seems that this NeoPixel’s idea of a perfect 0-bit is about 380ns, and it will reshape any out of spec 0-bit to meet that ideal. It will even reshape in-spec 0-bits to meet this standard…

 

NewFile7

…here changing an in-spec 434ns o-bit into an “ideal” 380ms.

Works for 1-bits too….

NewFile9

A short 688ns 1-bit getting stretched into an “ideal” 772ns 1-bit.

NewFile10

…and a long 872ns 1-bit getting squeezed down to a 768ns 1-bit. Looks like this pixel’s dream 1-bit is about 770ns long.

It’s that simple. Anytime any bit is detected, it gets retransmitted as an “ideal” bit.

Like people, each NeoPixel has its own concept of what “ideal” means, and it can change over time. Generally all NeoPixel’s ideal widths will fit within the spec, but there is plenty of room for variation.

This has some important consequences.

In the case of bits that the current pixel sees as too long, it will shorten these and that will increase the length of the low time after the pixel. Normally this will not be a problem, but in the case of a grotesquely large 1-bit, that gap after the bit can become so long that it becomes a reset latch pulse…

 

Neopixel telephone game

Neopixel telephone game with really long 1-bitsThe bottom blue trace shows the (very long) 1-bit coming in just fine, but the purple trace shows that ~6ns later, it is spitting out a perfectly proportioned 720ns long 1-bit  to the next pixel in the line.

Here, a 7,000ns 1-bit is reshaped to a 720ns 1-bit followed by 6,280ns gap. The long 1-bit is thereby converted into a normal 1-bit followed by a reset. This is what defines the practical maximum length of a 1-bit in a string.

Conversely, in the case of bit that the current pixel sees as too short, it will widen it and that will use up some of the gap before the next pixel.

When a chip with an “ideal” 1-bit that is on the high end of the spectrum meets a long chain of short 1-bits, you can imagine that the stretching 1-bits could eventually use up enough of the gap that it would be less than the required minimum and you’d get a overrun. I think it is counter-intuitive that a chain of short bits could cause an overrun, but it is really the downstream elongated bits that cause the overrun because they are intruding into the gap.  Got that?

No? Well the take away message is….

Do not try to pack your bits in too tightly

Leave a Reply