Prototype time.

OldDogBlog post 5.

In order to determine how big an FPGA to use, I have to have some idea how large the circuitry inside it will be. A quick way to do this is to prototype a string driver circuit. I expect this will be somewhat unchanging regardless of the architecture of the circuits feeding it.

WS2812B LEDs have somewhat strict timing requirements for them to work properly and reliably. The best chance of having a pixel string work correctly is to follow the manufacturer recommended voltage and timing requirements as closely as possible.

Now for a little math. If you are familiar with the WS2812B LED, they require a serial input signal that follows a specific format in order to load the color values into the LED. Each color (Red, Green, Blue) is 8 bits wide so three colors = 8 bits X 3 colors = 24 bits.

One bit time for a WS2812B is 1.25 uSec in duration. 24 bits therefore requires 24 x 1.25 uSec = 30 uSec. The waveform for a logic ‘0’ is 400 nSec high and 850 nSec low. A logic ‘1’ is 800 nSec high and 450 nSec low. After the last bit of the last pixel is sent, a gap time of 50 uSec is required for the pixels to change to the new color. Note: the colors must be output to the string in G-R-B order.

Fundamentally I need a circuit that can accept the three RGB color bytes, then output them serially to a string with the timing described. I’ll call this circuit a “String Engine.”

At this point I don’t have the circuit clock frequencies established so I’ll just guess 120 MHz for now. This might change but is a place to start. The pixel bit period of 1.25 uSec equates to 150 clock cycles at 120 MHz. A ‘1’ would be 48 clocks high and 102 clocks low. A ‘0’ would be 96 clocks high and 54 clocks low.

Counting 150 clock cycles requires an 8-bit counter. Add to this the three 8-bit color registers, a 24-to-1 multiplexer and a flip-flop on the output of the mux as the basic circuit. Add another 5-bit counter to count the 24 color bits as they are generated. Estimate 38 flip-flops plus glue logic.

I was able to prototype this quickly in both Intel Quartus and Xilinx ISE and came up with a functioning circuit that uses 40 flip-flops. My quick estimate was close for a single string feeder. Some quick multiplication for 32 strings yields an estimate of approximately 1280 flip-flops. This should comfortably fit into any part with at least 4000 registers or more.

At this point I was mostly concerned about RAM resources. As a place to start I kept the 32 string notion so the next question is: how many pixels per string, i.e. what string length would I support.

A quick scan of common string types showed 30 pixels/meter, 60 pixels/meter and 144 pixels/meter as the most common string types. Two meters of 144 pixels/meter = 288 pixels/string. Times 32 strings = 9216 pixels! A healthy number of pixels that will consume copious amounts of current. Each of the three LEDs in a pixel can pull up to 20 mA. That is 60 mA per pixel, worst case.

9216 x .060A = 553Amps, worst case. At 5V this almost 2.8 KW! That’s over 23A at 120V. This will be my goal. This many pixels requires 9216 * 3 = 27648 RAM bytes = 27 RAMs of size 1024 x 8.

The chart in OldDogBlog #4 suggests a Spartan6 LX9 or MAX10M08 as my two likeliest candidates. In either of these parts there should be plenty of resources left for the circuitry to feed color bytes to the String Engines as well as the interfaces to the outside world to accept string RGB values.

Engineering is about making decisions based on a wide variety of factors. The single most expensive part on ezPixel is the FPGA. Choosing the FPGA impacts many other things beyond just cost. In the next post I’ll discuss how I came to my decision on which part to use…


Tom Burke

Leave a Reply

Your email address will not be published. Required fields are marked *