VLC ambient display prototype

TL;DR: See the bottom of the article for the video of the working prototype.

I’ve always been interested in electronics but never had the opportunity to learn it much until the last few months. As a software developer I discovered the world of electronic few years ago with the awesome Arduino ecosystem and I did quite a few small projects since, many of them involving leds and wireless communication.

I don’t have much time to work on personal projects but I must say that I love tinkering with electronics now and then. So last week I took some time off from my daily job to build something I wanted to do since a long time: creating an ambient display for VLC.

In-action picture of VLC ambient display prototype

I’m sure you’ve already saw something similar, it was first used in 2004 by Philips under the name Ambilight. It’s basically a way to diffuse light with colors around a TV based on what’s on-screen. Besides being really cool to see in action, it has some great advantages:


So last Thursday I started tinkering. My board of choice for most of my current projects involve the awesome Teensy made by Paul Stoffregen from pjrc.com, a powerful Arduino-compatible device built around an ARM microcontroller. Being a proud owner of some Teensy 3.x boards I found in this project a good opportunity to use another board from the same company, the Teensy LC (meaning low-cost) running at “only” 48Mhz. For the full specs, please have a look at the official website.

Picture of the Teensy LC

After few hours of night work I was able to put together a working demo using a 5 meters long WS2812B addressable led strip I had lying around from a previous project. The day after, with the amazing help of my girlfriend we built a frame that I can mount on the back of my laptop screen for demo and development purpose and portable enough so I can bring it with me. It’s made of two sheets of drawing paper painted in black to avoid unnecessary reflection, the LED strip and few clips.


The software side consists of two main parts. A microcontroller alone is not able to handle the amount of processing required for realtime video analysis, therefore the hard work must be done on the computer. As a VLC developer I naturally decided to interface this project with VLC as a module which is able to communicate with the Teensy.

Since VLC is a cross-platform project, the code must be as portable as possible if I expect to be able to merge the code eventually. But reliable communication between software and hardware is hard, making it portable is a real challenge and because this is a side project, there’s no way I’ll start developing drivers for it. Fortunately the USB stack offers the HID device class allowing the communication between software and USB hardware without requiring any driver! Yes, it should work out of the box on Linux, Windows and Mac.

HID is the acronym of “Human Interface Device” and was originally designed for human-interface devices like keyboards and mice but a lot of products, without any human interactions, are using it to save them from the hassle of developing a dedicated driver for it. Luckily the Teensy supports it natively and can act as a keyboard, mouse or RAW device, this is exactly what we need!

In its default configuration a Teensy can exchanges 64 byte packets with the host at a maximum frequency of 1000Hz, which is more than enough for small to medium ambient light displays. My custom protocol requires a header to notify the micro-controller of the beginning or continuation of a frame, a sync message for pushing the frame on the LED strip and the actual payload: 3 byte per pixel (R+G+B values). There’s also a small handshake at the beginning between VLC and the hardware to define the number of leds on each axis as well as how many pixels to use, from the edge of the video to the center, in order to average the RGB values.

The VLC module is in charge of splitting the top, right, bottom and left edges of the screen into chunks, one for each of the LEDs, and average the color of each of these regions. The concept is pretty simple but it requires quite some code because of chroma conversion.

What’s next?

DISCLAIMER: This is a very early stage project that I do on my spare time. Don’t expect anything working anytime soon. In the meantime this is what’s on my todo list.


Note: Sorry for the bad video quality, capturing bright light is difficult, but I can tell you it’s way better in real life!

Thanks for reading!

Do you find this project useful? Do you have suggestions? I’d love to know what you think, so please tell me in the comments!


comments powered by Disqus