Alright, time for my first non-SaikoLED/Artemis post!
I received a comment on my Youtube channel asking for the code to one of my absolute favorite projects so far.
Featured below is a commercial for the Philips Ambilight technology. This is an absolutely fascinating feature on new TVs that actually lights up the area surrounding the screen, based on the most prominent color currently being shown. Note the use of purple/green that they demonstrate for The Hulk.
I was overjoyed when I discovered that there was an existing DIY Ambilight clone featured at http://www.lifehacker.com.
Basically, a hobbyist by the name of Rajarshi Roy had created this clone by writing his own screen capture software in Processing, and then using that to send the color data to an Arduino, which then drove a strip of RGB LEDs. He used a strip that was being sold at SparkFun’s website. I have an inexplicable dislike of ordering things online, so I decided to eat the extra cost and buy a Radio Shack RGB LED strip. This was, possibly, the worst mistake I could’ve made.
The SparkFun strip used four wires and was very well documented. The Radio Shack strip used three wires, and was incredibly confusing with no documentation whatsoever. I used Rajarshi’s Processing code and Arduino code at first, as a base point. Of course, it didn’t work. It wasn’t written for the hardware that I used. I then modified Radio Shack’s example code, which sent hex values to the ICs that drove the RGBs. It then used timed pulses to push data across the strip, lighting them up with the specified color. I don’t know this because it was in the documentation. I know this because I spent an entire night/morning reading through it and barely grasping the concept. I still don’t have a concrete idea on how it works. Instead of advertising it as a DIY component, they should honestly just say “Radio Shack – 1 Meter RGB LED Bright Flashing Rainbow Strip”, as that’s all the default code does.
I cut out all of the bits of code that sent all of the pretty colors, and then took bits of Rajarshi’s code and plugged them in. I made progress! The lights came on and actually reacted to the computer. However, everything was pink. No matter what I did, everything was pink. I gave up for the night, and literally woke up four hours later with the answer popping into my head. The values are reversed. It’s not an RGB strip. It’s a BGR strip. I swapped the values around a little and tried again…
Ohhhhh yeah. I then decided to test it out using Winamp’s visualizer, and the DI.FM Epic Trance broadcast.
BEAUTIFUL. I loved it! To this day, the Arduino and RGB strip are permanently mounted behind my TV. It’s excellent for movies and video games (Seriously, firing the Plasma Gun in Quake 3 is so much fun. The whole room lights up.)
I’ve attached the two files I used below. The Arduino code (Named strip_1m.ino because I never bothered to rename the Radio Shack file), and the Processing code. Enjoy!
QUICK NOTE : I do NOT take any credit for the hard work put behind Rajarshi Roy’s work. All I did was make the program play nice with the Radio Shack RGB strip. If you’d like to thank anybody, thank the man himself right here.
Also, please keep in mind that you’re going to need both Processing, found at http://www.processing.org/
and the Arduino programmer itself, along with an Arduino, of course. The programmer is found at http://arduino.cc/en/main/software
Both programs look nearly identical. Always double check to make sure which one you’re in!
The Arduino code:
The Processing code: