Adaptive background lighting Ambilight


Adaptive background lighting Ambilight, without exaggeration, an amazing technology. With such adaptive illumination, eyes become less tired when viewed in the dark, the presence effect is enhanced, the image viewing area extends, etc. Ambilight is applicable not only to video and photo content, but also to games. The implementation of such a backlight on the Android TV set-top box or Android TV with the installed version of Android above 5.1 (Lollipop) is now possible thanks to the Android Ambilight Application program. Next, we’ll tell you how to build such a backlight with a small cost at home.

About Software

Android Ambilight Application is one of the few programs for Android that allows you to implement Ambilight backlighting without using a desktop PC, as in most other options. Android Ambilight Application has three main operating modes, such as:


!!! It is important to know !!!
The picture from the TV tuner is not processed at the Android OS level, the backlight with regular tv channels will not work. The backlight works only in Android OS applications that do not use protected content. 4K performance depends only on the capabilities of the equipment. Unfortunately, programs such as YouTube and Netflix use protected content, the backlight in such programs will not work.

SINGLE COLOR MODE – This mode allows you to include all the backlighting with one color selected in the program settings. This mode is well suited as a night room lighting, surprisingly changing the familiar interior.

COLOR EFFECT MODE – This is the mode for displaying color effects. Dynamic backlighting can change colors, depending on which of the preset effects you have selected in the settings.

SCREEN CAPTURE MODE – This is probably the most in-demand mode of the backlight, which allows you to change its colors depending on what content is currently displayed on the screen.

The program interface is presented on four screens, the first one you could already see above, with it we can control the main functions of the application and go to the settings screens.

The following picture shows the screen for setting the main parameters, such as the choice of the number of LEDs horizontally and vertically, the speed of the serial port connection, the direction of the LED ribbon installation, the order of color output, the depth of image capture and other parameters we’ll talk about in the Setup section.


This image shows the screen for setting the color gamut, adjusting the brightness, saturation and selecting color effects.


The output screen for auxiliary information – instructions for assembling hardware, instructions for setting up the hardware, instructions for configuring the program Android Ambilight Application.


Hardware Setup


For implementation, you will need four main components:

1. Controllable LED RGB strip,
2. Power supply,
3. Microcomputer Arduino,
4. Android Ambilight Application.

First a small amount of explanation.

WS2811 is a three-channel channel controller / driver (chip) for RGB LEDs with one-wire control (addressing to an arbitrary LED). The WS2812B is an RGB LED in the SMD 5050 case, in which the WS2811 controller is already integrated.

Suitable for the project LED strip for simplicity is called – WS2811 or WS2812B.

WS2812B strip is a LED strip on which the LEDs WS2812B are sequentially placed. The LED strip works with a voltage of 5 V. There are LED stripes with different density of LEDs. Usually it is: 144, 90, 74, 60, 30 for one meter. There are different degrees of protection. Most often it is: IP20-30 (protection from solid particles), IP65 (protection against dust and water jets), IP67 (dust protection and protection for partial or short-term immersion in water to a depth of 1 m). The substrate is black and white.

Here is an example of such a LED strip:


WS2811 strip is a LED strip on which the WS2811 controller and some kind of RGB LED are sequentially located. There are options designed for a voltage of 5 V and 12 V. Density and protection are similar to the previous version.

Here is an example of such a LED strip:


Which LED strip should I choose, WS2812B or WS2811?

An important factor is the power of the LED strip, which I’ll talk about a little later.

If you have a power supply that is suitable for power (often at home from old or damaged equipment, power supplies remain), then choose a LED strip based on the power supply voltage, i.e. 5V – WS2812B, 12V – WS2811. In this case, you will simply save money.

From myself I can give a recommendation. If the total number of LEDs in the system is not more than 120, then WS2812B. If more than 120, then WS2811 with a working voltage of 12 V. Why so, you will understand when it comes to connecting the LED strip to the power supply.

What level of LED strip protection should I choose?

For the most suitable IP65, as on one side it is covered with “silicone” (epoxy), and on the other there is a self-adhesive surface of 3M. This LED strip is conveniently mounted on a TV or monitor and can be conveniently wiped from dust.

What density of light-emitting diodes to choose?

For the project, LED stripes with a density of 30 to 60 LEDs per meter (of course, you can and 144, no one forbids). The higher the density, the greater the Ambilight resolution (the number of zones) and the greater the maximum total brightness. But it should be taken into account that the more LEDs in the project, the more complicated the power scheme will be, and a more powerful power supply will be needed. The maximum number of LEDs in the project is 300.

Which power supply to choose for a LED strip?

The power supply is selected for power and voltage. For WS2812B – voltage 5 V. For WS2811 – 5 or 12 V. The maximum power consumption of one WS2812B LED 0.3 watts. For WS2811 in most cases the same. Those. the power supply should not be less than N * 0.3 W, where N is the number of LEDs in the project.

For example, you have a TV 42 “and you stopped on a LED strip WS2812B with 30 LEDs per meter, you need 3 meters of LED strip (all 4 sides of the screen) .You need a power supply with a voltage of 5 V and a maximum power of 5 V / 6 A. If there are less diodes on the lower horizontal of the screen than on the top, it is only about 60 LEDs – power from 5 V / 4 A.

Example of a power supply for a LED strip:

power supply

Which microcontroller to choose?

Managing Ambilight is an Arduino microcomputer. Arduino Nano on Aliexpress costs about $ 2.5 apiece.

Example of microcontroller:


Project costs for a conventional 42 “TV:

12 $ – 3 meters WS2812B (30 LEDs per meter)
4 $ – power supply 5 V / 4 A
$ 2.5 – Arduino Nano
$ 3 – Android Ambilight Application program

Total:  ~ $ 21.5

Buy the whole set at once, you can from our partner:

Hardware implementation

The most important thing is to properly organize the feed of the LED strip. The LED strip is long, the voltage drops with a large current consumption, especially when using 5 V tape. Most of the problems that arise in those who make themselves Ambilight, are associated specifically with nutrition. I use the rule – you need to make a separate power supply for every 10 W of maximum power consumed at 5 V and 25 W of power consumption at 12 V. The length of the power supply (from the power supply to the LED strip itself) should be minimal (without reserve), especially at 5 AT.

The general connection scheme is as follows (Arduino is powered from USB, and the LED strip from the PSU):

connection scheme

To the LED strip from both ends power is supplied – two parallel connections. For example, if we made the backlight on all 4 sides, and the LED strip would have 60 LEDs per meter (that is, the maximum power 54W), then we would make such a power supply:

power connection

To Arduino from the LED strip there are two contacts. 1 – GND, which must be connected to the corresponding contact on Arduino. And 2 – DATA, which must be connected to the sixth digital contact on Arduino through a 470 Ohm resistor. If you do not have a resistor, in most cases everything will work fine without it, but it is better that it should be. The resistor can be bought for a couple of cents in any radio store. The Arduino microcomputer itself can be placed in any convenient housing, many use for this purpose a container from “Kinder Surprise”. Arduino should be placed as close as possible to the LED strip, so that the connection from DATA to Arduino has a minimum length.

Soldering the wires to the LED strip is easy. The main rule – the time of contact with the soldering iron should be minimal!

How to bend the tape at right angles?

There are two options. 1 – the LED strip should be cut and connected with short wires (placing it all in a shrink tube). 2 – You can buy special angled connectors for three contacts for LED stripes:

angled connectors

The software part

This is the simplest.

Download and install Arduino IDE. We load the last available version of the FastLED library, unpack it and put the FastLED folder from the archive into the folder with the Arduino IDE libraries (C:Program Files (x86)Arduinolibraries). Start Arduino IDE and close it. The folder Arduino will be created in the Documents folder. In it we create a folder AAA and copy there sketch – AAA.ino.

Connect the Arduino microcomputer to USB. The driver (serial interface CH340) will be installed automatically. If this does not happen, then in the folder Arduino IDE there is a folder Drivers with everything you need.

Run Arduino IDE and open the file AAA.ino.


We change (if necessary) the data transfer rate:


We change the number of LEDs. The number should be equal to the number of LEDs in your LED strip:


Tools> Board> Arduino nano
Tools> Port> Select the COM port (there will be the desired option)

Press the button “Upload”:


The program will inform you when the download is complete (this is literally a couple of seconds).

Done. It is necessary to disconnect Arduino from USB and reconnect. The LED strip will turn on in succession in red, green and blue – Arduino is activated and ready to go.

Now you can connect the Arduino to the TV-box and start setting up the program.

Software Setup

The program settings are represented by two screens of settings, this is the BASE SETTINGS screen and the COLOR CORRECTION SETTINGS screen. Below is a list of settings for each of the screens:

Base application settings

To go to the base settings screen, you must click on the corresponding button on the main screen of the program, as shown in the picture below:


Next, the base settings window opens:


On this screen there are three sections of settings: LED STRIP SETTINGS, DEVICE SETTINGS and SCREEN CAPTURE SETTINGS, consider these sections in detail:

LED STRIP SETTINGS – This section contains settings describing the configuration and placement of your LED strip on a TV or monitor. This section has several settings, let’s consider them in more detail:


LEDs Horizontal – This setting specifies the number of LEDs in our LED strip horizontally, in my case, for the 42″ screen, 28 LEDs:


LEDs Vertical – This setting sets the number of LEDs vertically, in my case, for the 42″ screen, 16 LEDs:


LEDs Bottom Gap – If your screen is on a stand, you may need a gap in which there are no LEDs in the bottom horizontal segment of the LED strip, this setting allows you to set this gap (measured in the number of LEDs).

When viewed from the back of the screen:


The same in the program settings:



LED Strip Direction – This setting determines the direction of your LED strip and must correspond to the marking applied to the LED strip itself, can take the values “CW” (Clockwise) and “CCW” (Counterclockwise).

First LED Offset – This setting is responsible for shifting the location of the first LED in the LED strip relative to the upper-left corner of the screen (viewed from the front). This setting shows where our LED strip starts, where we will connect our microcontroller(Arduino) and where the signal will go along the chain in the direction indicated in the “LED Strip Direction” setting.

For example, the pictures below show the adjustment of the four LEDs offset from the zero point(the upper-left corner of the screen) and the direction of the LED strip:


The offset for the four LEDs selected in the “First LED Offset”:


The direction of the LED strip “CW” – clockwise:



back to top

DEVICE SETTINGS – This section contains the basic settings of the program, settings for the connection speed with the microcontroller(Arduino), setting the order of the color output, the settings for autostart program at system startup, setting the program behavior when the screen is turned off:


Consider these settings in more detail:

Serial Baud Rate – This setting allows you to choose the speed of data transfer between your Android device and the Arduino microcontroller. It is important to understand that the same data transfer speed should be selected in the sketch settings(#define BAUD_RATE 115200) for Arduino AAA.ino, which we talked about in the description of the Hardware Setup:


Important note: If you purchased the backlight installation kit from our partners, the data transfer rate in the program settings should be 115200, this speed is flashed in their controller.


RGB Byte Order – The setting determines in what order to send color data to the microcontroller Arduino, RGB, RBG, GBR, GRB, etc. If you are using a sketch for Arduino from this description, then this parameter should not be changed, by default RGB:



Start On Boot – Setting allows you to enable/disable autorun program at system startup and start it in last active mode:



Screen Off Action – The setting allows you to select the behavior of the backlight when the display is turned off, for example, you can turn on the “SINGLE COLOR MODE” or “COLOR EFFECT MODE”. It is also possible to turn off all active modes or to be idle when the display is turned off. When the display is turned on again, the program will return to the last active mode of operation that was before the display was turned off:



back to top

SCREEN CAPTURE SETTINGS – In this section there are settings intended for controlling the operation mode of the “SCREEN CAPTURE MODE”:


Consider these settings in more detail:

Horizontal Depth – The setting specifies the depth of the image capture area horizontally. The depth of the capture zone is measured as a percentage of the screen size in height. The yellow dotted line in the picture shows the current depth of the capture zone:




Vertical Depth – The setting specifies the depth of the image capture area vertically. The depth of the capture zone is measured as a percentage of the screen size in width. The green dashed line in the picture shows the current depth of the capture zone:




Capture Quality – The setting specifies the quality level of the captured image. The higher the quality, the more accurate and detailed the backlight will match the image on the screen. High values of this setting can reduce performance on weak systems:



back to top

Color correction

To go to the color correction settings screen, click on the corresponding button on the main screen of the program, as shown in the picture below:


Next, the color correction settings window opens:


This screen shows the settings for controlling the color correction and selecting the color effects of the backlight: Single Color, Color Effect, Color Saturation, Color Brightness, Color Blur and RGB color gamma settings:

Single color – The setting is used to select the backlight color. The setting is for the “SINGLE COLOR MODE”:



Color effect – The setting allows you to select the desired color effect of the backlight. The setting is for the “COLOR EFFECT MODE”:



Color Saturation – Adjust the color saturation of the backlight. Adjusting allows you to increase/decrease the backlight saturation level:



Color Brightness – Adjust the brightness of the backlight colors. Adjusting allows you to increase/decrease the brightness level of the backlight color:



Color Blur – Adjust the blur of the backlight colors. Adjustment allows you to increase/decrease the blur level of the LEDs of the backlight:



Red/Green/Blue Color Gamma – Gamma correction settings for each of the three primary colors in the RGB palette:



back to top