Tiny Neopixel controller with LPC1114

Neopixels are RGB LEDs that are fully controllable and can be linked together. You can set the RGB value with 24-bit precision and chain together many Neopixels. Neopixels are sold in different configurations, one of which is a long strip like this one sold by Adafruit:

/media/uploads/rhodes42/neopixels.jpg http://www.adafruit.com/products/1138

I had one of these strips already so I wanted to put it to use.

The Neopixel is based on the WS2812 driver chip (datasheet: http://www.adafruit.com/datasheets/WS2812.pdf). This chip is controlled by a single-wire signal where 0's and 1's are represented by pulses with differing duty cycles. 24-bit values representing GRB color are encoded in this manner and the color for each pixel in a strip is sent out in order. The pixels will automatically get the right value by taking the first 24 bits received and passing the rest to the next pixel. A reset signal is used to mark the end of a sequence.

I started with this WS2812 code:

Import programLEDTape_WS2812

see: http://mbed.org/users/okini3939/notebook/led_strip/

This code uses SPI and interrupts to generate the signal. Two different values are written to the SPI that represent 0 and 1 when the frequency is set correctly. The interrupts allow the code that sets LED color to simply modify an array of color values and write out the data waveform in the background.

There were several changes and additions to be made before I could use this code. First off, this design used an inverter chip to change the uC's 3.3V signal to a 5V signal. I could not get a satisfactory waveform out of any of the inverter chips I tried, so I needed to make the code different to account for the change in polarity. This was accomplished by changing the values representing 0 and 1 pulses and changing the value written during idle time. I wanted to have some higher-level functions that would modify multiple pixels in the strip at once, so I added 'LEDStripFunctions' .h and .cpp. These include functions to set all pixels a certain color at once, to set all pixels' colors from an array, modify brightness of an array, to circular shift color values in an array, and to set evenly spaced pixels with a modulus + offset scheme. Lastly, I wanted to run this code on the tiny LPC1114 chip, so I changed the code to allow that.

The LPC1114 is a small ARM-based microcontroller in a 28-pin DIP package. I used this code for my mbed LPC1768 to flash the LPC1114:

Import programika_shouyu_poppoyaki

this transfers data (which is stored in "bin" file in mbed storage) into LPC1114, LPC1115, LPC81x, LPC82x, LPC1768/LPC1769 and LPC11U68/LPC11E68 internal flash memory through ISP.

First these connections were made: https://mbed.org/media/uploads/okano/isp_connection_dip28.png

Then all that needed to be done was to change my compiler's platform, compile my code, change the .bin file output to a file named 'bin' that has no extension (easy way is to use cmd: 'rename <file>.bin bin'), and drop the file on the mbed with USB.

The demo I made uses the mod functions to fill the strip with multi-color pixels then shifts them over and over again. Here's a video of the demo in action:

The code for this project can be found here:

Import programLPC1114_Neopixel

Library and demo using the WS2812-based Neopixel strip connected to an LPC114

1 comment on Tiny Neopixel controller with LPC1114:

15 May 2017

Thanks for your information,as you know,ws2812 upgrade ws2813 sk6812, and ws2813 is breakpoint addressable led strip, so,ws2813 and sk6812 also can use that controller? you know ws2815 led strip?

Please log in to post comments.