Wednesday, September 14, 2011

LPD8806 and progress on the netlogicdc sign

LPD8806 Interactive code
The office build-out is coming along, and I'm continuing work on the the design to get a prototype out.

I picked up a Digital Addressable RGB LED from Adafruit. After messing around with it a few nights, I finally got it working with the test  it up with the test code, so I'm confident I can use this to create my project.

This a really cool  component. It has 32 addressable RGB LEDs per meter. Each LED can be individually addressable. The strip itself can but cut into 2 LED segments, so any length of LEDs can be addressable. The 5 meter roll has 160 LEDs.

Adafruit has published code on the Adafruit LPD8806 github repo to get you started. This is a library that you add to Arduino, which makes it very easy to send commands to the strip.

Goals for today's post
I wanted to understand better the functionality of this LED strip, so I built an interactive Arduino program so I could send individual commands to the strip. So the goals for today's post are:
  1. Create a Arduino script to allow me to - interactively via serial - enter a single LED's color and fade time. Done.
  2. Create a randomized sequence of flashing LEDs, an effect somewhat like starlight. So far I'm working on getting the randomization to fade in and out.
Interactive Serial
I built a simple serial interactive sketch for Arduino. I used the interactive code for the BlinkM LED from Todd Kurt to model an interactive serial session using the built in serial monitor on the Arduino IDE. If you are using the original Adafruit code, you'll need to add the correct library to your Arduino program folder.

Download my interactive serial sketch for the LDP8806 on github. You'll need to use my updated Adafruit library with the Arduino sketch. This is so that you can use both the older Adafruit libraries alongside the newer optimized cjbaar libraries.

Be aware that you'll need to update any sketches by finding and replacing LPD8806 with LPD8806old in any sketches to use the old code.

The biggest sketch difference is that the new code uses the specific SPI pins on the Arduino board, whereas the older Adafruit code allowed you to specify which digital pins to use.

Once the sketch is running on your Arduino UNO, open the serial monitor using the Arduino IDE. The following commands will interactively change the string LEDs:
 r - (r)eset
 c - (c)olor chase
 w - (w)heel
 i - colorW(i)pe
 s - (s)et inidividual to R, G, B, LED
 f - set (f)ade speed
This should give you a good idea of the various capabilities of the Digital LED Strip.

Randomized Sequence
Based on the results of the interactive program, I built the following sketch, strand_nldc_green, for a sequence to base the netlogicdc sign off off. The company colors are green, so it's called the nldc green sketch. Note that the program is actually blue. While tinkering, the blue is much more easy on the eyes.

For future posts
  1. Find or Optimize the code to make it faster.
  2. Create an interaction program for a PING sensor and/or IR sensors
Today's goal is to create an aesthetically pleasing light sequence. Once the bugs are ironed out, I'll move on to the adding an interactive component, that will affect the quality or color of the LED strip.

If you have questions on how to use this, send a comment. I work a full time job, so I won't get back immediately, but I'll check back every few days.



No comments:

Post a Comment