Open Source Ambilight LEDs on a Raspberry Pi for $100

I made this for about $100 with a Raspberry Pi and no soldering:

Fluid Sim Hue Test on YouTube

I’ve always thought that Philips Ambilight TVs were cool. They do what you see in that video: shine the edge colors past the TV. But it was always a “nice to have,” so when I was buying my TV I prioritized other features. Later, Philips launched the Hue Play HDMI Sync Box, which would let you create an Ambilight effect with Hue light strips. Again, cool, but not $300-and-tied-to-a-proprietary-system cool.

BTW, the generic name for “Ambilight” is “bias lighting,” so I’m going to start writing that instead. Aside from looking cool, I’ve had some eye strain issues with my TV and heard that bias lighting could help with that. After using it for about a week I can say that yes, it does!

I’ve also known that LED light strips are really cool to work with, but it’s been years since I soldered anything so it was all pretty intimidating. Also intimidating: flashing microcontrollers like the ESP32. I’ve always felt more comfortable with a Raspberry Pi because it’s a Unix system; I know this. When I found out that I could build a bias lighting system for about $100 with a Raspberry Pi and no soldering, I jumped on it. It started with this video guide from DrZzs:

The magic behind it is Hyperion, an open source system for doing bias lighting based on an HDMI input source. I had no idea something like that existed, and now it’s glued to the back of my TV. As a bonus, there are a bunch of fun effects so you can use it as an ambient RGB light when your TV is off. I can also control it with Home Assistant!

Here’s what I wound up buying:

LEDs

DrZzs recommends these 150 LED/5m strips but I bought these 300 LED/5m version. In retrospect, the 150 LEDs would probably have been better because they are lower power and we don’t need very high resolution for this. I have a 55″ TV and used 212 LEDs from the strip.

Power Supply

Someone on reddit suggested a 20W power supply to go along with the higher power usage for a 300 LED/5m strip. I prefer the 10W power supply that DrZzs linked to for two reasons:

  1. The 20W supply requires you to wire your own power cord in
  2. The 10W supply comes with a barrel connector that makes plugging everything in easy

Remember, I’m threading the needle between “excited for bias lighting” and “too complicated to bother with,” so convenience matters.

I was worried that the 10W supply wouldn’t be enough for the 300 LED strip, and technically it isn’t. The conservative estimate for amperage is 0.06A/LED, so 300 LEDs could need as much as 18A. Also I followed DrZzs tip around 15:30 to power the Raspberry Pi from the same power supply, which recommends 2.5A. However, the more realistic calculation for LEDs is 0.02A/LED and 350mA for the Pi, so my final power estimate is about 4.5A. Plenty of power from a 10A supply.

HDMI Capture

The HDMI Capture Loop that DrZzs linked to in his description is sold out on Amazon so I went with a solution I found in the reddit comments. DrZzs’s recommendation is a capture loop – it sits inline with the HDMI between the source and TV, and sends a capture to the Pi via USB.

I got this 4K HDMI splitter and this 1080p USB capture card. It means more HDMI cables behind my TV, but also helps with my cable management because my TV’s inputs are separate from the TV. So the HDMI splitter sits in my media console while the Pi is on the back of the TV.

Misc

These little wires are actually a huge part of what makes this project accessible to me. When I’ve seen LED projects before, you’ve had to solder wires to a ESP32 and then to the tiny contact strips. What I like about this project is that I grab a female-to-female wire, plug it in to a GPIO pin on the Pi, and plug it on to the male connector of the LED strip. Done. Connected.

These corner connectors are great for making the LED strips sit flat. When I was roughing the LEDs in, I just made loops at the corners to get a bend, but these make it look much better. It took me a few tries to figure out that the corners and strips go under the pins, but I got there eventually. Also the pins weren’t perfectly aligned with the copper bits on the LED strip, at least until I nudged them into place.

Gotchas

I did run in to some problems, or at least went off script from the tutorial video. First, instead of using Raspbian and manually installing Hyperion like in the video, I used a Pi image put out by Hyperion called Hyperbian. Download the image, flash it to an SD card, set up the WLAN and it’s good to go.

Second, the LED strips on the Pi just did not work right when I connected the data pin to GPIO 18. I think DrZzs glosses over the importance of having the Pi and the LED light strip share a common ground. The lights were fuzzy and not powering all the way until I grounded the LEDs to the Pi. Just like I have a wire going from the GPIO 18 pin on the Pi to the data pin on the LEDs, I added another wire going from the ground pin on the LED strip to a ground pin on the Pi. Suddenly everything lit up perfectly.

The last gotcha was that there was quite a bit of lag between the TV screen and the LEDs. If you don’t notice latency, don’t go looking for it. You will be cursed with the knowledge that it’s there. I’m not going to mention it to my family so they don’t notice it. I did make good progress on reducing the latency though, and I’ll outline how in a future post.

This was a fun project and I’m much more comfortable with LED strips now. I’m looking for other places in my house to install them. It’s also been fun to see which scenes have been really enhanced by the lights. I’ll end with one of my favorite examples so far, from Mary Poppins:

iOS Widgets for Home Assistant with Workflow

One of the key principles of home automation is being able to control things quickly and easily. I don’t want to have to unlock my phone, open an app, wait for it to load, and then finally find the device I want to control.

I like that SmartThings supports the Today screen widgets in iOS. They let me swipe dow on my locked phone and trigger a routine. For example, I have a button set up to run “Good Night” when I get to bed, which turns off lights, locks the door, and sets the thermostat.

I wanted the same in Home Assistant. It turns out that Workflow is perfect for this.

If you have the Workflow app installed, here’s an example workflow you can customize.

To make this, I created a new “Today Widget” workflow in the app. Basically we are going to create a call to the Home Assistant RESTful API, so to start you need to add a URL action. This should be in the form of https://your-home-assistant-site/api/services/domain/service. For example, if we want to toggle the bedroom lights of the Home Assistant demo site we would put in the URL https://home-assistant.io/demo/api/services/light/toggle

Next, add the “Get Contents of URL” action. Set the Method to POST, under headers add “x-ha-access” as the key and your Home Assistant password as the value. Set the Request Body to JSON and add any service parameters in the Request body. In our example we send a text value for “entity_id” as “group.bedroom”.

At this point you should be all ready to try it out! Here’s what it looks like:

Screenshot of the finished workflow

(note that is not my real passphrase)

Workflow is a great way to build easy-access buttons to run things in Home Assistant. Along with the Home Assistant native app, I think Workflow is a must-have for any iOS user.

Speaking at Self.conference 2017

I will be speaking about home automation with Home Assistant at Self.conference in May! One of my goals this year is to do more public speaking, so I’m thrilled to get to be part of this event. There is a pretty amazing lineup of speakers so you should probably go ahead and register already.

Here’s the write-up of my talk:

A Smart Home To Call Your Own

The stuff in your home is getting smarter every day. It’s time to take control of it with Home Assistant, a Python open source app.

This talk will provide an overview of how Home Assistant can be set up and configured to make your home smarter. You’ll be able to control your smart home devices so that your home starts working for you. With presence detection, logging, and mobile access, you’ll be the master of your domicile.

Once we see what Home Assistant can do we will explore how to write a custom components to start automating our own devices. Welcome to the world of tomorrow!