Interactive Christmas Tree – DipCortex + WS2812B

It being almost Christmas I decided to decorate the family tree with some RGB LEDs but I wanted a bit more fun for myself and my two-year old daughter. So I used addressable RGB LED strip driven with a DipCortex. Which lets us set any LED on the strip to any colour.

To provide some interactivity I added a set of Red,Green and Blue arcade buttons. I set them up so my daughter can walk up to the tree and set off a colour, or mix of colours, spinning up the tree. Which as well as entertaining has been fun watching her mix the colours and shout out their names.

DipCortex-ArcadeButton-Tree-Controller

Huge box for the huge buttons and the tiny DipCortex

Normally controlling a large number of LEDs requires a number of LED driver chips and lots of control lines, The strips I am using on the tree have 360 LEDs and this is all controlled via one port pin. The LEDs themselves are also very tightly packed on to the strip and this is possible because the LED driver has been embedded in to the silicon of the LED. So you end up with a small four pin device that uses two pins for power, one for communication in and the last for communication out.

WS2812B RGB Led SolderSplash

WS2812B – Driver silicon and the bonding wires to the LEDs can be seen inside the LED

To save wiring, each LEDs communication output is connected to the next LEDs Input port. It listens for its 24bit’s of data, actions it and then allows the rest to pass through to the next LED. Letting you daisy chain 100’s of them, each LED buffers the communication bus as well making it quite robust.

The one wire bus is time critical and unique for this LED, meaning there are no micro-controller peripherals tailored to it. Each bit transmitted on the bus is encoded as a pulse width, a 1/high being 900ns ±150ns and a 0/low 350us ±150ns with a pulse every 1.25uS / 800KHz.

One option is to bit bang the communication, manually controlling the port pin. This can be harder than it seems as you need to know the architecture of the micro and the compiler inside and out. While you are doing this the processor has to be dedicated to this one job.

An easier way is to abuse cleverly use a peripheral like a PWM, Compare timer or SPI. Using a timer you could interrupt each time it matches a match register letting you decide if you need to modify the match register before the next match comes around.

With SPI you can set the datarate so that a bit or number of bits are the correct width. You then simply feed the SPI peripheral with bytes that create the correct bit pattern. SPI has the advantage that you can use the DipCortex’s LPC1347’s FIFO to feed the peripheral data and have no hard timing issues to deal with. I went the SPI route and fine tuned the frequency to allow me to pack 4 bits of data into one 16bit transmission from the SPI peripheral. You can find the code for the demo code on GitHub as a starting point for your next DipCortex and WS2812B Project.

We also have put in stock a reel of the bare WS2812B LEDs for you to add to your own projects.

Have a good Christmas.

Tags: , , ,

No comments yet.

Leave a Reply

 
 

cheapest viagra
buy viagra mesa
non prescription viagra
buy cheap generic viagra
best place to buy viagra
viagra and cialis and
buy viagra usa
buy viagra prescription
buy cheap generic online viagra
buy viagra now
viagra by the pill
cheap pill viagra
buy viagra new york
buy viagra onli
cheap price viagra
free viagra
viagra and cialas
buy online online viagra viagra
buy deal viagra
buy viagra on-line
buy cheap generic viagra online
viagra for sale
buy discount viagra
buy viagra without prescription