Making an ‘Ambilight’ with WS2812B LEDs and Adalight: Proof of Concept

As I do more and more coding for the Footwell NeoPixels project, my mind started to wander with ideas of what else I could use addressable LEDs for. One such idea is to create an ‘ambilight’ – a backlight for a TV or LCD monitor that reads the color data onscreen and creates a glow around the bezel which matches or ‘extends’ the color to the surrounding wall. The idea is that it adds ambiance (hence the name), though it also helps with eye strain by reducing the contrast between the bright screen and the dark wall behind it. I had put a strip of single-color white LEDs behind my previous monitor and it helped tremendously with eye strain, but I figured if I was going to do the same I may as well take it up a notch.


This post is part of a series on creating a DIY ambilight using Adalight and WS2812B LEDs. Check out the project page here.

There are a couple of commercial products which do this, most notably Phillips’ line of Ambilight TVs.  Because addressable RGB LEDs are now so commonplace and easy to use I figured there had to be a simple way to get the same result with any display.  As it turns out I was right: in 2012 Adafruit developed a system which uses an Arduino as a middle-man to control a string of addressable LEDs.  Their platform, dubbed ‘Adalight’, can run on any PC using a multimedia coding platform known as Processing.  (There are also options for making an ambilight with a Raspberry Pi that is running as an HTPC, but only my PC is hooked up to this particular monitor).

The Adalight code is a bit dated however, and is designed to use WS2801 LEDs rather than the newer WS2812B.  Compared to the slick 5050 integrated ‘NeoPixels’ we’re now used to, WS2801’s use an external control circuit to handle the signal processing.  Newer WS2812B LEDs also use just three wires for control (power, data, and ground) while the WS2801’s require four wires (the three above + clock).  The lack of external signal circuitry and needing one fewer wire means that WS2812B strips can have more LEDs per meter and are slightly smaller.  They also require one fewer pin to control, although whether that makes them easier to use is debatable.

Before rewriting the code myself I did a cursory search and found that someone named James Bruce had already done the work for me!  He tweaked the Adalight code to use the wonderful FastLED library for controlling the WS2812B strip.  You can find his fork here.

Update 2017-04: I did eventually rewrite the code myself, fixing some bugs, improving the efficiency, and adding some additional features. You can download my version here.

The first step to getting the ambient lighting system up and running is to test that our LEDs work as intended.  I ordered a 5m roll of WS2812B LEDs from China, which have 60 LEDs per meter.  Five meters is far more than I need for this project, but a roll was so cheap I couldn’t resist.  After verifying that the LEDs worked with a FastLED example sketch, I uploaded the WS2812B Adalight sketch to the Arduino.  The next step was to get the PC software working.

For their implementation Adafruit used a Processing sketch, but by all accounts it was slow and clunky.  Instead, I found an open source software called Prismatik which supports the Adalight protocol.  As it turns out the Prismatik software is also quite buggy, but at least it’s fast and lightweight.  After installing Prismatik and throwing together a configuration for the Arduino (mostly noting the correct serial port and number of LEDs), I loaded up Overwatch and gave it a spin.

It works!  The “white” produced by the RGB LEDs is very blue, made worse by the blue wall behind the monitor.  Fortunately Prismatik has options for calibrating the color so I won’t need to do any scaling on the Arduino itself.  No use messing with calibration until the LEDs are installed in their final position, so that’s it for today’s testing.

Next up: Part 2 – Prepping the WS2812B Strip

9 thoughts on “Making an ‘Ambilight’ with WS2812B LEDs and Adalight: Proof of Concept”

  1. wow you are awesome ! i really appreciate and enjoy reading this project. This is by far the best tutorial for Arduino based ambient light on the internet, its well written and informative. Im going to build my own ambient light after finish reading your tutorial….. keep up the good work.

  2. Hey, I’m trying to replicate your results, but after I install Prismatik, upload your code to Arduino and set up the FastLED library, nothing happens. Not sure how to make Arduino collect color data, I gathered it should do it automatically, as in your code makes sure it actually takes the data Prismatik captures. Or am I mistaken, and i need to manually ‘link’ my Arduino with Prismatik (already specified the correct port during config wizard).

    1. You also need to double-click the icon so the lights turn on. If the icon turns into a red ‘No’ symbol then there’s a communication problem (wrong port or port blocked).

      Run at least one FastLED test sketch on the Arduino to make sure the lights work as intended (pin number, type, length, color order, etc.) before you start debugging the Prismatik side (COM port, baud rate, ‘Adalight’ protocol, etc.).

  3. Hi Dave,

    I have a question before I delve into this guide. I’m thinking about adding this to a 4K monitor? Will all of the parts you used be compatible with my 4K monitor at 60HZ?

    1. Hi Ryan. All of the hardware should be compatible, although a user on GitHub said that they’re having problems with Prismatik and their 4k monitor (another user said it worked fine, so take that with a grain of salt). It’s easy enough to test, though: install the software and give it a try with a “virtual” LED device.

  4. Greetings, first of all I must congratulate you for this great guide, what you have done is beautiful.

    I have followed step by step the indications of this tutorial, and in principle all good, but I would like to know if it is normal that after a few seconds of inactivity in the computer the LEDs turn off, and they are reactivated when I press a key or move the mouse.

    1. That’s a setting in Prismatik. Under the “Experimental” category, disable the setting to “Send data only if colors changed”. You can also disable the serial timeout entirely in the Arduino code, but you will need to turn the lights off manually every time.

      1. You are definitely the best.
        I appreciate the help, and I repeat, I have replicated what you have done and I am in love with the result.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.