Raspberry Pi Ambient Lighting for Samsung TV
Ambient lighting systems for TVs seem to be cropping up a lot in discussions I see online. Lots of people are opting for the cheap single colour strips you can buy for £20 to £30. Some are buying TVs with ambient lighting systems built in. Some are using things like Phillips Hue to create something a step up from that where you have a couple of bulbs that change colour according to the average colour of the whole screen. This project is a bit more dynamic and uses the HDMI signal to work out the colours of the screen very close to the edges. So, if you’re watching a documentary about penguins then the LEDs are going to glow white. If you’re watching something with grass at the bottom of the screen and sky at the top then then top LEDs will glow blue and the bottom green. It’s an amazing effect and extends your visual experience outside the screen. It also reduces eyestrain, just in case you need a reason to justify the expense.
I saw this online a while ago. It’s quite an involved project and you have to do a bit of soldering but I thought I’d give it a bash just before Christmas so we could have a nice “real fire” on the TV, enhanced by this reasonably inexpensive ambient lighting system.
I’ve added a couple of examples below. The first is the log fire I had playing on Christmas day. You can see the way that the colour flickers nicely to the left and right of the screen.
The second one is a clip from “Dynasties” on BBC iPlayer. This shows the effect much better but it was done before I’d tuned the colours properly. But it does let you see how subtle the variations can be depending on the colours on the screen – wait for the bit with the fire towards the end.
This won’t work if you’re using a smart TV to stream directly. You must be using an external source connected to your TV with an HDMI cable. It will work with a games console or something like that as well but you’ll have to swap leads.
As much as possible, the stuff I’ve used has come from Amazon UK and that’s where the links go to
- A soldering iron – I got this complete kit because I had nothing and this covers all the bases
- A couple of short HDMI cables – these are 25cm cables which should be fine if you position everything neatly
- A short male to male RCA cable
- APA102 LED strip – these are 60 LEDs per metre. You can save a few quid by using the 30 LEDs per metre if you want but most people seem to think that 60 is the optimum (they go up to 144 LEDs per metre but it’s probably overkill and they’ll draw a LOT of current!). You’ll cut this to match the size of your TV. The strips are marked at the points where you can cut.
- HDMI splitter
- Velcro to stick your components to the back of the TV
- Video grabber – If this one isn’t available, just make sure you you get one that uses the UTV007 chipset
- 5v 10a PSU – This will power your LEDs and your Raspberry Pi. It sounds chunky but the a couple of hundred LEDs on full white will draw most of that. You’re going to be playing with mains here. I know it’s only wiring up 3 wires a bit like a plug but it’s 240v. Please be careful! Undertake anything like this with caution and at your own risk
- HDMI to AV converter
- A Raspberry Pi – I used a 3B+. You’ll need a case, an SD card and some other bits as well
- Raspberry Pi 3B+ starter kit – This comes with a power supply but you won’t actually use it OR
- Raspberry Pi Zero W starter kit – This doesn’t come with a power supply but you won’t need it
- 1 x kettle lead – You’re going to cut the “kettle” end off and wire this to the earth, live and neutral of your 5v 10z power supply
- A couple of metres of 10a 2 core cable – get the stuff that is as flexible as possible
I already had a few of these bits like the Pi and the soldering kit. Excluding the soldering iron, if you buy all the parts from Amazon then you’re going to be looking at £100 to £130 ish. If you’re ok with soldering then it’s going to take you 4 to 6 hours to put it all together.
So, once you have your hands on that lot, it’s time to start building.
The first thing you’ll need to do is set up your Raspberry Pi. For that, you’ll need an operating system and your best bet is going to be to download it from the official Raspberry Pi site. It’s up to you whether you use the desktop or lite version. Personally, I’d go for the lite version unless you want to be able to use the Pi as an actual computer as well. The lite version takes up less space and is less CPU intensive, which is worth thinking about if you’re going to use the Pi Zero. However, setting the desktop version up is slightly easier as it’ll take you through a wizard sort of process when you first power it up. This will ask you to change the password and set up your WiFi if you’re going to use that rather than a wired connection. You can plug the Pi into your TV and plug in a keyboard and mouse to do the initial configuration.
While you’re logged in to your Pi, it would be a good idea to get the IP address. On the Pi, open a terminal window and type in ifconfig at the command prompt. Depending on whether you’ve used WiFi (wlan0) or wired (etho) you’re looking for a line that starts with “inet” and then 4 numbers separated by a “.”. For example, mine is 192.168.1.43. Make a note of this as you’ll need it later.
Once your Pi is all nicely configured, it’s time to get your soldering iron out and use all the kit you bought from Amazon.
To give you a rough idea, this diagram shows you the basic blocks.
Connections:
Important: Look at the LED strip and you’ll see some arrows. Make sure these either go in a clockwise or counter-clockwise direction round your screen.
For the most part, this will be obvious when you lay the components out. The tricky bit is the power and the signal from the Raspberry Pi as that involves some quite intricate soldering. I’d set the iron at 400 degrees and work as quickly as possible. The pads on the LED strips are quite small and fragile. Get a small blob of solder, nicely flowed first and tin the ends of your wires before you start. Then it should just be a case of putting them together, applying enough heat to melt both the solder on the pad and the solder on the wire rather than trying to hold it all together, apply heat, get the solder to flow and connect them all in one go.
If you get the same PSU as I’m recommending, you’ll have 2 x 5v terminals and 2 x GND terminals. Use one for the Raspberry Pi and 1 for your LEDs. You’ll just need to double up the LED connections.
So, you’re going to connect 1 x 5v and 1 x GND to the 5v and GND of LED strip 1. Then you’re going to solder small pieces of wire from 5v on LED strip 1 to 5v on LED strip 2. Repeat this for GND so that one feed is powering 2 strips.
Then connect 1 x 5v and 1 x GND to the 5v and GND on strip 4 and solder small pieces of wire from 5v on LED strip 4 to LED strip 3 so that, again, you have one feed powering 2 strips. This is just so that you’re not trying to feed 5v down a 4 metre strip of LEDs which could affect the brightness of those furthest away.
You now need to connect pin 19 on the Pi to the DI line on LED strip 1 and pin 23 on the Pi to the CI line on the LED strip.
Lastly, solder small pieces of wire to connect the DI lines all the way round, then the CI lines. This is your data and clock to address the LEDs for setting the colour and brightness.
Below are some pics I took of a few different stages while I was putting mine together.
- In the first, you can see the back of the TV with the LEDs in place. The adhesive on the LED strips is a bit rubbish and kept peeling off so I bought some strong double sided tape which seems to have done the trick. Looking at this, LED Zero is in the bottom left of the picture. It’s the bottom of the left-hand vertical strip. The last LED is the left hand LED on the bottom horizontal strip.
- The second image shows the back of the TV with all the components in place and the LEDs powered up. This also shows the small pieces of wire I used to make the connections from the first LED strip to the second. This has 4 connections as the 5v and GND feed powers strips 1 and 2.
- The third shows the components in place: HDMI splitter, HDMI to AV converter, video grabber and Raspberry Pi. These are all held in place using the Velcro.
Back of TV
Now we need to do a bit more back on software side of things.
This whole system is based on a system called Hyperion. This has a nice tool for configuring your Pi. What you’ll need is another computer to do this. Depending on what you have access to (Windows, Mac or Linux), will depend on which version you install.
The best bet would be to follow the instructions here:
https://hyperion-project.org/wiki/HyperCon-Information
Note. There are 2 steps to this:
- Install Java according to the machine you’re going to use to set things up
- Download Hypercon – this is the configuration programme you’ll use. The page linked to above has the link to download Hypercon after it tells you how to use it so read it carefully!
If you installed Java and run the Hypercon file then you should see something like this.
This is the first screen you’ll see. On the left is the Hardware tab. If you start by mirroring my config then it’ll probably give you a good start. Below are some screenshots from my installation, one for each of the tabs.
Note: The only 2 things you’ll need to change compared to this for the moment is the number of LEDs on the hardware tab as this will vary depending on the size of your TV. You will also need to change the details on the SSH tab to match your Raspberry Pi. Remember that IP address you made a note of at the start? Well, you’ll need that now, and change the password to the one you used when you set the Pi up in the early stages.
Hypercon Tabs
We’re nearly there. I promise!
Once you have everything mirrored like mine, go to your SSH tab. Make sure you can connect to your Pi – with your Target IP, username and password – by clicking on the connect button.
Now click on the button that says “Inst./Upd. Hyperion” and wait. Be patient as this can take several minutes. At this point, a window should open and after some time, you’ll hopefully see a message that says that the installation has finished.
Now click on the button that says “Create Hyperion Configuration” at the bottom of the left hand side. Leave it as the default name and save it anywhere you want to.
Click on the button that says “Send config” and then on the buttons for “Stop”, followed by “Start” to load your config onto your Pi. With a bit of luck, your LEDs should fire up and you’ll see some vague blobs of colour around the screen.
At the bottom of the SSH tab is a colour wheel. Click at about the 12.00 position to get it as red as you can and click on “Set LED color”. You should now see a nice red glow around your TV. Do the same for green and blue. If the colours are wrong, you need to change the RGB Byte Order on the hardware tab. In my case, red and blue were the wrong way round which is why it’s set to BGR instead of RGB.
And that should be it! Power up your TV and whatever you’re using to drive it whether it’s a set-top box, games console, Sky, or whatever. You might need to stop and start again but after that you should see the LEDs respond according to the image on screen. Flick through a few channels to find something with a lot of variation in colour. You might need to tweak your colours to get them perfect. The best thing is to wait until you get a nice image with lots of variation and then pause the TV. You can then mess with the gamma for each colour to fine tune them all.
Remember: Each time you make a change, you need to create the config file, send it and stop/start to get it working.