Long, long ago, when I first heard of Philips Ambilight, I thought it was one of the coolest silly things I'd ever heard of. Today, much later, I finally have gotten around to rolling my own Ambilight clone using an Arduino Nano and WS2812B strips. I did not have to write any code, because other people have already done it for me. Figuring out which people had done what properly took me the better part of a day, so I will now share my knowledge with you here. This should be a cross-platform (Win/Lin/Mac) solution, but I have only tested on Windows.
The breakthrough came when I figured out that a program called Prismatik, designed for the reportedly quite good Lightpack LED controller which does the same thing I've done here, also has support for Adalight. You could do a lot worse than just buying Adalight (or buying Lightpack!), but you can save quite a bit of money by using cheaper components. I reasoned that Adalight could be made to support the LEDs I wanted to use, the WS2812B. These are very cheap, very very bright, and they have reverse voltage protection. I paid about $7 on eBay for two one-meter strips with 30 LEDs each. This is more than enough to do this job, but there's no reason to mess about with less. The strips showed up in less than two weeks, and I got to work.
As I mentioned, I didn't have to write any code, so it turned out to not actually be very much work. I found that someone had already manipulated Adalight to support these LEDs, and given enough information to know what to do with them. What you need to know from that page: Install FastLED to your Arduino Libraries directory, then download the modified Adalight code. If you connect DIN on the first LED to pin 6, you will not need to make any changes; just upload the sketch to your device. I am using a $3 Arduino Nano clone with a CH340 serial chip, which works fine at about 15 or 16 frames per second.
I cut the strips into segments and made a full circuit around the display. This 25.5" Samsung monitor has a 16x10 aspect ratio, and coincidentally took 16x10 LED pixels as well. The bottom of the rear of the case has an inset where the cables are installed; I went ahead and cut the strip here and used jumper wires to go around the corners, as I did at the three corners of the monitor that the strip had to circumnavigate. It's very easy to solder to the strip, which has nice coarse solder pads. Some software is picky about the LED direction, but Prismatik doesn't care in the least, so you can aim the strips in any direction you like. Just don't forget that the strips are directional; they have an in side and an out side. They generally have arrows on them showing you which way they run, and the pins are typically labeled DIN and DOUT, or DI and DO, for data in and out respectively.
You should also note that no Arduino can run more than a handful of pixels directly. One nice way to get power in to the pixels is to use an automotive voltage buck converter. I am using one designed for automotive use which is potted in epoxy and which had a USB connector on it; this particular one is "CPT" brand, and I like them fine. They are cheap on eBay with a variety of USB connectors, or without. To run my 52 pixels, I could need a maximum of 60mA*52 for 3.1A; about 55mA is a more reasonable estimate (as measured) for each element which gives 2860mA, which fits neatly into the 15W envelope of one of these buck converters. They cost less than five bucks, and you can feed them with a 12V@1.5A wall wart. I have a ton of those left over from older devices. If you don't have one of those, try looking at flea markets for old inkjet printer power supplies, they often put out 18VAC and you can get a cheap buck converter to regulate that down.
Once you have the strip wired up, it's probably best to test it. The first, simplest, and most obvious test is the Adafruit Neopixel library, and the strandtest example. Just set the number of LEDs and the data pin if necessary, and upload the sketch. If you want to test the Arduino sketch you're actually going to use, then you will need to download both the Adalight software and Processing IDE if you don't have them already. Follow the instructions for Adalight, but using the alternate Arduino sketch. If the colorswirl test works properly, then you should have no problem getting Prismatik to work.
Software and Configuration
I say that, but there is one potential problem; if you ran the LEDs all the way around the display, you're going to have an extra fun time configuring the software. There are probably web-based calculators out there, and there certainly have been in the past. There are also plugins for Prismatik, and some of them improve configuration substantially. I eventually wound up with the forked version of Prismatik which works much better not just with Windows 8 and later (as it uses the Windows Display Duplication API) but also with Windows 7. Direct3D capture does not work well with the official software. There is a substantial performance penalty with DX9, but none with DX10/11. If you don't mind the software throwing up its hands and just giving a dim backlight during gaming, the official software is adequate. Don't forget to uninstall one before installing the other.
Configuration is quite fiddly. Run Prismatik, configure it as best you can, then quit. You should know from your time spent programming your Arduino in the IDE which COM port it's on, and keep the default serial port speed of 115200. You really should not have any problems with keeping that speed, but you do have the option to alter the Arduino sketch to change the bit rate down to e.g. 57600. Just keep in mind that the slower you make it, the lower your maximum frame rate will be. My color order was RGB; an easy way to figure out if you've got it right is to use a monitor test program like LCDTest.
If your LED layout matches one of the zone wizard layouts, you're done. Otherwise, you will need an older version of Prismatik which supports the plugin. The plugin I found that helps only works with Prismatik 5.9.6. So uninstall Prismatik, install the old version, install the plugin, run the program again, enable the plugin, and refresh plugins. Now you can actually use the plugin; configure it and create a new profile, which will use the plugin to arrange the zones. If the config didn't come out the way you like, delete the new profile, reconfigure the plugin, and create another profile. Fun! Now you can uninstall, and reinstall the better version.
There have been many Ambilight clones for Windows, and you can just go forth and buy Lightpack (or some other solution) if you would like to cut the work out. But once you know what you're doing, getting an Ambilight clone working is actually quite easy, and the hardest part is wading through outdated weblinks and information.
|The modified Adalight Arduino sketch||3.04 KB|