JulianHartline.com Rotating Header Image

Tinkering Update: LED Strip Project

At the same as working on the nRF24L01+ PCB,  I’ve been progressing on another project. I picked up a 30/m addressable LED strip from Macetech. These LED strips are comprised of the WS2812 tricolor LED and controller package.

The WS2812 contains a red, green, and blue LED and a controller complete with a single line data interface and 3 PWM modules for running each of the LEDs individually at independent brightnesses. Furthermore, the controller is set up so that it can transmit signals to the next WS2812 in the strip so that these modules can be daisy chained.

When put together into an LED strip, a microcontroller can simply provide power, ground, and a single line of data to control the entire strip. To populate the LED strip, a series of  bytes is sent to the first LED. Once 3 bytes are sent (the color definition for one LED) the next byte causes the first color to be “pushed” on to the next LED. When the entire strip is populated, sending a reset signal causes each LED to display the color that it ends up with.

Sending a byte to the WS2812 requires 8 transitions on the data line each spanning 1.25 microseconds for a total of 10 microseconds per byte. Unfortunately, using a PIC18F25k80, this timing requirement allows for about 20 processor cycles for each bit transition. This is is a pretty tight requirement and I was unable to make it with my C compiler. Instead I ended up writing a method in assembly to get the timing I needed. It took awhile to get it right and it still has some minor bugs, but it was an interesting exercise.

After getting the code working on the nRF board that I previously blogged about, I designed a new PCB to better fit my requirements in a smaller package. This time I used primarily surface mount parts in significantly smaller packages. Here is the final PCB design and the populated board.



Remarkably, this board seemed to work flawlessly the first time around. Both the nRF module and the LEDs worked exactly as expected.

One additional piece of progress made with this board was our first successful use of reflow soldering to populate the board. Reflow soldering uses solder paste instead of traditional solder which is viscous at room temperature. To solder a board, solder paste is applied to all of the pads and then components are placed in the sticky paste. Once prepared, the board is simply baked to just over 180° C which causes the paste to fuse to the contacts and turn into solder, thus soldering your entire board in moments.

I’ve continued writing code for this board and have a simple proof of concept that lights the strip in some demo patterns during until it receives a packet on the wireless module. At that point, the LED strip is under remote control. Packets consist of an starting index, a length, and the payload that is copied into the LED buffer and then displayed to the LED strip.

The next step in this project is to design a new board, probably using an Atmega microcontroller that will fit into a case sold by Polycase. Getting a PCB and components to fit into a case is a new hurdle that has involved a significant amount of 3D modeling in SketchUp as well as extra spacial considerations such as switching to a flatter power jack.

Comments are closed.