Search This Blog

Sunday, February 23, 2014

XBMC, Windows, Boblight, and the Woodenshark USB Lightpack

For along time I've seen groovy videos of ambilight systems making people's TV's dance with colour.  You can see a video of the results of all that follows here:

(and maybe buy your own lightpack!).

The idea is that it's
  • Cool
  • Gives an illusion of your TV being bigger
  • Increases the apparent contrast of the actual screen
  • Reduces eye fatigue as a whole
Well, that's the theory but it's that first point that's the main thing!

Never seen it - there are plenty of youtube videos etc (search for ambilight which is the original Phillips branded system).

Most open source implementations of this futz around with arduinos or Raspberry Pis to control the lights,  and you can buy LED strinps and wire them up to pins etc.  Sounds like a lot of hassle to me, and a waste of machine - why bother with a Pi/arduino as a controller, it's just another device needing power etc, and it should be trivially easy to get a PC to control one of these things.

Then, Woodenshark did a successful Kickstarter project to bring an easy solution to this problem and the result is here: - a USB based LED light strip system.  So, I ordered one (about AU $100).  One lightpack works well for TVs up to 50" but you can get more than one and run them together.

Now, the general idea is to drive this thing with some software called Prismatik - latest releases here:

But - this software does not work so well, and especially with XBMC.  It's got a lot of bugs - you need to disable Aero to get even vaguely decent performance (which you should probably have turned off anyway - who needs aero on an XBMC box?) - but it also doesn't detect what aspect ratio XBMC is playing in etc.  Basically I tried this out and even after a fair amount of config. work it was still slow and not doing what I wanted.

Now, the standard way of controlling these lightpacks in xbmc environments is via the boblight addon.  This little python addon takes care of all the XBMC stuff - detects what you are playing (movie, tvshow, music video etc) - works out the aspect ratio, and then grabs the right colour numbers from the screen to send them out to the lightpack (via a program called boblightd) which in turn triggers the LEDs to light up all at 60 frames a second.

So the XBMC addon talks to a little controller program - boblightd, a daemon (server) that listens to a port, and accepts control signals to send on to the lightpack LEDs.  Like most of these things, it's developed under Linux/unix.  It's not so easy/obvious how to get it going with Windows, but it is possible.  So normally you would still have boblightd running on some sort of micro-controller I guess, but again I wanted to avoid the extra machine.

So - I knew lightpack support had been added to boblightd, but I could not find a working Windows version.  The main xbmc/windows/boblight thread (here) - has a note from uncleted that said:
I switched the Lightpack driver to WinUSB using Zadig and commented out the libusb_detach_kernel_driver call from lightpack device code. It works for me now without crashing. Not sure if WinUSB is really required so I'll have a bit more of a play to find out.

So this is what we're going to do to get it working.

Here's what uncleted worked out and I did in case anyone wants to repeat:
  1. Install cygwin including development, opengl, usb
  2. SVN the boblightd source from:

    svn checkout boblight-read-only
  3. Comment out the offending code block which makes it crash (it's not needed on Windows/Darwin): - lines 100 to 103 of devicelightpack.cpp:

            if ((error=libusb_detach_kernel_driver(devhandle, LIGHTPACK_INTERFACE)) != LIBUSB_SUCCESS) {
              LogError("%s: error detaching interface %i, error:%i %s", m_name.c_str(), LIGHTPACK_INTERFACE, error, UsbErrorName(error));
              return false;

  4. Configure it:

    ./configure --without-portaudio --without-opengl --without-x11
  5. And then make; make install
  6. Grab the resulting binary boblightd.exe from \cygwin\usr\local\bin
 But, I have done this for you.  You also need a conf file for your lightpack. I've included a basic one for a sinlge lightpack mounted to a TV using the Andromeda pattern.

All of this you can grab here. - has the boblightd.exe, the conf file, and a few required cygwin dlls.

Unzip all of these into a folder on your htpc called:


Now, one more necessary step - you must change the lightpack's USB driver to a more unix style friendly.  This will mean it no longer works with prismatik (presumably you can restore the older driver if you need this, but don't worry - if you're just using this thing with XBMC, change the driver and away you go).

To do this just download Zadig.  Run this (say yes when it wants to elevate to admin) - and tell it to show you all devices (in the menus) - then choose lightpack and tell it to replace the driver with the latest (included) WinUSB.  Done - not even a reboot (you should hear the device beeps as this happens, and you should now have a device in Device Manager -> Universal Serial Bus *Devices* -> Lightpack.

You'll want to run boblightd at startup before XBMC starts:

c:\boblightd\boblightd.exe -c c:\boblightd\boblight.conf -f

Finally, install and configure the xbmc boblight service addon - you don't need to change any ports/addresses since you're running it locally on the standard port. I set it all to 'fast' mode initially so it reacts quickly.


If you're having issues, run boblightd as above from the command line (without the -f) ... and see what it says.

I have created an issue for boblightd here and presumably they will fix this up:

So to sum up, to get it going (one lightpack) - you need to:
  1. Grab the pre-compiled files
  2. Unzip all to c:\boblightd
  3.  Replace the lightpack USB driver using Zadig to WinUSB
  4. Run boblightd at startup as above
  5. Plug your lightpack into a USB2 port
  6. Install and configure the XBMC boblight service addon
...that's it!