Introduction: Cheap DIY Ambientlight Using Arduino

Picture of 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

Picture of 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)

Picture of 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)

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

Picture of 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

Picture of The Connections

If you are using the WS2811/12 LEDs there are only 3 connections you have to make.

  1. You have to connect the 5V Power with the corresponding 5V line on the LEDs.
  2. You have to connect the ground of the PSU with the ground on the Arduino and the ground on the LEDs
  3. 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

Picture of 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:

http://pastebin.com/53xsb97c

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!

Picture of 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

Picture of 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

Picture of 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

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

Picture of That's It!

Congrats now you can watch movies and play games with class!

Comments

Mousepotato01 (author)2017-11-07

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.

norand made it! (author)2017-08-31

Works great thanks!
Would reccomend supply decoupling (I used a 470uF but you should probably use a 1000uF) and a resistor between 100-470 ohm on the signal line do reduce noise. I also changed the baud rate to 115200 which worked a lot better. Good looking project!

denaxasp made it! (author)2017-08-18

Works beautifull, but i prefer prismatic (unofficial fork) for less CPU usage!

fenix395 made it! (author)2017-03-11

Good Instructable. Mine took a little tweaking to get it to work but once it did, there were no problems.

Some comments from the page here helped get it sorted."

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)"

mthobbies (author)2017-02-23

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

Jesper MartinS (author)2017-01-23

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

MattiaF1 (author)Jesper MartinS2017-02-14

Try using Prismatik instead of Ambibox

MattiaF1 made it! (author)2017-02-14

Thanks a lot, the result is awesome! I used WS2812B leds, here's my code for who's interested in using this type of leds. It works both with Ambibox and Prismatik, no need to change baud rate/serial rate.

http://pastebin.com/W85MTxTa

ToBtouz (author)2017-01-31

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

WannaDuino (author)ToBtouz2017-01-31

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

ToBtouz (author)WannaDuino2017-02-02

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 ?

WannaDuino (author)ToBtouz2017-02-06

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.

WannaDuino (author)2016-12-27

FREINDS??

i need the coding setup in arduino

FOR THE NEOPIXEL WS2812B

this code is only for the WS2811, i tryed the fastled page code info, to change the code manualy,

but its not working, ONLY white and a warm whte light. color is absolute not possible to change in what way.

please ANYBODY HELP.

WannaDuino!!!

WannaDuino made it! (author)WannaDuino2016-12-27

LOOK at my code NOW.

see pictures.

Seccond is al i get from any change i made,( white color ) boehoeboehoe, ( me crying )

The last picture is with a TEST CODE of Adafruit the Neopixel

WannaDuino!!!

klauson (author)WannaDuino2017-01-16

Did you change in File: C:\Program Files (x86)\AmbiBox\SerialPortConfig.ini You need to
change the Baud rate of the Adalight to 500000, the same number you used
in your Arduino script. Save the File and restart Ambibox.

[Adalight] BaudRate = 500000 ?

WannaDuino (author)klauson2017-01-24

yes friend i tryed that, see my new updte

tour93 (author)2017-01-20

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.

SibertD made it! (author)2016-12-04

:)

WannaDuino (author)SibertD2017-01-15

help please what to put in the code for the WS2812B????

VladI4 (author)SibertD2016-12-04

Duuuude, looks amazing great job :)))

SibertD (author)VladI42016-12-04

I only used 31 leds, because I only had digital ledstrip lying around, but I'm pretty happy with it :)

WannaDuino (author)2017-01-02

HELP????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

what are the issue, you need to tell clearly what you have done, whats working etc.

READ ALLLL my messages below friend, my collors stay WHITE

and i got WS2812B how to put that correctly in the code. see al my pictures below

thanx for reply, can`t say that the maker helps. what a thurd is that. bah

klauson (author)2017-01-13

Hi, i've made it like in the instructable with 3 sides (left->top->right) but my colours are twisted around 90 degree. what could be the problem?

Jesper MartinS (author)klauson2017-01-15

theres a setting for offset, try it.

Jesper MartinS (author)2017-01-10

hi i build this, it dosn´t work in WINDOWS 8 MODE it shows 0 FPS, the other modes work fine but are too slow

on my laptop it works but it isn¨t powerfull enough to run it smoothly,

Any hints?

MichalK51 made it! (author)2016-12-06

i tried several addressable setups, but finally i end with one channel ambilight (i dont must solved during movies different black borders...) and for our eyes its much pleasant :) and use only arduino, transistors and very cheap ordinary led strip 5050 :) today (after 2month) i cant imagine to run film without led (our 80cm looks like about 20cm bigger) and effects like lightnings...

thaipham101 (author)MichalK512016-12-16

where did you get the LED?

QazW2 (author)thaipham1012016-12-29

search for the code number or if you are adventurous you could do a search for controllable LEDs and price compare yourself. if something else becomes cheaper adjusting the settings should be only a small problem

MichalK51 (author)thaipham1012016-12-18

i use cheapest 5050 led strip (ebay 5m for 7usd... 60led/m, i have set brightness aprrox at 40%, in alu profile with matte cover... non adresable, 12v switch with arduino and mosfests... i use code from "amblone" only with deleted 3 lines.

Cramery (author)MichalK512016-12-18

What code did you used so it works? The one he uploaded is broke somewhere :/

TravisS92 (author)2016-12-19

could you hook this up to a TV?

QazW2 (author)TravisS922016-12-29

the TV would need some way to tell the light driver (the nano) what colors are around the edge of the screen. the software that this DIY uses runs on windows only. so even if the TV had such output it would be a whole different setup to connect to the LED lamps

RodrigoÚ6 (author)TravisS922016-12-19

Read step 1

WannaDuino made it! (author)2016-12-26

o jeay i dont even can choose an hot key F7 its not possible to choose

help, no led is working?

Using Windows 10

WannaDuino (author)WannaDuino2016-12-27

F7 key is fixt is working fine, my bad

WannaDuino!!!

WannaDuino (author)2016-12-26

got it running but only WHITE color???????????

and a bit orange white yeah cold and warm white?

WTF

WannaDuino made it! (author)2016-12-25

Dear friend

I use a UNO ( the seccond, you wil know soon why ), and 75 LEDS WS2812B and pin 6 is my wire.what and how do i write it in the code. because i not know what symbols or where exatly to put is and how,

( i alredy KILLED 74 LEDS and 1 arduino uno. haha.yep 12V input on a 5V project.) That's why my name is WannaDuino!!!

so i make it 2 times. i put it on youtube.

i seen in the code that you can place the amount of leds, but how and where, and with what symbol,

coding is new for me.

I know how to use it, and so but, yeah that's 1 thing i must learn still

can you make a picture please where to put it. in the code? PLEASE

Some pictures of the CARNAGE after KILLING my firts Arduino UNO and 2.5 meter of WS2812B leds. 74 pcs. and the new strip with a propper 5V power source.

WannaDuino!!!

WannaDuino (author)WannaDuino2016-12-26

Look my setting

look good to the WS 2812 i left out the B is that oke???

i only changed the leds to 75 and yeah pin6 and the name??

WannaDuino!!!

i now go test it.

hope i dont kill my seccond BATCH

Cramery (author)2016-12-18

I tried to do the same way as you did, but it didnt worked and I have no idea why. Can you pls. help me where I did something wrong?

LEDs with other program from arduino are working. NUM_LEDS is set correctly and the same in the Code as in the AmbiBox. Port is also correct and the same as in device-manager. serialRate are the same in Code as in SerialPortConfig.ini. Use Backlight is on. Data_pin and clock_pin are correct(in another program they are working with this two). Troubleshooting in AmbiBox software says nothings wrong. Is there something I forgot or is it just not working with no reason?

Cramery (author)Cramery2016-12-18

After a little bit more debugging I have now all the parts which are not working:

All returns, all whiles and LedCount is always 0, so the code in for (int i = 0; i <= ledCount; i++) will never run

Cramery (author)Cramery2016-12-18

So I just found out that something with your code cant be correct. When running the program, while another one was running, the LEDs stop doing something.

I deleted a few parts from the code until I had the setup and just the loop. It has to be something wrong with the following part from the used code:

for(int i = 0; i < sizeof(prefix); ++i){

while (!Serial.available());

if(prefix[i] != Serial1.read())

return;

}

But I really cant detect whats wrong... Just really sa, it would be a nice program but if the code is not working its just useless...

Cramery (author)2016-12-08

I bought those LEDs you linked. But I I cant connect them like you show, bc you show it with LED-Stripes. Also I dont have a black or a green wire and both sides have a connection, while 2 wires are free. So how can I connect them to the arduino and the psu?

Cramery (author)Cramery2016-12-08

Just saw that they were linked somewhere else sorry. I bought those https://www.amazon.de/gp/product/B00MXW054Y/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1 if it helps

VladI4 (author)Cramery2016-12-11

Glad you solve it:)

Cramery (author)VladI42016-12-11

Actually I didnt, just saw that it was another instruction with leds where I had the link from ?

ВиталийХ (author)2016-12-04

is it work with Prismatik from Lightpack?

VladI4 (author)ВиталийХ2016-12-04

Haven't tried it yet. I will see:)

FrandyG (author)VladI42016-12-08

im waiting for my tools to ship, and if this could work with prismatik, my tv is gonna turn out awesome as i am using remix mini for my media player

About This Instructable

68,322views

726favorites

License:

More by VladI4:Cheap DIY Ambientlight using Arduino
Add instructable to: