Overview
PLEASE NOTE: we’re retiring this guide but keeping the information up for anyone who might learn from the ideas and code. It relies on an old version of Processing (at some point may stop working on new hardware), recent operating systems are more restrictive about screen capture, and the LEDs used are much less common now than NeoPixels. It can still run with some extra work, but there’s better alternatives now, Google for “DIY Ambilight clone” for others’ projects!
The system is built upon some of the most popular cross-platform, open-source tools, so it works equally well on Windows, Mac or Linux computers. Technical users can climb in and make their own changes — larger displays, multiple monitor support, or adding new features.
Every monitor is a little different, so this project requires a bit of “maker ingenuity” to complete. Please read through the complete tutorial ahead of time for ideas on parts and tools you may need.
Page last edited March 08, 2024
Text editor powered by tinymce.
Meet the Pieces
The 25 pixel strand included in the Project Pack is is suitable for monitors up to 27 inches (70 cm) diagonal.
As explained in the introduction, please read through the complete tutorial for an idea of what other parts and tools you may need: USB cable, wire, tape, etc.
Page last edited March 08, 2024
Text editor powered by tinymce.
Wiring
Only three wires will be used. The red wire does not connect to the Arduino.
The red wire does not connect to the Arduino. You can trim this wire from the mating connector or insulate it with tape or heat-shrink tube.
Even though we don't suggest it, you can use an Arduino Mega, connect Green to 52 (SPI Clock) and Yellow to 51 (SPI MOSI), red and blue are the same as above. With the Leonardo, unfortunately the SPI pins are on the 6 pin programming header in the center of the board, so its really not suggested.
The extra red and blue wires are for connecting power, but we’ll do this at the other end of the strand.
Page last edited March 08, 2024
Text editor powered by tinymce.
Download & Install
Three packages need to be downloaded:
Download Arduino IDE
First, download the Arduino IDE (integrated development environment) from the Arduino web site. Select the version of the software for your computer type: Windows, Mac or Linux. Read the Getting Started page for an explanation of how to install the software on your computer. It’s a little different for each of the three operating systems.Download Processing IDE
Next, download the Processing IDE from the Processing web site. The first section of the Getting Started page explains how to install the software.Download Adalight ZIP
Finally, visit the Adalight page on Github and download the ZIP file. The download button is near the upper left of the page:
If you’ve run the Arduino and/or Processing IDEs before, there will be corresponding “Arduino” and “Processing” folders inside your personal “Documents” folder (or “My Documents” in Windows). In that case, move the contents of the Arduino and Processing folders from the Adalight ZIP file into the corresponding document folders.
If the Arduino and Processing folders don’t yet exist on your system, you can just copy these from the Adalight ZIP file to your Documents folder.
The other files and folders in the ZIP file can be ignored. These are for advanced users and aren’t essential to its use.
DO NOT use the “LEDstream_LPD8806” sketch/folder unless you are specifically using LPD8806 LED strips in a custom build. Use just the plain “LEDstream” folder when building the Adalight Project Pack, or for a DIY setup using similar WS2801 LEDs.
Program the Arduino
The Arduino IDE must be installed before this step.Connect the Arduino board to your computer with a USB A-to-B cable. When connected for the first time, Windows users will prompted to install a driver. This is explained in the Arduino Getting Started guide for Windows. No driver is required for Mac or Linux.
Launch the Arduino IDE. After a moment, you should see a simple blue and white window with some buttons.
From the File menu, select Sketchbook, which should “roll over” to show LEDstream. Select this.
From the Tools menu, select Board, then Arduino Uno (or whatever Arduino board type you’re using).
From the Tools menu again, select Serial Port, and then the port corresponding to your Arduino board.
Click the Upload button near the top-left of the window:
Because the Arduino stores the program in non-volatile memory, you should only need to do this upload process once, not every time you want to use Adalight.
Page last edited March 08, 2024
Text editor powered by tinymce.
Running the Software
From the File menu, select Sketchbook, which should “roll over” to show Adalight and Colorswirl. Select the latter first: Colorswirl.
Click the Run button near the top-left of the window:
If this is not what happens, then you’ll need to edit some code. Around line 26, look for this statement:
myPort = new Serial(this, Serial.list()[0], 115200);
We need to change how the code opens the serial connection to the Arduino. One route is just through trial and error: try Serial.list()[1], then Serial.list()[2], and so forth, re-starting the program each time to see if it works. For a more scientific approach, add one new line of code before running the sketch:
println(Serial.list());
When run, this displays a list of all serial ports or devices. If you know which device or COM port corresponds to the Arduino, you can then change the original line to include this data. For example, it might now read:
myPort = new Serial(this, "COM6", 115200);
This will be different on every system, so we can’t just tell you what to put there.
Another way to locate the port name: in the Arduino IDE, this is the port you selected in the Tools→Serial Port menu before programming the chip.
Once you have Colorswirl working, make note of the change (if any), because the same change will need to be made in the Adalight code.
From the File menu, select Sketchbook, then Adalight. If you changed the Colorswirl sketch to find the serial port, make that same change to the Adalight code. Now click the Run button.
Though they’re in a jumbled mess on your desk right now, the LEDs should light up in colors resembling the perimeter of your screen. Move some windows around the edge — you should see the LEDs react to this.
As it runs, the software performs a continual series of screen captures, averaging the pixels in blocks around the perimeter of the screen and issuing the resulting color data to the LEDs. You can hide the preview window and let the sketch continue working in the background. Being capture-based, it’s not tied to any one specific media player, and most anything you can put on your display — MPEG movies, YouTube, games and so forth — can benefit from the effect. It seems to work especially well with the outer space sequences in Cosmos…a bit ironic in that Carl Sagan’s “Spaceship of the Imagination” from this series featured a giant flat screen and mood lighting decades before Philips turned it into a commercial product!
If you plan to arrange the LEDs similarly to our examples — 25 pixels in a ring, 1 pixel gap at the bottom, with the first pixel starting just left of the gap — then nothing more needs to be changed in the software. If using a different layout, you’ll need to make adjustments in the code. You'll find extensive notes in the source code for making this (and other) changes.
Once all the hardware and software is working, it’s time to get crafty and mount the LEDs on the telly…
Page last edited March 08, 2024
Text editor powered by tinymce.
Mounting LEDs
Every TV and monitor is different, and exactly how and where to best mount the LEDs is more craft than engineering. This is where the “maker ingenuity” comes into play!
While some of our customers have fabricated amazing metal frames and laser-cut acrylic mounting plates, the tools and materials really don’t need to be that advanced. To prove this, our sample setup uses nothing more than cardboard and tape! You can keep it simple or take it as far as your personal skill set allows. It’s not rocket science!
Here we’ve fashioned an LED holder using illustration board from the nearby art supply store. Our template is sized to match the back of the monitor, and a notch has been cut out at the bottom center to accommodate the monitor stand:
Next, calculate the spacing for a ring of 25 LEDs. For this monitor, it worked out nicely as a 9x6 rectangle, roughly 2" spacing, with a one pixel gap at the bottom where the monitor stand protrudes. Perfect!
Notice how the LEDs are spaced along a grid: there’s an equal number along the right and left sides, and (except for the gap for the monitor stand) equal spacing along the top and bottom. As mentioned in a prior page, the software may need to be adjusted for the number of LEDs across and down, if your template is different than this.
The first LED was attached at the center bottom, just to the left of the monitor stand, and then the rest were positioned in order around the perimeter, ending just to the right of the stand.
Once the LEDs are situated, the Arduino can be placed (double-stick foam tape works nicely) and wired in. Connect a USB cable between the Arduino and computer, and a compatible 5 Volt supply to the LED power connector. The mass of wires and tape may look chaotic from this side, but once the monitor is set up close to a wall, nobody will see it.
Page last edited March 08, 2024
Text editor powered by tinymce.
Troubleshooting
- Double-check all wiring. Are the green and yellow wires swapped? Is ground connected to the Arduino?
- Confirm that the Arduino is connected to the input end of the strand.
- Check power supply polarity and voltage. Are + and – swapped? If you have a multimeter, confirm 5V DC output (±10%) from the power supply.
- Are the power wires at the opposite end of the strand insulated or trimmed? They should not be left exposed where they might make contact with metal, or each other.
- Is the correct board type selected in the Arduino Tools→Board menu?
- Double-check all wiring. Are the green and yellow wires swapped? Is ground connected to the Arduino?
- Confirm the Arduino is connected to the input end of the strand.
- Is the correct board type selected in the Arduino Tools→Board menu?
- Did the LEDstream code successfully compile and upload?
- Inside each pixel there’s a small circuit board. Give the first bad pixel (and the one immediately before it) a firm squeeze where the ribbon cable joins the board — it may simply be a dodgy connection. If that works, you can either cut out the offending pixel and join the two sub-strands, or arrange for a replacement strand if new.
Some programs will have a “software renderer” option that may help. Or try running in windowed mode (rather than full-screen).
Sounds like you may have uploaded the LEDstream_LPD8806 sketch to the Arduino board instead of the regular LEDstream. For the Adalight Project Pack, or custom builds using similar WS2801 LEDs, you want the latter sketch, LEDstream. The LEDstream_LPD8806 sketch is only for custom builds using a different type of LED strip.
Computers will make our lives easier!
Page last edited March 08, 2024
Text editor powered by tinymce.
Advanced Topics
The first thing needed is a more potent power supply. The 2 Amp supply included with the project pack is perfect for one strand of RGB pixels, but for two to six strands (50 to 150 LEDs) you’ll instead want to use our 5 Volt 10 Amp power supply:
The trick here is to minimize the length that power needs to travel along the LED strands. This ensures better brightness and more uniform color. As explained in the project pack tutorial, 5V can be applied at either end of a strand. We exploit this in the 50 LED setup above by connecting power near the middle…25 LEDs are powered in one direction, and 25 the other.
With more than 50 LEDs you’ll need to provide additional connections for power. This could be done at the start of every strand…but using the same trick as above, it’s also possible to alternate strands: for 100 pixels, connect power to the wires at the end of the first and third strands, and the others will receive power through the mating connectors.
To connect to the strand power wires, you can either solder and insulate these connections, or use Euro-style terminal blocks — these can be clipped apart to provide two + and two – junctions.
The Adalight Processing sketch will require modification. This is the tricky part that’s specific to your setup…it’s not a simple copy-and-paste change, because televisions have different bezel sizes, stands, speakers or other obstructions to take into account. Arts and crafts time!
We need to sketch out a grid that’s close to the shape of the screen, with the right number of squares around the perimeter to match our LED strands. It’s recommended that you try a few sizes and iterations on paper. You don’t have to put LEDs in the corner squares (some users don’t like the look and will skip them), and in the end you might end up with a few more LEDs than grid squares — that’s okay, you can bundle the extra unused LEDs behind the screen.
Number the columns starting from 0 at the left, and the rows starting from 0 at the top. We’ll need these coordinates later for telling the software the position of each LED pixel. One common arrangement with 50-pixel installations has 17 squares across and 10 squares down, because it’s close to the 16:9 aspect ratio of most HDTVs. Grid location (0,0) will then refer to the top left square, and (16,9) to the bottom right.
I like to put the first LED (the one closest to the Arduino) at the bottom center of the screen, because the USB and power cords can be bundled alongside other cables already coming from the display. But you can start at any position, whatever works best with your own telly.
Open the Adalight sketch in Processing and look for the following block of code starting around line 68:
Next, look for this block of code, starting around line 87:
If you try to run the modified program but it throws an error, you’ve probably mis-typed one of these number sets. Make sure there are three numbers in each set, separated with commas both between numbers and between sets.
Load the Adalight.pde sketch in Processing. Then, from the “File” menu, select “Export Application.” Select your OS type, do not check the full-screen option, then click the “Export” button. This will create an application folder containing the standalone program and some support files. You can quit Processing now and just use the standalone version.
We’ve experimented with a stealth windowless version of Adalight…can’t say for certain how reliable this technique will be across all different systems, but you can try out the technique described in this this forum discussion and see what you get.
Because we didn’t write these packages and aren’t familiar with their inner workings, we can’t provide technical support. If you’re having trouble getting an Adalight system up and running, we’ll always ask that you start with the Processing sketch first. Once that’s working, then feel free to explore.
We’ve found Lightpack to be easy to use with a nice GUI and good performance. Don’t download the firmware file, just the software — with Adalight mode selected, this works with our LEDstream sketch already on the Arduino. The Russian site for Lightpack is a little more bleeding-edge, and includes Mac and Linux versions.
Boblight is another popular choice among Linux users. This is perhaps the most complex to set up, even moreso than the Processing code. With the right plug-in it’s said to also work with xbmc, but we’ve never gotten this far with it.
Page last edited March 08, 2024
Text editor powered by tinymce.