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:
- Create a Arduino script to allow me to - interactively via serial - enter a single LED's color and fade time. Done.
- 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.
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.
For future posts
- Find or Optimize the code to make it faster.
- 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.