HOW TO: Raspberry Pi, Raspbmc, Hyperion and a LightPack

After playing with Boblight for a while it looks like all the cool kids are moving to Hyperion , it has a GUI config editor, low CPU and a few more configuration options.

Hyperion documentation is also very strong, but I thought I might spell it out incase people are struggling a bit.

The developers are highly active to respond and help wherever they are.

A lot of this post replicates my other blog  HOW TO: Raspberry Pi, Raspbmc, Boblight and a LightPack, so if you’ve read that, this should be pretty familiar

Here’s how to do it….

Shopping List:

  • 1 Raspberry Pi
  • 1 LightPack
  • and….. THATS IT!

1. Buy a LightPack
2. Install Raspbmc
3. Install and Configure Hyperion
4. Understanding the Config file
5. Placing the lights on your TV

1 – Buy a LightPack
There is an awesome guy named Sasha who is selling ready to go LightPacks via eBay.  He sells them in 30, 60 and 90 LED options.  Each LightPack has 10 strips, this means a 30 kit will have 3 LEDs x 10 strips, a 60 has 6 LEDs x 10 strips and the 90 has  9 LEDs x 10 strips.
The kit comes with everything you need including the controller, pre-installed LED strips, US power pack (mine even had an Australian power converter), a USB cable, cable management clips and open source software for PC installs.
His stock levels might fluctuate a bit, but Sasha is really responsive to any inquiries via email and I found him really helpful in making my decision.  The items come out of Israel and are sent with postal tracking.  He is looking for international distributors as well.
I got the 90 LED version which was going on my 55″ Samsung.
You can find his eBay store here

2 – Install Raspbmc

Download and install Raspbmc – this must be the July or later release
See http://www.raspbmc.com/download/ for instructions.

3 – Install and Configure Hyperion

Note: if you have boblight installed, you should disable it as the Boblight and Hyperion will fight with each other….

Ok so now we need to set up root access on the Pi this is needed (well, there are other ways but it makes it easier) so we can copy the config file to the \etc location on the Pi.  First we need to find out the Pi’s IP address

  • On the Pi go to Settings -> System Info
  • Note the IP address down

Next we need to SSH to the Pi and set root access

  • Follow this guide to establish SSH access for the first time
  • Follow this guide to set up root access

Now we can install Hyperion as root

  • SSH into your Pi as root
  • type:  apt-get update
  • type:  apt-get install libqtcore4 libqtgui4 libqt4-network libusb-1.0-0 libprotobuf7 ca-certificates
  • type: wget -N https://raw.github.com/tvdzwan/hyperion/master/bin/install_hyperion.sh
  • type sh ./install_hyperion.sh

Now you need a configuration file.  Ive done one up so this too should be pretty easy.  these instructions are based on using a windows PC for management.  You need a few things before you can copy the file to the Pi.

Now we can copy the config file

  • Connect to your pi using WinSCP, logging in as root and using the IP address you used above.
  • navigate to /etc
  • copy the boblight.conf file from above to this location

Reboot your Pi and you should be good to go!  The lights can take a brief moment to start but they should come on and be active for both the XBMC interface and any media you play.

If you are happy with a set and forget, you can stop reading here…..

Understanding the Config file

The Config file I have made up is designed for use with Speedy’s boblight daemon and the LightPack – you shouldn’t need to change much, and it should work as-is.

Here’s a great link to generic info on the config file but I thought I might help with some LightPack specifics.

[device] Section

[device]
name       LP1
channels   30
type       lightpack
interval   20000
#bus           1
#address       6
#debug       true

Speedy’s boblight daemon uses optimised string searching and it is important that three letters are used for most things

name       LP1
This can be any three letter name and is used to match the [Light] section to the device as boblight can be used with multiple devices
channels   30
LightPack has 10 strips, each of these, no matter how many LEDs change colour at the same time, so the number of channels calculates to the number of LED strips x 3 colours (red, green and blue), therefore, if for some reason you only wanted to use say 8 strips, this would equate to 24 channels
type       lightpack
This must remain as lightpack, so that the software knows what’s plugged in
interval   20000
This specifies the update interval in microseconds. 20000 equates to an update 50 times per second.
#bus           1
#address       6
#debug>       true
These lines are commented out (# at the front of a line makes it a comment) but the first two lines are used to define the USB bus and USB address of the device.  You can find these out starting up the boblight daemon from a command prompt, but this is only really needed if you want to run more than one device.
The debug line I haven’t yet worked out how to get the output of, but also haven’t really needed to either.

[color] Section

[color]
name       red
rgb        FF0000
gamma      1.6
adjust          1.0
blacklevel    0.0

There are three color sections each for red, green and blue – you need to modify each one individually.

name       red
This is the name of the color and must be three letters as well.
rgb        FF0000
This is the HEX color code for each color.  You can tweak these if you want to get really good color matching if you want (there are some other ways of tweaking below as well)
gamma      1.6
This is optional but I made this 1.6 it affects the luminescence of the color a bit.  If you don’t include this it gets set to 1.0 by default and the setting can more or less than this value.
adjust          1.0
This is also optional and I have got it in there as the default but can go down to 0.0.  It is a multiplier for the color.  I didn’t find this made much difference playing with it.
blacklevel    0.0
I don’t really know what this does, the documentation refers to it ranging from 0.0 to 1.0 but I didn’t find it did much playing with it and only in there to make it easy to fiddle for people.

[light] Section

[light]
name            L01
color           red     LP1 1
color           blu     LP1 2
color           grn     LP1 3
hscan      0 33
vscan      0 20

There will be 10 [light] sections, one for each of the LED strips for the LightPack

name       L01
This is the name of the strip and must be three letters.  I found it useful to name them sequentially so they were easy to identify which strip was which for tweaking their position.  See the Placing your lights on your TV for more info on this.

color           red     LP1 1

OK so now it starts to all come together, each strip has all three colors and these use the names you defined in the [color] section above.  The next part of this is the name you defined in the [device] section.  The last is a number for the channel (remember 3 colours with 10 strips = 30 channels that you also defined in the [device] section).  The channel needs to be unique (so the next [light] section for the second LED strip will have the same 3 colors, the same device name, but will be channel number 4,5 and 6)
hscan      0 33
This is the horizontal scan range this LED strip will sample of the TV.  The first number is the start range, the second is the end range.  For my TV, I have 3 LED strips across the top.  This hscan example is for LED strip 1 which is in the top left corner of my TV, so the scan starts at 0 (the very left) and goes in 33% (therefore strip 2 that is in the top middle is 33 – 66, strip 3 in the top right is 66-100)
vscan      0 20
This is the vertical scan range this LED strip will sample of the TV.  The first number is the start range, the second is the end range.  It’s basically how far in to the picture to sample the image.  A finish value of 20 will cater for black bar movies (just).

Obviously the hscan and the vscan work the opposite way when you are working with the LEDs on the sides of the TV.  The config file is designed to start LED strip 1 at the top left of your TV with 1,2,3 across the top (left to right) , 4 and 5 down the right, 6,7,8 across the bottom (right to left) and finally 9,10 up the left.

Heres as diagram I started showing the hscan and vscan units to try and help if you are a bit stuck.

boblightconf_10_LEDs

If you make any changes to this file, it is only read when the boblight daemons are started – I could work out a way to stop and start the two daemons so I rebooted the Pi after each change.

The adjustments I have made to the colors I found OK – far from a perfect match but this is where I have got to so far.  To help calibrate, I created some videos to use.  The first three are pure red, pure green and pure blue, and then the last one has some movement of color with some pauses to help you with hscan and vscan on each strip (thanks to a YouTube publisher for this).

Feel free to download these, add them to your movie library and play them to see your results (and have a laugh at what the movie scraper uses from IMDB)

Link to Blue file

Link to Red file

Link to Green file

Link to calibration file (95mb)

Placing the lights on your TV

So once you have tested and configured everything, its time to put the lights on your TV – this can be a bit tricky as for my LightPack, the sequence of strips didn’t logically go down one side and up the other.  What I did was to change the boblight.config file to have just 3 channels.  This meant that only one LED strip would light up.

Heres the config file in full:

[global]


[device]
name LP1
channels 3
type lightpack
interval 20000
#bus 1
#address 6
#debug true


[color]
name red
rgb FF0000
gamma 1.6
adjust 1.0


[color]
name blu
rgb 00FF00
gamma 1.6
adjust 1.0

[color]
name grn
rgb 0000FF
gamma 1.6
adjust 1.0

[light]
name L01
color red LP1 1
color grn LP1 2
color blu LP1 3
hscan 0 33
vscan 0 20

I then rebooted the Pi and watched what LED strip came on.  when it did, I marked  L01 on the ribbon cable with a  sharpie.  I then just added 3 to the channel, added the next [light] section for L02 and rebooted.  The next strip lights up – I then mark that ribbon cable with a sharpie L02.  Do this for all 10 and you know which strip matches which [light] section in your config file.

Next I stuck the LED strips round my TV with Blue tack and ran the calibration video and of course, the avatar torch scene to test.  Once I was happy, I stuck down the LED strips and tidied up the cables and I was done.

I’m yet to find a nice add on that will turn my lights on and off – the best I have found is called boblight switch which works for turning them off, but I have to reboot to turn them back on.

I hope this helps anyone exploring a LightPack option for Raspbmc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s