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 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!