Introduction: Cheap DIY Ambientlight Using Arduino
Picture of the product - my 40" 4K Desktop with DIY Ambilight
The Ambilight in this picture is completely DIY and uses some cheap RGB LEDs with integrated controllers and an Arduino. On the Software side, there is Ambibox running on the PC (Windows only) and the FastLED library on the Arduino!
The Ambilight is totally DIY and easily bright enough so that no other light is needed. The screen is mounted to the wall and flushes with the table. (So no Ambilight at the bottom.)
Ambilight uses the following:
- Ambibox Software on PC (free, but only Windows)
- Arduino with a simple script which uses the FastLed library (further down) (~3$)
- 50 RGB WS2811 LEDs (~13$)- optional power brick
Step 1: Some Precautions!
This setup is very cheap but only works on a PC. You cannot use this for your Blu-ray player or standalone TV. You need a software running in the background on your PC.
Linux or MAC is not supported. The Ambibox software I am using is only available on Windows.(For standalone applications there is an RPI variant, quite expensive)
The LEDs work quite good and without noticeable lag on the Desktop and while watching movies! Games are a different story. If the game runs in Fullscreen mode, the software will most of the time not be able to capture the image. But Borderless mode works! (keep in mind the added CPU power needed ~5%)
Step 2: The LEDs Needed for This Project
The most important part of this project are the RGB LEDs with individual controllers.
It doesn't really matter which RGB LED Controller you get, as long these are supported by the FastLed library. Here is a link to the supported LED Chips: https://github.com/FastLED/FastLED/wiki/Overview
The most common are the WS2811 or WS2812 LEDs since there are cheap and easy to use. These are also used in this project. They are sold in at least two different types: - as single bulbs (12mm) with a variable spacing of around 10cm at max. You mostly get pairs of 50, but you can add or extract LEDs as you wish. -as LED strips (with adhesive on the back). These you buy per meter with a fixed spacing. (30/60/or more LEDs per meter).
With single bulb LEDs, you get the advantage of completely free positioning and spacing. But on the other hand, you have to find a way to add them to your monitor.
How many do I need?
I would base this decision on the size of the monitor you are using. I was using 50 LEDs on a 27" with a 4 sided setup. Now I am using the same LEDs on a 40" with a 3 sided setup. My LED spacing is around 3cm, and I am quite happy with it! So if you know you need around 1 LED per 3 cm you can easily calculate how many LEDs you need for your whole setup.
LED strips
LED Strips have a big advantage over the single bulb version since you can easily stick them to the back of your monitor and be done with it. The problem with this is, that you can not variate the spacing or position of the LEDs. Also, the brightness of the single bulb version in some cases seems higher.
If you choose the strip you do not build a frame like I did in the next picture.
Step 3: The Frame (for Bulb LEDs)
Since I chose the bulb version of the LEDs, I had to build some kind of frame.
You can do this like me with aluminum sheets, a drill, and some cable ties. I cut 3 strips from the sheet, which were a little smaller than the dimensions of the monitor. Then I divided the whole length by 50 to get the spacing right and started drilling holes for the cable ties. Then I only had to zip the LEDs tight. Since my monitor is flush with the desk, I didn't need any LEDs at the bottom of the screen. If your screen has considerable space at the bottom I would consider going all the way around.
Another more easy way to add these LEDs to the monitor is by simply using some adhesive clips in the right size. But I can not say how long they will last. (with heat and all)
Step 4: The Arduino (nano)
To control the LEDs you need a central controller! For this, I am using a cheap Arduino clone from china. It doesn't need a whole lot of features, so I guess every Arduino will do. I am using a nano since they are very cheap and very small. On this, you just need the USB connector, a single digital pin, and the ground pin.
Step 5: The Power!
For the LEDs to work they need some form of power. Most LED chips are using 5V.
It is very important that you know the exact power specs needed for your LEDs. The WS28XX LEDs used in this project need 0,3W/piece. So at 5V the need a current of 60mA. If you have 50 LEDs that sums up to 3 Amps!!!
There are two ways to get this power: 1. You can buy an external power brick which is rated at the needed wattage. This you simply solder to your LEDs and plug it into the wall.
2. (I will NOT recommend this) You can get the power of your PSU on your computer. Most PSUs have a rating of around 20A on the 5V line, which is seldom used. So you can easily cut one of these Y-Adapters and solders them to your LEDs. The positive effect is, that the LEDs are automatically cut off with the PC Power and you don't need to buy another brick.
Step 6: The Connections
If you are using the WS2811/12 LEDs there are only 3 connections you have to make.
- You have to connect the 5V Power with the corresponding 5V line on the LEDs.
- You have to connect the ground of the PSU with the ground on the Arduino and the ground on the LEDs
- You have to connect the data line of the LEDs with one digital port of the Arduino. Which one doesn't really matter, but you have to remember the number. (I did not use the pictured Resistor!)
Step 7: The Arduino Sofware
After connecting everything. You need to setup your Arduino IDE and install the corresponding driver.
If you don't have any experience with using an Arduino you need to start here: https://www.arduino.cc/en/Guide/HomePage
After setting everything up you need to add the http://fastled.io/ Library. Here is the script I am using on the Arduino:
Some of the things you should change:
- NUM_LEDS, set this to your LED count
- DATA_PIN, set this to your used Arduino PIN
- SerialRate, defines the speed of the LEDs, (500000 is maxed)
In the "FastLED.addLeds" you should change the controller to the one you are using. Soe controllers need another CLOCK_PIN to be defined! Check the fastLED Documentation for your chipset.
Step 8: The Ambibox Software on Windows!
Get the newest Version of Ambibox from the developer homepage: http://www .ambibox .ru/en/index/php/Main_Page
While installing you asked to choose which components you wish to install. I choose none of them. If you need one, you can easily install them later.
After installing Ambibox you need to go into the install directory and change a line in the following File: C:\Program Files (x86)\AmbiBox\SerialPortConfig.ini You need to change the Baud rate of the Adalight to 50000, the same number you used in your Arduino script. Save the File and restart Ambibox.
[Adalight] BaudRate = 500000
Step 9: Main Settings Panel
So these are the main settings I use in my Setup:
First, you need to clock the "More Settings" button on the lower right!
The most important settings are at the bottom. The Device for this setup needs to be "Adalight". You can try to find the right COM port by going through them and looking at the device status or you just fire up the device manager and look it up. The standard order of colors is RGB. If you have problems with shifted colors you can change this here. At the last field, you can select the number of LEDs. This should match your NUM_LEDs in the script.
- Other Settings: -
- F7 is my Hotkey for turning the LEDs on and off
- I do not use different profiles, so it is just Default.
- With "Mode" you can choose what your LEDs should be doing. I recomment starting with static color to verify all of them are working correct and show the right colors. After that, you can set it to screen capture and choose "Windows 8" as a capture method. This works quite well on Windows 7 to 10.
- Set the delay to min. and the FPS to max, to minimize the delay.
Step 10: Areas of Capture
If you click the "Show areas of capture" button you will get a lot of boxes with numbers in them.
They will probably be all over the screen and not as ordered mine.
To get these areas of capture to their correct position you should use the "Wizard capture zones" Button! In this menu, you can set a lot of different parameters. Try around a little to get them right! Most of the times you need more than one try. But after that, you should get something that looks like mine (or all the way around if you are using 4 sides) After that, save settings and hide areas of capture!
Step 11: Color Correction
These are my settings for color correction, brightness, etc.
Just copy them or try your own. Simply watch a movie and try what the sliders do!
Step 12: That's It!
Congrats now you can watch movies and play games with class!

Runner Up in the
Arduino Contest 2016

Participated in the
Make it Glow Contest 2016

Participated in the
Epilog Contest 8
75 Comments
Question 11 months ago on Step 4
Hi, can i using attiny85?
2 years ago
Hi, I'm stuck on stage 9. The hardware is all up and running, but doesn't respond at all to the ambibox software. I know the LEDs are ok because I can run colour patterns etc directly on the arduino, but they won't even respond to the 'Static background' mode. The Ambibox software says 'Adalight: connected' at the bottom so I know the port is correct. Can anybody help or advise? Thank you.
Reply 2 years ago
No, wait, I just missed a zero off of my BaudRate. *facepalm*.
6 years ago
I had fun building this project, however, after about a week of use, the LEDs have started flickering randomly. It worked fine for a couple of days but the flickering has become more and more frequent. It flickers once about every 5-10 minutes! PLEASE ADVISE!! DOES ANYONE ELSE HAVE THIS PROBLEM?Thanks
Reply 2 years ago
Got the same issue.
Reply 2 years ago
Mine had the same issue - tried a different power supply and seems to be okay now. Maybe try a different power cable, it seems to be an issue where the LEDs aren't receiving enough power so the diodes reset to the default white.
Reply 2 years ago
Yes it was the power supply issue. I've fixed it.
2 years ago on Introduction
Working perfectly. Thanks.
Question 4 years ago on Step 7
Hi, I just copied your script into the IDE, but I get an error message..... Can you help?
#include <bitswap.h>
#include <chipsets.h>
#include <color.h>
#include <colorpalettes.h>
#include <colorutils.h>
#include <controller.h>
#include <cpp_compat.h>
#include <dmx.h>
#include <FastLED.h>
#include <fastled_config.h>
#include <fastled_delay.h>
#include <fastled_progmem.h>
#include <fastpin.h>
#include <fastspi.h>
#include <fastspi_bitbang.h>
#include <fastspi_dma.h>
#include <fastspi_nop.h>
#include <fastspi_ref.h>
#include <fastspi_types.h>
#include <hsv2rgb.h>
#include <led_sysdefs.h>
#include <lib8tion.h>
#include <noise.h>
#include <pixelset.h>
#include <pixeltypes.h>
#include <platforms.h>
#include <power_mgt.h>
void setup() {
// put your setup code here, to run once:
#include "FastLED.h"
#define NUM_LEDS 50
#define DATA_PIN 6
#define serialRate 500000
static const uint8_t prefix[] = {'A', 'd', 'a'};
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
Serial.begin(serialRate);
Serial.print("Ada\n");
}
void loop() {
for (int i = 0; i < sizeof(prefix); ++i) {
while (!Serial.available());
if (prefix[i] != Serial.read())
return;
}
while (Serial.available() < 3);
int highByte = Serial.read();
int lowByte = Serial.read();
int checksum = Serial.read();
if (checksum != (highByte ^ lowByte ^ 0x55)) {
return;
}
uint16_t ledCount = ((highByte & 0x00FF) << 8 | (lowByte & 0x00FF) ) + 1;
if (ledCount > NUM_LEDS) {
ledCount = NUM_LEDS;
}
for (int i = 0; i < ledCount; i++) {
while (Serial.available() < 3);
leds[i].r = Serial.read();
leds[i].g = Serial.read();
leds[i].b = Serial.read();
}
FastLED.show();
}
}
void loop() {
// put your main code here, to run repeatedly:
}
Question 4 years ago on Step 6
How did you connect ground to your power supply? All of the ones I've seen don't have a ground. just plastic that goes into the ground in the wall. I'm from ireland.
Tip 4 years ago
I have developed an iOS app to control remotely the AmbiBox. It's available on the App Store for free, check it out https://itunes.apple.com/es/app/ambibox-control/id...
Here is a video of how it works
More info in the video description
Thanks
5 years ago
i am going to build this. just ordered the parts from aliex... will post here when i'm finished. or maybe i will request help..
5 years ago
If you look into the led on the small pcb inside they have what wire is gnd data and 5V and a arrow for what direction the data flows. in most cases you want the female end to input data into power can go from both ends and I recomend doing that to compensate for the power lose accross the leds with the voltage drop that accures in the WS28xx sweries.
6 years ago
I just changed one line to make 2812B work
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
But i also have problems with Ambibox WINDOWS8 mode, no FPS showing
Reply 6 years ago
Try using Prismatik instead of Ambibox
6 years ago
Hello !
Could you help me for connecting the LED bulbs to my arduino ? I've searched a lot of informations for how to connect them but nothing works :/
Which connector of the LED I need to use ? See the 2 pictures below
The red wire is +, the white is -, the green is data. I've also connected the ground of the power brick of these LEDS on the ground of my arduino and the data pin is connected to pin 6.
The LEDS are using a WS2811S controller
When I connect the power of the LEDS, they are "white" a little bit before they are "black" so they are ok. But why they wouldn't light up with a program on the arduino ?
PS : Sorry for my english i'm french :D
Reply 6 years ago
then you cant use this CODE.
download the ADAFRUITNEOPIXEL. librairy. to test them.
this code here works ONLY with the software, NOT in my case but oke.
DL the librairy and open then an example sketch called stringtest or so. set your pin6 as data pin and the number of LEDS. and of you go.upload.
if need help go to my youtube and Google+ account ( WannaDuino )
then you wil find me, i can make a short video if needed how to use it.
WannaDuino!!!
Reply 6 years ago
I know that this code work only with the software. I tried them with the software, I tried also the programm FirstLight from the FastLed library but that didn't work for me. So I have a question : How I need to connect the Leds with my Arduino ? Which side of the strip I need to use ?
Reply 6 years ago
picture please, so i can see what you have.
lay both sides next to eachother with the connectors or wires on it. and take a picture. to your arduino, you only need the Grnd and the Digital pin to cionnect on the UNO. on pin 6 and Grnd on Grnd. then the 5V on the external powersupply with ALSO the Grnd split to it. so the GROUND IS COMMON.
6 years ago
Very nice work, thank you.
A couple of things to check if not working the first time.
Check if connection is good with a FastLED sketch test. (following instructions from adafruit website, everytime uploading a Sketch to Arduino:
Unplug LEDStrip power, Upload sketch, unplug Arduino, power LEDstrip, replug Arduino.
check also how your LEDstrip is setup with the FASTLED sketch "RBGCalibrate", this will help for that line:
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
it will tell if your strip use RBG or GBR or BGR etc. Replace the line with the right setup. I found out that mine is
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
Also I had to change the baud rate from 50000 to 115200 in arduino file and and Ambibox SerialPortConfig.ini (step 8).
On Ambibox Windows 8 doesn't work at all for me, but DirectDraw SRAM seems to be good, really smooth.