Ambient TV lighting system

By Lucy Hattersley. Posted

As well as reducing eye strain, the ambient TV lighting surrounding Jimmy White’s goggle-box is rather eye-catching. AmbientLightServer software captures the television image and projects matching lighting around the television.

This article first appeared in The MagPi 68 and was written by David Crookes.

Not much beats curling up on the sofa with a lovely cup of tea and a gripping box set, but there is a slight chance that you’ll become square-eyed by the time the credits roll. It’s a well-known fact that watching too much TV, especially in the dark, puts a strain on your peepers. Yet while backlighting a television set helps enormously by increasing the amount of ambient light around the screen, dedicated TVs which do this can prove rather expensive.

Realising that and already owning a decent smart TV, Jimmy White decided to make his own light setup using a Raspberry Pi 3, a USB camera, and some LED strips. He wanted to produce a bias lighting effect that took into account whatever he was watching or playing, adjusting the colour of the lighting to match the screen. “I was inspired by the standalone ambient light offerings I have seen on the market, but they all required the ‘source’ to be external to the TV, which did not meet my requirements,” he says.

Watching videos on an Ambient TV

Jimmy began the project by scouring YouTube for ideas. “I’d seen many videos where people were using Arduinos to drive LED strips, but they all depended on the external HDMI source,” he explains. “I eventually came across a piece of open-source software written especially for the Pi on GitHub and it was just the thing I was looking for.”

The software, AmbientLightServer by Waldo Bronchart, works by capturing colours from the edge of a television screen using a webcam. It then uses the data it gathers to update any attached LEDS with those colours. It works very well but Jimmy had to tweak it, editing the number of LEDs in the strips, adding the location of the starting light and creating an install script.

He also worked with a companion app called AmbientLightPyClient, which runs on a PC and allows the edges of the screen to be defined and the colour saturation and brightness to be set. The parts list, however, was more straightforward. Jimmy already had some Raspberry Pi 3s (“I wanted to make use of them as a low-cost solution,” he says), a 16GB memory card, and a Logitech C270 webcam, so he set about buying the LEDs and some 18-gauge electrical wire.

 The power and data wires are soldered to the Raspberry Pi 3 and the software was installed to a 16GB card

Wiring up the Ambient TV

“The most difficult part was trying to work out which direction the LEDs went in relation to the screen,” he recalls. “Having a strip running [in] the wrong direction, orientation, and position was rather confusing.” He used hook-and-loop fasteners to stick the LEDs to the back of the set in the most unobtrusive way and he tested they worked by creating his own four-colour ‘test card’. This was displayed on the screen and the camera was pointed so that it could capture the display’s full view.

“The camera detects the colours around the edge of the screen and adjusts the LEDs to match.” Jimmy reveals. Indeed, it captures frames at a low resolution and 30 frames per second, which makes the system quite responsive. The effect of this is a more pleasurable television experience, one which gives the appearance of extending the screen into the room. “It looks really cool,” Jimmy concludes, rather pleased with the result.

Step-01: Connect the LEDs

Jimmy bought a 3 metre roll of WS2801 LEDs which he cut into two strips and attached to the back of his TV. These connect to a Raspberry Pi 3.

Step1 Ambient TV

Step-02: Setting it up

The Pi 3 runs AmbientLightServer, driving the LEDs. A Python Qt client app called AmbientLightPyClient runs on a PC and connects to it. The sampling region and colour settings can be controlled.

Step2 Ambient TV

Step-03: Sit back and watch

A webcam pointed at the display captures the TV’s on-screen colours. It uses this data to tell the Raspberry Pi which colours the LEDs need to emit to create an ambient light.

Step3 Ambient TV

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.