Working at night on the computer can be harsh on the eyes. When I worked late, the contrast between the monitor and the dark room strained my eyes. As a solution, I created this responsive monitor backlight: it aims to reduce contrast by illuminating the area behind the monitor, and responds to what is displayed on the screen. If the screen is dim, the backlight is dim, if the screen is primarily red, so is the backlight.
This project is easy to make if you have basic knowledge of arduino and simple circuits. Some basic knowledge of python programming would help, but is not necessary. This is a good way to learn about controlling leds with arduino programming.
Lets get started!
Step 1: Materials and Tools
Before we get started, make sure you have all the necessary materials:
1. An Arduino (any type will work)
2. A breadboard (will allow us to create a circuit without soldering)
3. An RGB LED strip. I got mine off Amazon, here is a link to a similar product: (link).
4. TIP122 Transistors (3 of them). These will allow us to control the led strip. I got a set off Amazon for cheap (link).
5. Some wires to connect the circuit together.
You'll also need some way to mount the LEDs to your monitor. You can use 3M Adhesive, or you can attach the strip to a board like I did.
On the software side, you will need:
1. The Arduino programming software (https://www.arduino.cc/en/Main/Software)
2. Python (https://www.python.org/downloads/)
3. The PILLOW library for Python. Instructions for installation here.
The project is setup like this: there will be a Python program running on the computer that finds the average color of the screen. This color will be sent to the Arduino, which will set the red, green, and blue components of the LED strip accordingly.
Step 2: Construct the Circuit
Above you can see the schematic for the circuit. For each color (red, green and blue), we need a transistor. The base pin is connected an output pin on the Arduino, the collector pin is connected to the LED strip, and the emitter pin is connected to ground. With this setup, if the Arduino outputs a small current to the base of the transistor, the transistor will let a large current flow through to the LED strip. You can imagine the Arduino controlling a valve on a pipe: with a small turn of the valve, a large amount of water is let through. In this way, we can use the transistor to amplify the signal of the Arduino, which would not be enough to power the LEDs alone.
Make sure you connect the ground (0v) of the power supply to the ground of the Arduino, I forgot this and the LED's were flickering unpredictably.
Step 3: Program the Arduino
Below I’ve attached the program file for the Arduino. It’s ready to load on the Arduino, just open up the file in the Arduino programming software and press upload.
This program listens for a brightness value for each color from the computer. When it receives the value, it sets the brightness by “writing” the brightness value to the correct pin.
One thing to note is the array named ledPin at the beginning of the program: this defines the Red, Green, and Blue pins on the Arduino. If the LEDs are showing the wrong colors, make sure they are connected to the correct pins.
Step 4: Create the Python Program
The final piece of the project is the Python program. I’ve attached it in file form below.
To run the program, open it in IDLE and press run. If you see errors, make sure you installed the PILLOW library for image processing (see the materials section for installation instructions).
What this program does is calculate the average color of the screen, then send that color to the Arduino over a Serial port. The program then ‘sleeps’ for an amount of time before repeating. Make sure the Arduino is plugged into the computer via USB so it can communicate properly.
You can adjust the time inside of the “time.sleep( )” function to change the update speed of the backlight. I noticed some issues when the sleep time was less than 0.2 seconds, namely lag on the computer and decreased performance. If you increase the sleep time too much, there is a noticeable delay in the backlight changing colors. Mess around with the value to see what works for you.
Step 5: Conclusion
Ok that's it! Just mount the led strip to the back of your monitor, connect the circuit to the power supply, and run the python program, and you should have a nice responsive backlight!
You can make many improvements to this project, such as soldering the circuit instead of using a breadboard,