Tuesday, March 5, 2013

RaspberryPi, Boblight, and the WS2801 LED - Part 3


Part 1 of my blog series went over our parts list and initial setup for this project. 

Part 2 dived into a little bit of code and making those LEDS light up for the first time.

This final part will go over installing Boblightd, XBMC boblight add-on,  mounting the LEDS and configuring them to look their best. 

If you followed Part 1 and Part 2, you should know how to SSH into the raspberry pi. Make note of your raspberry pi IP Address we'll be using it soon.  Once logged in run the following commands to install boblight. 

copied from here.

3. Install subversion
  $ sudo apt-get install subversion
4. Clone boblight source
  $ cd ~
  $ svn checkout http://boblight.googlecode.com/svn/trunk/ boblight-read-only
5. Compile:
  $ cd boblight-read-only/
  $ ./configure --without-portaudio --without-x11 --without-libusb 
If everything goes well.....
  $ make
  $ sudo make install
6. now configure your setup, see conf/LPD8806.conf for examples and move .conf file to /etc/boblight.conf
  $ sudo cp conf/LPD8806.conf /etc/boblight.conf
7. you can test now by starting boblightd
  $ sudo boblightd
we have to run boblightd using sudo for SPI to work
8. if you like, you can add boblightd to /etc/rc.local for it to start on boot
  $ sudo nano /etc/rc.local
and add
  /usr/local/bin/boblightd -f
before exit

Once Boblight is installed open up XBMC and go to 
  1. Settings
  2. Add-ons
  3. Get add-ons
  4. XBMC.org Add-ons
  5. Services
  6. XBMC Boblight
  7. Install

At this point you should be able to configure the boblight addon on XBMC. If you open the addon settings it should ask for an ip address. Type in your raspberry pi ip and hit ok.   If you restart XBMC and everything went correctly...the LEDS will light up RED, GREEN, BLUE and either turn off or go to the ambient color configured in the settings. 

We're almost there! We still need to configure boblightd for the amount and orientation of theLEDS. You can do this manually or you can use a program somebody wrote for this purpose. 


This will spit out our boblight.conf file. You'll need to edit this before copying to the raspberry pi.

Boblight is normally used with an arduino connected by usb so thats the output/interface by default you should just need to change the output and the interface.

/dev/spidev0.0 is the output needed for the pi to communicate with the LEDS
The interface needs to be changed to the raspberry pis ip address.

The beginning of my boblight.conf:
[global]
interface  192.168.1.13
port      19333
[device]
name            ambilight
type            momo
output          /dev/spidev0.0
channels        150
interval        20000
rate            115200
debug           off


This was kind of a pain to copy to the raspberry pi. Especially through command line.

Easiest way I found is to COPY the entire boblight.conf and create a new file

 sudo nano boblightd.conf


 and then PASTE the config into it. 

and finally copy that file over your boblight.conf file

sudo cp boblightd.conf /etc/boblight.conf


Thats it! If everything went well boblight shoudl be configured. Every time you start up XBMC on your pc it should look for the the raspberry pi ip address and connect.
Mounting the LEDS


The picture above is my preliminary OMG I NEED THESE LEDS ON MY TV NOW. I just stuck them on there with some painters tape. Worked for a bit until the tv heated up and melted the sticky. 

Once I got them stickied on there I created a test video for XBMC to play. I just went into mspaint and created a quick picture w/ a different color on each side and rendered that as an avi in Windows Movie Maker. Took about 15mins but it helped significantly when determining the leds were in the correct position. 

In the picture below you can see my monitor in the background corresponding with the LED Colors around the tv. 





Once we figured out how the LEDS were going to be laid out I cut up my TV Box for a large chunk of cardboard.

I've seen some much better implementations for an LED mount but i'm cheap and lazy.



This picture and the one below show our power distribution for the LEDS something we probably didn't need to do with the amount of LEDS that we used (50). We noticed some drop off in brightness so we decided to do it anyways. 



Notes: I'm still working on this project. Right now I have two Raspberry pis one to control the LEDS and one to run XBMC...unfortunately I haven't had the time to go through some of the forum posts regarding RaspBMC + Boblight addon. It seems somebody out there has gotten XBMC on the raspberry pi to talk with boblight using omxplayer. I'll do a follow up post once I figure it out and get it workin. For right now using my windows pc connected to the TV works out great. 








13 comments:

  1. great tutorial.thanks for all your work.
    all went well. just can't get rid of the flickering.

    ReplyDelete
  2. I would try cutting your LED strand to a smaller size...maybe 5-10 and see what happens. you can always tape it back together if it doesn't do anything. One of the individual leds might be causing the entire strand to freak out though.

    ReplyDelete
  3. Try googling 'LED boblight pi flicker' or something similar, I'm sure I've seen that issue mentioned (and fixed) on a forum, either the XBMC, or Pi forum. I don't have a link I'm afraid.

    ReplyDelete
  4. All,

    you can have a look to the following topic on the Raspberry Pi forum, everything is embedded in the Raspberry Pi (boblight Deamon + modified XBMC + a forked OMX player to replace boblight addon).

    http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=5201&start=200

    Xboxer,

    ReplyDelete
    Replies
    1. Ha, I think that might be the same thread I was looking through! Looks like they've made a lot more progress since I've last checked. I'll have to make some time this weekend and finish the project. Thanks!

      Delete
    2. hello,

      Nadnerb from raspberry pi forum made a guide on setting up boblight on a Raspberry Pi with, hopefully, every step you need to take to get it up and running.
      This includes the hardware and software elements and uses 50 WS2801 LEDs.

      here after is the link:

      http://bit.ly/pi_boblight

      Delete
  5. Hey Cody, just wanted to ask what size TV are you using with the 50 LED setup?
    I am about to do my own setup soon, and just wanted to make sure 50 RBG LED's are sufficient for a 55 inch TV.
    I was also thinking of putting them all in a sleeve to defuse the light a bit more over space.
    Nice call on the cardboard by the way, can't beat free!

    ReplyDelete
  6. I used 50 for my 55" . I thought they were pretty evenly spaced but definitely room for around 100. Email me some pictures when you're done!

    ReplyDelete
  7. Hi Cody,

    Thanks for your great tutorial. I followed every step but mine doesn't seem to work as nice as yours sadly.

    You can check a video of my version here:
    http://www.youtube.com/watch?v=sIgzR9tPTz8

    It seems there's quite some strange / bad choices in color selection. Any idea what this could mean and are there other people with similar problems?

    Thanks again!

    ReplyDelete
    Replies
    1. Those are some weird problems. It seems to pick up new colors but old ones stay around...what does your boblight.conf look like?

      Delete
    2. Hi Cody,

      Thanks for your reply:

      Config looks like this:

      #[global]
      interface 192.168.2.100
      port 19333

      [device]
      name ambilight
      type ws2801
      output /dev/spidev0.0
      channels 300
      prefix 41 64 61 00 63 36
      interval 20000
      rate 48000
      debug off

      [color]
      name red
      rgb 0000FF
      gamma 1.0
      adjust 1.0
      blacklevel 0.0

      [color]
      name green
      rgb 00FF00
      gamma 1.0
      adjust 1.0
      blacklevel 0.0

      [color]
      name blue
      rgb FF0000
      gamma 1.0
      adjust 1.0
      blacklevel 0.0


      Any idea?

      Delete
    3. How many lights do you have? I have 50 so my channels are set to 150.

      There are supposed to be Light configurations under the colors. I'm guessing you didn't paste them to save room? you can use something like pastebin.com. I fixed the link to the boglight configuration tool in the above post use that to generate the boblight light configuration.

      Delete
  8. Hi Cody,

    I have 100 LEDS, i didn't paste the light configurations to save room indeed. Would be a long paste . Thanks for fixing the link, i will use that tool.

    I have Bottom left as a starting point with counterclockwise installation.
    30 Bottom
    20 Right
    30 Top
    20 Left

    I will poste the conf file on pastebin later .

    Thanks for your reply

    ReplyDelete