Page 1 of 1

Ambient TV lighting with XBMC Boblight, OpenElec and WS2811/WS2812 LEDs

Ambient TV lighting with XBMC Boblight, OpenElec and WS2811/WS2812 LEDs
   851

Back in the day, when the first LED TV’s appeared, Philips came with a great feature: Ambient TV lighting.

Ambient TV lighting consisted out of lights that would project to the wall behind your TV, one or more colors matching the content on your TV. So if the majority of the screen would be red, then the light emitted would be red, if the majority of the screen is green, then green light would be emitted, etc.

Over the years this has been refined to multiple colors, matching small parts of the screen. Unfortunately though, this wonderful feature is not something you can simply add to your TV. You will have to buy a Philips TV with this feature, …

Until now though, and only for XBMC (Kobi) users. Some smart guy(s) created Boblight, which is opensource and can run (for example) on your XBMC computer. The computer analyzes the video content and “converts” it to signals for LED strands, so you can attach these strands behind your TV and have a DYI Ambient TV lighting effect.

Note : This will only work for content played through your XBMC Media player (I used OpenElec)! So your regular TV shows, your XBox or PlayStation, none of these will have an influence on the “Ambient TV lighting” we will be discussing in this article.




Goal: Boblight with OpenElec and WS2811/WS2812 LEDs

The goal of this little project is to create the Ambient TV lighting effect using XBMC, based on OpenElecBoblight, an Arduino Uno (or other suitable Arduino) and one or more WS2811/WS2812 LED strands.

A video of the result can be seen at the end of this article, so if you’d like to see that first: Click here to scroll down.

OpenElec, Boblight, Arduino and WS2812 LED strands in action

OpenElec, Boblight, Arduino and WS2812 LEDs in action

Before proceeding: This article has two main differences compared to other similar articles.

First of all, we’re running this on an Intel/AMD computer running OpenElec, my favorite XBMC distribution. Most of these instructions are applicable for a regular XBMC setup, but configuration for example is done slightly different.

Second, and most importantly:
We will be using WS2811/WS2812 LED strands, unlike most articles that write about WS2801 LEDs (or comparable).

These WS2811 or WS2812 LEDs are very different from the WS2801 LEDs.
If you have done so yet, I highly recommend reading our article “Controlling a WS2812 LED strand with NeoPixel or FastLED“. This article will not only give you an idea how to identify your LED strands, but it will also give you the means to test your LED strands – to make sure all LEDs work!

How does Boblight work – the Basics …

Trying to build something like this myself, I’ve found it surprisingly hard to find the “complete” guide on how boblight based projects work. Once you get it, it’s easy … and understanding the process it will help you later on when you need to do troubleshooting.

If you look at the illustration below, then you’ll see your standard XBMC process of video playback:
A video file is taken (1) and displayed on your TV or monitor (2) by XBMC.

Boblight Process (simplified)

Boblight Process (simplified)

Boblight, a combination of a so called daemon (program that runs in the background) called “boblightd” and a configuarion tool called “XBMC Boblight“, very rapidly analyzes the image on your screen and “converts” it to a super low resolution image (3). This “image”, based on the boblight configuration file, is then sent over USB to your Arduino, which in turn uses this information to control the colors of your LEDs (4).

This USB connection is actually seen as a serial port on your XBMC box and has a dedicated device name.
Under OpenElec the device name is “/dev/ttyACM0” (for non-OpenElec XBMC this can be different!).

Finding the right device under Linux 

If “/dev/ttyACM0” isn’t the device for your setup, then try the following, which lists the several devices: cat /proc/tty/drivers

In OpenElec it could show something like this:


1
2
3
4
5
6
7
8
9
10
11
12
OpenELEC (official) Version: 6.0.3
OpenElecLivingRoom:~ # cat /proc/tty/drivers
/dev/tty /dev/tty 5 0 system:/dev/tty
/dev/console /dev/console 5 1 system:console
/dev/ptmx /dev/ptmx 5 2 system
/dev/vc/0 /dev/vc/0 4 0 system:vtmaster
acm /dev/ttyACM 166 0-31 serial
serial /dev/ttyS 4 64-67 serial
pty_slave /dev/pts 136 0-1048575 pty:slave
pty_master /dev/ptm 128 0-1048575 pty:master
unknown /dev/tty 4 1-63 console
OpenElecLivingRoom:~ #

Look at the last column, and investigate/test the devices that end with “serial” in the last column. So in the example “/dev/ttyACM” or “/dev/ttyS”.

Before communication over this USB serial-port can be done, both XBMC and Arduino need to know what communcation speed (baudrate) needs to be used. This speed must be identical for both devices otherwise they will not understand each other.

As you can imagine, this process will happen in a blink of an eye video is displayed, analyzed, converted, send through the serial connection to the Arduino, where it’s then converted and sent to the LEDs which each have to be turned on as well.

To make sure your Arduino knows when to start with the color of the first LED, a “prefix” is being send. This prefix can be seen as a “code” to identify the “beginning” of data for all LEDs. This prefix needs to be defined in the boblight config file, so it know to send this, and it needs to be defined in your Arduino Sketch so it can recognize it.

More details on the configuration later on, just keep in the back of your head that these 3 items (device name, baudrate and prefix) are critical for your Ambient TV lighting to work!

Boblight Shopping list, or: What do we need?

Planning is everything in this project, so before we begin: I highly recommend reading this article all the way before going shopping for LEDs etc. I’ve noticed that others have started similar projects only to find out that they bought the wrong parts, or forgot to get parts that are needed.

 Tools used

  • Proper soldering iron with a reasonably fine tip
  • Wire cutter
  • Wire stripper
  • Scissors
  • Screw driver (Philips)
  • Exacto knife
  • Drill (to make the screw holes in the frame)

  Electronics / Parts

  • Media Player that runs OpenElec. We will focus on “regular” PC’s, either AMD or Intel based.
  • One or more long WS2811 or WS2812 LED strands (can be found at Amazon or eBay, for example: this one or this search at Amazon).
  • One Arduino Uno or other suitable Arduino model (for example at Amazon).
  • One USB cable A-Male to B-Male (see Amazon).
  • Capable 5V power supply (see below for calculating Amp requirements).

 Other

  • Software:
  • Frame material, to build a frame to hold the LEDs (optional).
  • Wires and or connectors, depending on your LED strands and frame design.

 

  Please read the rest of the article before purchasing anything.
  This project should work on an AppleTV (1st gen) with OpenElec as well (untested).
  Similar projects exist for OpenElec with Raspberry Pi, even ones where the Arduino is not needed (WS2801 based).
  I recommend buying the LED strand as one piece, so if you need 5 Meter, then do not buy 5 individual 1 Meter strands.

Building a Frame

I started by making a frame, since the size of the frame will determine how many LED strands I would need.

Size

Before “designing” a frame, it would be good to determine the size requirements.
For this I took the size of the back of my TV, keeping a distance of about 3½” (or app. 9 cm) around the TV edges. For smaller TV’s (mine is 80″) you might want to take something like 5cm instead. It’s up to you how “close” you’d like to go to the edge.

Some determining factors could be:
– Brightness of your LEDs (brighter LEDs, require less LEDs for the same effect)
– Desired “resolution” (you’ll need more LEDs if you prefer to see more detail)
– Distance from your TV to the wall
– Design of your TV (watch the TV stand/foot!)
– Visibility of mounted LED frame

Ambient TV lighting frame - Keep a little distance from the edges

Ambient TV lighting frame – Keep a little distance from the edges

Mounting Considerations

Most LED strands I’ve seen have double sided tape on the back, which makes it easy to stick them to the back of your TV. My experiences with any double sided tape has been far from great … Keep in mind that TV’s can get pretty warm and the double sided tape could let go over time, not to mention the glue reside you might find at a later time on your TV after the LED strands fell off or after your removed the strands.

So I decided to create a lightweight frame. I have considered a few options, that might you get started building your own frame.

The frame should be light weight, not just so you can move it around without getting a hernia, but also because there is only so much weight you’d like to put on your TV. You’ll also find that mounting a lightweight frame is much easier …

Options I considered were using plexiglass strips, wood strips or aluminum strips. I have actually seen someone do it with cardboard but that was just too sloppy for my taste. I even considered a rectangle sheet of plexiglass, but that would have negatively impacted the ventilation (for cooling) of the TV.

I ended up using aluminum counter top edging strips, which ran me about $20 in total to get it at my local Ace Hardware store. They have a tiny corner which makes them a little less sensitive to bending compared to a simple flat strip.

Attaching the frame can be done in three ways:
– Use the VESA mount on the back of your TV (recommended)
– Make hooks over the TV edge (ugly)
– Hook into the venting grill on the top of your TV (dangerous)

Since I plan on using a VESA Wall-mount in the future, and I don’t like hooks hanging over the edge of my TV, I decided to go the dangerous route and put two tine screw in the venting holes on the top of my TV to hang the frame on. In the top left and right corner I did place a screw in a venting hole, only going a tiny bit, just enough to be a good “hanging” point.

I cannot recommend this method unless you’re very aware of what you’re doing.

How NOT to do it - Two screw in the top corners to hang your frame

How NOT to do it – Two screw in the top corners to hang your frame

CAUTION WHEN PLACING SCREWS IN YOUR TV!!! 

When using the method I used, two tiny screws in the top venting holes of your TV:
Be VERY CAREFUL, and KNOW WHAT YOU’RE DOING!

Behind these venting holes electronics can be found and putting a screw in that might:
DAMAGE YOUR TV PERMANENTLY
ELECTROCUTE YOURSELF

In this article I will pretend I used the recommended VESA mounts instead, but the pictures might elude that I’ve used the dangerous method instead. The VESA mount option gives you 4 screws, that can be sued safely to mount your frame on.

Keeping it Movable (optional)

Another consideration I kept in mind was that I’d need to be able to disassemble my frame, just in case I need to move or store it.

For this reason I used a screw in each corner, and connectors between each sides, so I can complete disassemble the frame by using only a screwdriver. Still a big item to move or store (since it’s made for an 80″ TV), but at least it will fit in my car if needed.

Basic Design

The basic design (for the VESA mount approach) is build out of 6 strips; 2 horizontal and 4 vertical.
For each point where the strips meet you’ll need a screw to attach the parts – I used a 3mm screw. Using the Countertop Ediging strips, one screw per joint seemed enough, but if you’re using flat strips, two screws might be a better choice to keep the frame more rigid.

Notice in the illustration below the four holes for the VESA mount, you’ll have to measure out on your TV where those holes should go. This also goes of course for the two center strips that will have to line up with the VESA mount.

  Tip: When working on the back of your TV, consider laying the TV flat on the floor, face down, on a blanket (to avoid scratching).

Ambient TV lighting Frame Design

Ambient TV lighting Frame Design

Mounting the LEDs on the Frame

Once the frame is done, we can start mounting the LEDs. This, up to today, has been a confusing exercise for me, and this is what worked for me.

When looking at the rear of your TV, the LED’s should “start” at the center bottom and move around counter clockwise.
Or, when you’re standing in front of the TV, start at the center bottom and move around clockwise.

  When you use “Boblight Config Maker“, you start at the bottom, either in the left corner, the middle or the right corner (all at the bottom).

Ambient TV lighting Frame Design - LED strand positions

Ambient TV lighting Frame Design – LED strand positions

Below some pictures of making my frame. As you can see, I made the mistake to not start exactly in the middle (at the bottom), a lesson learned that might benefit you and a reason why I created my Boblight Config Maker to be more flexible.

The reason why I ended up this way is because I made the mistake of buying 1 meter strands. A little too long for the sides, and a little too chort for the top. So I ended up with smaller pieces that I had to solder together and did not result in a “perfect” symmetrical setup.

Make sure that the arrows on your LED strands point in the same direction!!

Note that not starting the right way will not prevent boblight from working correctly. Creating a configuration file might become more of a challenge – as I had to find out the hard way, and that’s why I created a program for this called “Boblight Config Maker” (how creative right?) which is available for Windows, Linux and MacOS X.

Clean frame assembled

Clean frame assembled

Mounting LED strands on the frame

Mounting LED strands on the frame

Besides utilizing the double sided tape at the back of the LED strand, I used tiny straps to support the strip. Like I said before: my experience with double sided tape has not been good, and I’ve learned not to rely on it staying put forever.

Here you also see how I used the connectors at every “corner” so I only have to remove the screw and disconnect the connectors if I’d like to store or move the frame.

All LED starnds installed

All LED starnds installed

In case you bought your LED strands in 1 Meter pieces (please avoid this if possible!), you will probably find that the 1 Meter pieces do not always fit perfectly, and that you will have to use less than a meter for the sides, yet more than a meter for the top and bottom part. In that case start with the longest sides first (top), and work your way down to the shorter pieces, so: top, left/right, and finally the bottom pieces.

  Make sure the arrows on the strip all point in the same direction!

Splitting LED Strands

Making these strips shorter isn’t difficult. You can use regular scissors for that and cut the strand between two LEDs as indicated below. Make sure the copper islands remain in tact as we need them to solder wires on.

Cutting a LED strand

Cutting a LED strand

Combining LED Strands

Combining strips isn’t hard either, just a little bit more work. For this a good soldering iron/station is recommended.

Watch the Arrow! 

The WS2811 and WS2812 LED Strands are direction sensitive. Make SURE that both strands have the arrows pointed in the same direction!

The easiest way, if cut off right, is by holding both end together and let the soldering tin do the work. Before doing that, it’s best to have some soldering tin on the copper pads. I found that with my Weller station, it works easiest to hold the tip of the soldering iron on the copper island and then add the soldering tin so it flows nicely over the copper pad. Make sure to look for shortcuts before proceeding.

Next hold the ends together so that the pads line up (GND to GND, +5V to +5V, Do to Din) and briefly heat up the tin so the tin of both island flow together. Once all 3 are connected, I usually add some insulation tape under the connection I just made.

In the example below (I didn’t have a better one, sorry) you’ll notice that the connection pads of the LED might not be connected. But they are. I just cut out a defective LED in this strand and instead of cutting it the usual way, I kept the pads of the failing LED to give myself al little more rome for error.

Attach two LED strands - Watch the arrows!

Attach two LED strands – Watch the arrows!

Attaching wires

In every corner you’ll need to attach wires, even if you don’t want to use connectors like I did. The wires you’ll be using should not be super thin! The LEDs use quite a bit of power, so we’d like to avoid that your thin wires get overloaded and start a glowing fest on their own.

Here we heat the individual pads again and apply some tin. The same should be done with the wire ends that we’d like to connect. Once done, heat up the tin on the pad again and slowly place the wire on the island.

  Keep in mind though that these are still sensitive electronics, combined with plastic, so don’t over do the heating up!
  Make sure to strap these wires down so that a yank on these wires will not rip your LED strand apart.

LED Strands - Attaching wires

LED Strands – Attaching wires

Below an example of one of the corners – this is how you could do it, I’m sure there are more elegant ways.
– The yellow straps hold the LED strands in lace.
– The red straps hold de wires in place, so that an accident pull on the wire won’t rip up your LED strands.
– The black straps hold the frame in place (which you wouldn’t do when using the VESA mount)…

Boblight Frame - Example how to handle the corners

Boblight Frame – Example how to handle the corners

Testing your LED strands

During installation: Multimeter Testing

During installation of my LED strands on the frame, every time after I install a strand, I always use a multimeter (set to Diode) to test if a connection still flows. I do this with GND and +5 only. This test will not work for the Data wire though.

Hold one test-probe of your multimeter on the GND at the starting point, and the other test-probe on GND of your last LED – it should connect! Do the same for +5V.

After installation: Arduino Sketch Testing

Once you’ve build your entire frame and have installed all LED strands, connect your starting point as described in the Controlling a WS2812 LED strand with NeoPixel or FastLED” article, and run one of the NeoPixel tests to makes sure that all LEDs work.

  Don’t forget to set the number of LEDs properly in the code of the Arduino Sketch.

Power Supply Considerations

According to the WS2811/WS2812 spec sheets (you can download them  LED-Specification-sheets.zip (1.1 MB) ), each “LED” pulls 60 mA at most. Keep in mind that each “LED” actually consists out of three LEDs (red, green and blue), each pulling 20 mA.

Theoretically, in my example where I’m using 290 “LEDs”, I would need:

290 x 60mA = 17,400 mA = 17.4 Amps

Which is probably the “safe” amount of Amps, but in my opinion a little crazy. So I used the suggested method from Adafruit.
I suppose their method rests on the fact that not all LEDs will be running at maximum brightness all the time and that most powersupplies allow a little tolerance for short peak moments.

Formula:   ( number of LED’s  x  20 mA  ) / 1,000  = needed Amps

So for my setup this means:  290 x 20 mA  = 5,800 mA = 5.8 A
(1,000 mA = 1 A)

I picked a power-supply between this value and the max needed, so a power-supply between 5.8A and 17.4A.
I ended up with a 10A power-supply from eBay and it has been working great the past few weeks.

Connecting your Arduino

Before uploading a Sketch to your Arduino, let’s briefly look at how we’re going to connect things.

During normal operation of the Boblight, the USB port of your Arduino will be connected to your OpenElec/XBMC computer. The USB connection is seen as a serial port on this computer, but the USB port also provides power to the Arduino.

The LEDs are powered by the Power Supply we just discussed.

The beginning of the LED strand will be connected as follows;
Din (the Data pin of the LED strand) will go to pin 13 of your Arduino.
+5V will go to the power supply
GND will go to a GND pin on your Arduino and to the power supply.

Boblight - Arduino, LED strand and Power Supply

Boblight – Arduino, LED strand and Power Supply

Uploading the Arduino Sketch

To upload a sketch to your Arduino, you will temporary need to connect the USB cable to your computer, instead of the XBMC PC, of course.

I tried a few sketches that I could find on the Internet and some worked and some didn’t work. In the end I created my own, derived from numerous sketches.

One of my main complaints, besides the one that didn’t work, was the lack of documentation of the code, so you might feel that I’ve overdone it a little in my code. I do hope though that it gives you an idea what is happening, which is important when troubleshooting.
Optimization tips are most welcome of course …

Setup()

In this function we wake up the LED strand and set initial brightness, set the LEDs to black and do a color swipe.
Next we activate the serial port (USB) and set the initial state to “waiting for a prefix”.

Loop()

This function, in Arduino world a function that keeps repeating, will do some things based on the state we are in.

  • While waiting (STATE_WAITING) for a prefix, this function keeps looking until it finds the first character of the prefix.
  • Once the the first prefix character has been found (STATE_DO_PREFIX), it will try to find the following characters of the prefix.
  • After the complete prefix was found, then the state will go to processing LED colors (STATE_DO_DATA). 
  • Once all LEDs have been set, they will be shown and it will start waiting again (STATE_WAITING). 

You can copy and paste the Sketch file, or download it.

Download - T4a Boblight 

Filename:  t4a-boblight.ino
Platform:  Undefined
Version:  1.0
File size:  4.9 kB
Date:  2014-03-15
 Download Now  Send me a cup of Coffee    

You will also need to install the AdaFruit NeoPixel library in your Arduino IDE.

Download - Adafruit NeoPixel 

Filename:  Adafruit-NeoPixel.zip
Platform:  Undefined
Version: 
File size:  27.2 kB
Date:  2014-01-03
 Download Now  Send me a cup of Coffee    

Parameters you can set in the Sketch:

Parameters in Arduno Sketch
 Parameter  Default  Purpose
 STARTCOLOR  0xFFFFFF  Initial color of LEDs (white)
 DATAPIN  13  Data pin on your Arduino
 LEDCOUNT  292  Number of LEDs you use
 SHOWDELAY  200  Delay in microseconds between color changes
 BAUDRATE  460800  Serial port speed
 BRIGHTNESS  90  Maximum brightness of the LEDs in percent
 prefix  {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D}  Prefix code in Hex numbers

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* t4a_boblight
 * (C) 2014 Hans Luijten, www.tweaking4all.com
 *
 * t4a_boblight is free software and can be distributed and/or modified
 * freely as long as the copyright notice remains in place.
 * Nobody is allowed to charge you for this code.
 * Use of this code is entirely at your own risk.
 */


#include "Adafruit_NeoPixel.h"

// DEFINITIONS

#define STARTCOLOR 0xFFFFFF  // LED colors at start
#define BLACK      0x000000  // LED color BLACK

#define DATAPIN    13        // Datapin
#define LEDCOUNT   292       // Number of LEDs used for boblight
#define SHOWDELAY  200       // Delay in micro seconds before showing
#define BAUDRATE   460800    // Serial port speed, 460800 tested with Arduino Uno R3
#define BRIGHTNESS 90        // Max. brightness in %

const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D};  // Start prefix
char buffer[sizeof(prefix)]; // Temp buffer for receiving prefix data

// Init LED strand, WS2811/WS2912 specific

// These might work for other configurations:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDCOUNT, DATAPIN, NEO_GRB + NEO_KHZ800);

int state;                   // Define current state
#define STATE_WAITING   1    // - Waiting for prefix
#define STATE_DO_PREFIX 2    // - Processing prefix
#define STATE_DO_DATA   3    // - Receiving LED colors

int readSerial;           // Read Serial data (1)
int currentLED;           // Needed for assigning the color to the right LED

void setup()
{
  strip.begin();            // Init LED strand, set all black, then all to startcolor

  strip.setBrightness( (255 / 100) * BRIGHTNESS );

  setAllLEDs(BLACK, 0);
  setAllLEDs(STARTCOLOR, 5);

  Serial.begin(BAUDRATE);   // Init serial speed

  state = STATE_WAITING;    // Initial state: Waiting for prefix
}

void loop()
{
  switch(state)
  {
    case STATE_WAITING:                  // *** Waiting for prefix ***
      if( Serial.available()>0 )
      {
        readSerial = Serial.read();      // Read one character

        if ( readSerial == prefix[0] )   // if this character is 1st prefix char
          { state = STATE_DO_PREFIX; }   // then set state to handle prefix
      }
      break;

    case STATE_DO_PREFIX:                // *** Processing Prefix ***
      if( Serial.available() > sizeof(prefix) - 2 )
      {
          Serial.readBytes(buffer, sizeof(prefix) - 1);

          for( int Counter = 0; Counter < sizeof(prefix) - 1; Counter++)
          {
            if( buffer[Counter] == prefix[Counter+1] )
            {
              state = STATE_DO_DATA;     // Received character is in prefix, continue
              currentLED = 0;            // Set current LED to the first one
            }
            else
            {
              state = STATE_WAITING;     // Crap, one of the received chars is NOT in the prefix
              break;                     // Exit, to go back to waiting for the prefix
            } // end if buffer
          } // end for Counter
      } // end if Serial
      break;

    case STATE_DO_DATA:                  // *** Process incoming color data ***
      if( Serial.available() > 2 )       // if we receive more than 2 chars
      {
        Serial.readBytes( buffer, 3 );   // Abuse buffer to temp store 3 charaters
        strip.setPixelColor( currentLED++, buffer[0], buffer[1], buffer[2]);  // and assing to LEDs
      }

      if( currentLED > LEDCOUNT )        // Reached the last LED? Display it!
      {
          strip.show();                  // Make colors visible
          delayMicroseconds(SHOWDELAY);  // Wait a few micro seconds

          state = STATE_WAITING;         // Reset to waiting ...
          currentLED = 0;                // and go to LED one

          break;                         // and exit ... and do it all over again
      }
      break;
  } // switch(state)

} // loop

// Sets the color of all LEDs in the strand to 'color'
// If 'wait'>0 then it will show a swipe from start to end
void setAllLEDs(uint32_t color, int wait)
{
  for ( int Counter=0; Counter < LEDCOUNT; Counter++ )      // For each LED
  {
    strip.setPixelColor( Counter, color );      // .. set the color

    if( wait > 0 )                        // if a wait time was set then
    {
      strip.show();                     // Show the LED color
      delay(wait);                      // and wait before we do the next LED
    } // if wait

  } // for Counter

  strip.show();                         // Show all LEDs
} // setAllLEDs

Preparing OpenElec (XBMC) – Installing BobLight

For your newly assembled Ambient TV lighting/BobLight to work, you will need to install two components on your XBMC/OpenElec box.

XBMC BobLight

XBMC BobLight

 Boblightd

First we need “boblightd” (the daemon, or program that runs in the background), and there is a special version prepare for use with OpenElec (see also: Add-on Boblightd and OpenElec forum). Installation is easy, in XBMC from the home screen, go to: “System Settings Add-ons Get Addons All Add-ons Services  “boblightd“, and select “install“.

 XBMC Boblight

Next we need to install the “XBMC BobLight” add-on (see also: XBMC BobLight Add-on and XBMC Official Forum Topic) which is used for configuration of when and how to use “boblightd”.

Repeating pretty much what we have done with “boblight”, as it’s in the same group as the “boblight” addon. Again in the XBMC home screen, go to “System Settings Add-ons Get Add-ons All Add-ons Services  “XBMC Boblight” and select “install“.

Creating the Boblight Config file

Once you’ve installed the two needed plugins, it will be time to create a config file.

The config file for boblightd defines the way boblightd communicates with your Arduino. So we will define what kind of device it will be talking to and what the type of communication will be.

Additionally, in this config file, we can define color corrections and the LEDs that we use. For each LED a zone will have to be defined so that boblight can pass on the right color. Such a zone can be seen as a rectangle located somewhere on your TV screen (or better: video). A zone has a defined position and size.

To create all this, you could do everything by hand, but that would be tedious work, which s not only boring but also makes it that mistakes are made easier. So I create an application for that. It’s called Boblight Config Maker and it’s free and available for Windows, MacOS X and Linux. 

I recommend going through the Boblight Config Maker page for more details, although the app should be pretty self explanatory.

Once done we should have a boblight.conf file which we need in the next step.

Boblight Config Maker for Windows

Boblight Config Maker for Windows

Installing the Boblight Config file

OpenElec has really a great way of working with configuration files. You can simply browse there with your computer and look for the file(s) you need or want to edit.

We basically will be looking for the directory “/Userdata/addon_data/service.multimedia.boblightd“.
Here you will find some files, one of them being “boblight.conf.sample”, and this is where we will copy the “boblight.conf” file we just generated. Make sure the file is called “boblight.conf“!

  If you can’t find this directory, reboot your OpenElec box and try again.

MacOS X

Under MacOS X, you can see you OpenElec XBMC box in your network and simply browse there.
If you do not see your OpenElec box, then do the following:
In Finder, choose “Go Connect to Server” option from the menu and a window will open.
In the field “Server Address:” type:  cifs://ipaddress/Userdata , where “ipaddress” should be replaced by the IP-address or network name of your OpenElec box.

Windows

Open a Windows Explorer window (not to be confused with Internet Explorer) and type in the address bar:   \\ipaddress\Userdata  , where “ipaddress” should be replaced by the IP-address or network name of your OpenElec box.

Linux

Based on Ubuntu (Files):
Open “Files” (the program) and select “Connect to server” from the “Files” menu. In the “Server Address” field, enter:  smb://ipaddress/Userdata , where “ipaddress” should be replaced by the IP-address or network name of your OpenElec box.

Based on Xubuntu (Thunar):
Open “File System” (Thundar) and select “Go” “Open Location” and enter:  smb://ipaddress/Userdata , where “ipaddress” should be replaced by the IP-address or network name of your OpenElec box.

First Test Run

Now that we have uploaded our configuration file, time to see if things work. In the initial startup we will not tamper with the “XBMC Boblight” plugin, the standard settings are fine for a first run.

Make sure you did the following:

  • Upload Sketch to Arduino
  • Connect Power Supply for LEDs
  • Install ‘boblightd’ and ‘XBMC Boblight’ on your XBMC/OpenElec computer
  • Upload ‘boblight.conf’ to you XBMC/OpenElec computer
  • Connect USB cable to Arduino and XBMC/OpenElec computer

Once you’ve done all that, switch on the LED powersupply (if needed) and after that switch on the XBMC/OpenElec computer.
If your XBMC computer was still on: reboot to make sure that boblightd uses the right config file.

  Each time you upload a config file, you will need to reboot your OpenElec box!

Whenever I start my OpenElec box, the first message I will hear is that “XBMC Boblight” says “Failed to connect to boblightd“, and a few seconds later it will say that it “Connected to boblight“. So if you see the fail message, wait a few seconds and see if it connects anyway.

Boblight - Fails first and then connects

Boblight – Fails first and then connects

One thing to keep in mind is that with the standard settings, you will most likely see no LEDs light up, you will have to start a movie or TV Show to see something happen. I did add a initial color to the Arduino Sketch, to give you an idea if the LEDs even work.

If nothing happens during video playback, then please verify the information in the config file and make sure it matches the settings of the Arduino Sketch.

Test Video

I created a video for the purpose of testing – believe it or not, but I created this in Adobe Photoshop, which has some very nice, but well hidden, video features. You can view or download it here (it’s small, but 1080p!).

 

Download - T4A AmbiLightTest 

Filename:  T4A-AmbiLightTest.mp4
Platform:  Undefined
Version:  1.1
File size:  1.8 MB
Date:  2014-03-13
 Download Now  Send me a cup of Coffee    

The “XBMC Boblight” plugin allows you to make some modifications, like for example if colors should respond fast or slow during movie playback or TV Show playback. Getting to the plugin however is less practical than expected. Any suggestions to create a short cut: please leave a comment below 

To get to the configuration plugin, do the following from the XBMC “home” screen:
System Settings Add-ons Enabled Add-ons Services XBMC Boblight” and select the “Configure” option.

Now that we’re in the configuration screen, finally, we can do settings for most media types. I leave it up to you to play with these settings, but I will mention two settings that I initially didn’t see, but have come to appreciate a lot.

LEDs OFF when screensaver is active

On the first tab, called “General“, I make sure the option “Disable when Screen Saver is on” was checked.
Now I don’t know about other boblight configurations, but in my case this works great.

When your XBMC setup dims it screen or has its screensaver kick in, the boblight LEDs will be turned OFF.
Which makes sense, after all it went to screensaver mode for a reason and there is no need to light up the room if nobody is paying attention anyway.

XBMC Boblight Setting - General tab

XBMC Boblight Setting – General tab

Blue Glow for the Menu pages

When the home screen is showing, Boblight will not be active. I really wanted a mild blue glow behind the TV – it just looks better. Initially I had no idea how to do this, until I realized that I had to go to the last tab in the configuration screen to find the “Other” tab.

On this tab you’ll find the option to enable “Static background light” which will make boblight show a defined color behind your TV when you’re in the regular XBMC screens when no video is being played.

For the purple/blue-ish default theme I used the following color (I’m sure this can be done better):

Red : 5
Green : 0
Blue : 20

XBMC Boblight Setting - Other tab

XBMC Boblight Setting – Other tab

Troubleshooting

My initial attempts simply did not work … So here a short list of troubleshooting tips, from personal experience, that might help you:

  Verify that settings in both Arduino Sketch and ‘boblight.conf’ use the same settings! Triple check ‘speed‘ (baudrate) and ‘prefix‘!

  If not all LEDs light up in the initial white color swipe (you don’t even need to switch on your XBMC to see this), then check if the Power-Supply can keep up (reduce brightness in the Arduino Sketch, or use another Power-Supply), and make sure that you counted the right number of LEDs in the Arduino Sketch and in ‘boblight.conf’. Alternatively, try the previously discussed way of testing your LED strand!

  If the initial color is white (as done in the Sketch above) and you see that not all LEDs are “white” then first check if your Power-Supply can keep up (reduce brightness) and verify that your strands are identical (if you used multiple). Different manufacturers seem to produce different “white” colors.

  In scenario’s where boblight does not seem to connect: verify that you’ve used the right ‘device‘, ‘prefix‘ and ‘speed‘ in ‘boblight.conf’. And I hate to admit it … but err maker sure the USB cable is connected to Arduino and XBMC Computer.

Different brands - Left and Right are "white" ...??

Different brands – Left and Right are “white” …??

Result

Well, after all this work, here a picture and two videos of my setup …

Boblight Frame Mounted and Working

Boblight Frame Mounted and Working

 

Two demo video’s I’ve recorded (too bad the video camera didn’t stick to the “real” colors). The video might not be of the best quality, since I cropped them and tried to keep them as small as possible.

Avatar Demo

Note : Avatar is copyright 20th Century Fox (official website, IMDB, Wiki), I hope they don’t mind I used a tiny part of this movie for this demo.

 

LaserShow Demo

Never mind the music, the original video I got from YouTube and it’s called “Laser show RGB Melody“.

 

 

Support Us ...


Your support is very much appreciated, and can be as easy as sharing a link to my website with others, or on social media.

Support can also be done by sponsoring me, and even that can be free (e.g. shop at Amazon).
Any funds received from your support will be used for web-hosting expenses, project hardware and software, coffee, etc.

Thank you very much for those that have shown support already!
It's truly amazing to see that folks like my articles and small applications.

Please note that clicking affiliate links, like the ones from Amazon, may result in a small commission for us - which we highly appreciate as well.

Comments


There are 851 comments. You can read them below.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.

  • Mar 18, 2014 - 8:50 AM - Nils Comment Link

    Nice tutorial. Thanks
    Quick Question:Does your guide also work with XBMC on Windows 8.1?

    Reply

    Nils

    • Mar 18, 2014 - 10:38 AM - hans Comment Link

      Thanks Nils! 

      Large parts of the guide will work for XBMC/Windows 8.1 as well.

      Some differences:
      – The “device” in the boblight.conf will be different (probably something like /dev/comx where comx is a USB comport)
      – “Installing” the config file might work a little different, you’ll have to find the directory boblight uses under Windows (possible under Userdata as well)

      The hardware, Arduino sketch, etc. will be the same (if you use WS2811 or WS2812 LED strands).

      Reply

      hans

    • Mar 18, 2014 - 10:54 AM - hans Comment Link

      If you look at the article “XBMC All rooms in sync“, and scroll to “Step 2: Create a file advancedsettings.xml”, you’ll find a list of different XBMC Operating System flavors. It shows you where “usually” the config files can be found (ie. the directory “Userdata”):

      Windows XP:  C:\Documents and Settings\<your_user_name>\Application Data\XBMC\userdata\

      Windows Vista, 7, 8 and newer: “%APPDATA%\XBMC\userdata” (you can paste this in the Windows Explorer).

      MacOS X: ~/Library/Application Support/XBMC/userdata

      Linux: ~/.xbmc/userdata

      OpenElec: network shared folder called “userdata” (any version)

      Apple iOS (iPad, AppleTV2, etc): “/private/var/mobile/Library/Preferences/XBMC/userdata/“.

      CrystalBuntu / CrystalHD: “/root/.xbmc/userdata“.

      A great resource is also this topic in the XBMC forum and this topic as well.
      Seems that in certain situations (under Windows) the directory “C:\boblightd\” is being used.

      Reply

      hans

      • Mar 19, 2014 - 3:05 AM - Nils Comment Link

        Alright, thanks again. I don’t see there a problem

        Reply

        Nils

  • Mar 19, 2014 - 3:35 PM - Florian Comment Link

    Thanks a lot for your effort!

    in the beginning you have said that this guide is NOT for the WS2801 LEDs

    in what points would the guide be different if i would use WS2801 LEDs ?

    Reply

    Florian

    • Mar 19, 2014 - 4:33 PM - hans Comment Link

      Hi Florian,

      There are some fundamental differences between the WS2811/2812 and the WS2801.

      You’ll need a sketch that supports the WS2801, unfortunately, I do not have these strips available, so I’m not sure if this would work with the NeoPixel library. Quite a few people however use WS2801’s, so it might not be hard to find a working sketch.

      For example this one (LEDSTREAM).

      Otherwise, the guide should be the same. Same frame, same hurdles if you use LED strips like I did, just one extra wire (WS2801 uses 4 wires instead of just 3).  The Boblight Config Maker will work for WS2801 as well.

      Reply

      hans

  • Mar 19, 2014 - 4:24 PM - hans Comment Link

    UPDATE:
    I totally forgot to mention that the AdaFruit NeoPixel Library is needed as well.
    I added the download link, just above the Sketch code.

    Reply

    hans

  • Mar 21, 2014 - 6:55 AM - George Comment Link

    Very nice writeup, thanks a lot for your work!

    Reply

    George

    • Mar 21, 2014 - 10:54 AM - hans Comment Link

      Thanks George! I very much appreciate that. 

      Reply

      hans

  • Mar 21, 2014 - 7:44 PM - willy Comment Link

    Great Job. Love the structure of the tutorial very organized and also very informative. I just wanted to point out that if someone doing this with some of the ws2811/ws2812 that are inverted is just a matter of reading the source code you provided and they’ll be able to figure out that NEO_GRB has to be replaced with NEO_RGB. Like i said you provided this information on the source code, i just didn’t read the source code as the part of the article. Again thank you very much for this Great guide as a result you are one of the websites i will be adding to my TT-RSS

    Reply

    willy

    • Mar 22, 2014 - 10:16 AM - hans Comment Link

      Thanks Willy for the compliment and contribution. 

      Always nice to hear that my work is appreciated. Good tip on the RGB vs GRB LEDs! I haven’t run in the RGB ones yet, but I recall reading about it.
      I’m not sure what your TT-RSS is, but if you’d like I can add the link here as well.

      Thanks again! 

      Reply

      hans

  • Mar 24, 2014 - 4:11 AM - Nils Comment Link

    I want to share an experience. As you know i use XBMC on Windows. So boblightd has to operate on windwos too. I use this HOW-TO http://forum.xbmc.org/showthread.php?tid=151559.&nbsp;

    Please note that boblightd.exe can not handle comma. So it crashes at start with no error message. If you have created your boblight.conf with the (awesome) Boblight Config Maker you have to replace every comma in the [light] section with a dot. Now it works fine so far …

    Puh . It took me a few hours to find the error 

    Reply

    Nils

    • Mar 24, 2014 - 11:23 AM - hans Comment Link

      Thanks Nils! 

      That’s VERY good info, I didn’t know that boblightd under Windows would not be able to handle a comma.

      I’ll try to release a new version of Boblight Config Maker, either today or tomorrow, where it defaults to a period, but users get the option to override it and choose a comma if they prefer.

      Awesome!

      Reply

      hans

  • Mar 24, 2014 - 12:44 PM - Nils Comment Link

    Another topic. How can i speed up the lights the best way? boblight.conf or xbmc boblight addon config or arduino sketch?? What do you think of the fast and slow presents in the xbmc boblight addon?

    Reply

    Nils

    • Mar 24, 2014 - 2:04 PM - hans Comment Link

      The “best” way to speed up the lights … I’ve been tinkering with that as well. 

      I found rate and interval to be most significant in boblight.conf.

      My findings:

      – XBMC: Disable ALL Add-ons

      My XBMC computer is tiny and slow, so giving more resources available to the boblight plugin did make a difference.
      Even disable the Add-ons that you think might not run during video playback.

      – XBMC Boblight Config: Fast/Slow

      I have only seen that the color refresh is better when using “Fast” (I use only fast). However, in some setups this might result in annoying color flickering, hence the option “Slow”. But that’s just my 2 cents.

      – Sketch: #define SHOWDELAY 200 

      Delay in micro seconds before showing the next sequence of colors. I think this is already a very low value (the lower, the faster). I managed to get it to work with a value of 0 (zero) but it proved unstable with the large amount of LEDs that I have.

      – Sketch: #define BRIGHTNESS 90  

      This sets the max brightness of your LEDs. Now this is just speculation, but maybe a lower brightness makes thinks faster as well. After all it take a few milliseconds for the LEDs to reach full brightness. Then again – this might also be a none-sense assumption.

      – boblight.conf: interval 

      This is the “refresh” delay (as I understand). The higher the number, the slower the refresh. It did make a difference for me, but I’m not sure if a number lower than 20,000 will make a big impact (I couldn’t see any). 20,000 stands for 50x per second,

      – bolight.conf: rate

      I have tried low rates (9600) and high rates (460800). I did notice in my setup lag with 9600, but I think this also depends on how many LEDs you have. I have 290 LEDs (x3 channels), so the amount of data is pretty big. Others (Dave) reported no difference (he uses less LEDs).

      – boblight.conf: delayafteropen 

      I have played with this and I’m not sure what it really does. The docs say that it’s the delay between Arduino boot and first data. I played with this as well and basically found two scenarios: it works or it doesn’t.

      – boblight.conf: threadpriority

      See this explanation at the boblight wiki.
      It seems that you can set the thread priority for boblightd (1 to 99). I’ve tried 1 and 99 and didn’t notice a difference.
      Most articles/discussion I see about bolightd do not even mention this variable (set in the [device] section).
      As I understand, the “user” that runs boblightd needs certain access right to make a difference and that just went over my head.

      – Power Supply

      My initial power supply was only 3A, where as (see calculations above) that was definitely not enough and the LEDs had a hard time keeping up (not to mention the “glow-in-the-dark” power supply).

      Reply

      hans

      • Mar 25, 2014 - 3:38 AM - Nils Comment Link

        Thanks for the detailed info. 

        Yesterday i finished my setup so far. Its realy great. I use the WS2812B strand with 185 LEDs. Now i want to tweak and try some things. For example i want to power my LEDs at the beginning and at the end, because at the end the LEDs are less whiter than at the beginning of the strand. 

        Reply

        Nils

        • Mar 25, 2014 - 4:00 AM - Nils Comment Link

          Edit: Maybe i will add a photoresistor as a lightsensor to the arduino setup. So Ambilight only works in a appropriate darkness 

          Reply

          Nils

        • Mar 25, 2014 - 9:41 AM - hans Comment Link

          Interesting: I have the same problem, where the LEDs at the end are less white (more yellow). I thought this might have to do with the fact that the last few strands are from a different brand (it seems). Maybe this is why I have seen some folks have multiple data pins in use?

          You could indeed use a lightsensor, poll it every so many seconds and make the “#define BRIGHTNESS 90” a variable instead, which you change based on existing ambient light. I’d guess you want to crank it up when it’s lighter in the room (to see the effect) and tone it down when the room is darker? A simple photoresister would do the trick. Not sure though if this would give you a refresh penalty or not.

          Reply

          hans

          • Mar 26, 2014 - 3:49 AM - George Comment Link

            I had the same problem with the strand being off white near the end. Connect the + and – also to the end of the strand and all LED’s are the same color. I use 214 2812B LED’s and a 5V10A powersupply and it works fine.

            George

  • Mar 26, 2014 - 3:48 AM - George Comment Link

    I was having trouble connecting Boblightd to my Arduino, mainly because on every reboot my Arduino got a new ID. At boot it could be ttyACM0, next time it could be ttyACM1. I have multiple serial devices connected to my USB-ports, so that’s why. If you’re having the same problem you can write an UDev rule, like this one:

    SUBSYSTEM=="tty" ATTRS{manufacturer}=="Arduino*" SYMLINK+="arduino"

    On my Ubuntu 13.10 I have this placed as 10-arduino.rule in /etc/udev/rules.d. If you change the boblight.conf file to /dev/arduino it’ll work fine. 

    Maybe this helps someone in the future.

    Reply

    George

    • Mar 26, 2014 - 10:23 AM - hans Comment Link

      Thanks George for the excellent info!
      Most certainly helpful for other that run into this issue. 

      This seems Linux/Ubuntu specific, and I had never heard of UDev rules before, so here is a reference for who is interested “Writing UDev Rules” or “Hack-a-day: How to writ UDev rules“. I’ll add the device “arduino” to my Boblight Config Maker as well.

      Reply

      hans

  • Mar 29, 2014 - 10:40 AM - Nils Comment Link

    Have you tried the present “custom” in the boblight addon settings. 

    My setting is:

    speed: 65

    autospeed: 0

    saturation: 2.5

    value: 4

    thresthold: 10

    Now dark scenes are more atmospheric and lighter scenes also look better. These are not my finale settings. Maybe you can try a little bit so we can share our settings. Here you can find the original settings for preset “slow” and “fast”: https://github.com/bobo1on1/script.xbmc.boblight/blob/master/script.xbmc.boblight/resources/lib/settings.py#L105

    Reply

    Nils

    • Mar 29, 2014 - 11:34 AM - hans Comment Link

      Thanks Nils – I’ll give it a try tonight!
      (I always do my testing when it’s dark outside so I can see the differences better)

      I’m curious how “exchangeable” these settings will be. I can image it depends on a lot of factors, like the conversion in the Arduino, the manufacturer of the LEDs, boblight.conf settings, and the LED model. But I’ll give it a try, shouldn’t be too hard to do right?
      What kind of % did you use for the LED depth? I’m running at 5% now.

      Reply

      hans

      • Mar 30, 2014 - 5:19 AM - Nils Comment Link

        Columns: 3%

        Rows: 5%

        I’m curious about your settings ;)

        Reply

        Nils

    • Mar 29, 2014 - 11:20 PM - hans Comment Link

      You’re right about your setting – seems to blend better with the actual video. 

      I’m playing a little with the settings now and boy do I have the clicking around to go from play back of a video, to changing a few settings – do you happen to know w “shortcut”? 

      Reply

      hans

      • Mar 30, 2014 - 12:49 AM - George Comment Link

        If you put this 

        https://raw.githubusercontent.com/bobo1on1/script.xbmc.boblight/master/script.xbmc.boblight.keymap.xml

        in your “userdata/keymaps” folder (under the xbmc homefolder) you can press B of b on your keyboard to open the addon settings.

        Me, I have mapped a key of my remote control to open the addon setings by changing the remote.xml in my “userdata/keymaps” folder to this, when I press the blue key on my remote it opens the addons settings dialog

        <FullscreenVideo>
            <remote>
              <blue>Addon.OpenSettings(script.xbmc.boblight)</blue>
            </remote>
          </FullscreenVideo>

        Reply

        George

        • Mar 30, 2014 - 5:21 AM - Nils Comment Link

          Nice tip . Maybe you can share your settings too

          Reply

          Nils

          • Mar 30, 2014 - 12:25 PM - George Comment Link

            Of course, but I doubt you can use the same settings :-) I have 2812B LED’s, before those I had 2801’s but I like the 2812B’s a lot more. 

            TV Shows: 
            autospeed: 0 / interpolation: off / saturation: 1.5 / speed: 60 / threshold: 10 / value: 12
            Movies:
            autospeed: 0 / interpolation: off / saturation 0.4 / speed 70 / threshold: 20 / value: 12

            I’m not finished experimenting with these settings, but for now they’ll do.

            George

          • Mar 30, 2014 - 12:32 PM - hans Comment Link

            Glad to hear that you like the WS2812’s better as well … I didn’t try the 2801’s yet, but after your feedback, I won’t try them  – thanks!

            hans

        • Mar 30, 2014 - 11:05 AM - hans Comment Link

          Thanks George! Great tip! I’ll try this for sure! 

          Reply

          hans

  • Apr 2, 2014 - 3:16 AM - George Comment Link

    Maybe it’s nice for future reference to state in your text that the prefix in your Arduino code is static. If you use your Boblight Config Maker you’ll have to calculate a new one like in this post. There was someone on the XBMC forums who needed a little help figuring that out and I don’t think he’ll be the last.

    (or, if you’re up to a little challenge add an option to your tool  )

    Reply

    George

    • Apr 2, 2014 - 9:57 AM - hans Comment Link

      Hi George!  

      I’m not sure what you mean, … 

      As far as I know, nothing is done with the prefix, so these calculations (to me) look pretty useless.

      The only purpose of the prefix is to have a sequence of numbers that will hopefully be unique and distinguishable from the color data (so we can find a starting point). The Arduino sketches I have seen so far, do only one thing: wait for the prefix and when it arrives start repeating all incoming colors to the LED strip.  

      The length of the prefix doesn’t even matter, as long as the prefix in your Arduino Sketch is identical to the prefix in your boblight.conf.
      Although: a too short a prefix of course has a higher chance to match color data by coincidence.

      Or are there setups that require this and maybe to never have to reprogram the Arduino and pass the number of LEDs this way?
      It is most certainly something I could add …

      Note : After studying the AdaFruit Arduino Sketch, I noticed that this is indeed what they do. I’ll take note of it and will try to add it.

      For my own reference, since I won’t get to it today, I’ll paste the example code here:

      int N_LEDS = 25; // Max of 65536
      void setup()
      {
        byte[] buffer = new byte[6];
        noLoop();
        // A special header / magic word is expected by the corresponding LED
        // streaming code running on the Arduino. This only needs to be initialized
        // once because the number of LEDs remains constant:
        buffer[0] = 'A'; // Magic word
        buffer[1] = 'd';
        buffer[2] = 'a';
        buffer[3] = byte((N_LEDS - 1) >> 8); // LED count high byte
        buffer[4] = byte((N_LEDS - 1) & 0xff); // LED count low byte
        buffer[5] = byte(buffer[3] ^ buffer[4] ^ 0x55); // Checksum

      print("Prefix for "+N_LEDS+" LEDS: ");
      for(byte b : buffer)
         print(" "+hex(b));
      exit();
      }

      Thanks for this good suggestion! 

      Reply

      hans

  • Apr 4, 2014 - 12:38 PM - Nils Comment Link

    Is it possible to get boblight running while the screen shows only a test image?

    Reply

    Nils

    • Apr 4, 2014 - 2:08 PM - hans Comment Link

      If you’re looking for a still image:
      You could try the demo video (T4A AmbiLightTest – scroll up to download the tiny MP4 file, only 1.7 Mb).
      Let it play to whatever you’d like to see and press pause on XBMC. This will stay for a bit until your screensaver kicks in (maybe adjust timing or even disable the screensaver).

      Unless you mean: Start displaying something and then start Boblightd.
      I suppose if that’s what you’re trying to do, that it would come with all kinds of initialization complications (Arduino and Bobolightd), so I’m not sure if that would be an option.

      Reply

      hans

      • Apr 5, 2014 - 6:48 AM - Nils Comment Link

        I just made my own test video like yours . I try to calibrate my gamma settings. 

        My video shows two images. One with 100% white and one with 50% white (grey). The big problem is that the LEDs don’t change. They see both as 100% white. Can someone confirm ths issue?

        Reply

        Nils

      • Apr 5, 2014 - 10:45 AM - hans Comment Link

        Cool  …

        I’ve noticed as well that going “black” seems to be a hurdle at times, my guess is that the difference between 50% grey and 100% white is too little for boblight to pickup. Meaning: it’s all kind-a white-ish ….

        I noticed the same issue with my own video (vert/horz bars). That needs some time to experiment with though. I thought Gamma or Threshold would do this for us, but since you’ve already been testing with it … maybe not. Or maybe we should look at the gamma in Boblight.conf?

        Reply

        hans

  • Apr 4, 2014 - 5:52 PM - hans Comment Link

    Boblight Config Maker v1.4 was released today …

    Adding resizability and an optional “Magic Word” calculation (Adafruit).

    Reply

    hans

  • Apr 19, 2014 - 3:05 PM Comment Link
    PingBack: www.pocitac.com

    […] http://www.sedu-board.de/sedu-ambilight/howto-boblightconfigtool/ (na ledky) //www.tweaking4all.com/home-theatre/xbmc/xbmc-boblight-openelec-ws2811-ws2812/ (diy) http://aeparker.com/zphoto/pages/boblight-config-generator (konfigurák, webový) […]

  • Apr 22, 2014 - 9:50 AM - Ivn Comment Link

    Hi!!

    I have a RaspBerry with a OpenElec and I would like to run bobligth, the LEDs I have are these: 

    http://www.aliexpress.com/snapshot/293681677.html

    I have followed all the steps in the tutorial but did not even come on.

    It may be for the charger? 5V 2A –>  http://www.dx.com/es/p/5v-2a-universal-power-adapter-charger-black-ac-100-240v-eu-plug-3-5-x-1-35mm-157728#.U1aBEPm2nJE

    I have 50 LED., and Arduino Mega

    I’m frustrated :p

    Sorry if my english is bad, I’m Spanish

    Reply

    Ivn

    • Apr 22, 2014 - 10:20 AM - hans Comment Link

      Hey Ivn,

      You’re English is fine …  

      First thing I did was test each strip based on the “Arduino and WS2811/WS2812 LEDs“, just to make sure there were no dead ones in the strands (of the 5 strands I eventually found 2 dead WS2812’s – which can stop the following LEDs from lighting up).

      For this test you’ll only need your computer, Arduino and LED strands. No Raspberry Pi or OpenElec.

      If you’re sure they all work (I tested with a 2A power supply for each individual strand of 60 LEDs, so I would think that yours should be OK when testing your LEDs), then start assembling them (I don’t know if you have just one strand or multiple).

      If everything still works: With the Arduino code I’ve used, even when not controlled by BobLight, the LEDs should do a swipe at initial start, switching each LED one at a time on.

      In any of these cases, if the LEDs do not switch on; 
      – Double check power connections,
      – Double check that you’ve connected the right end for the Data pin (on strips it’s indicated with an arrow, pointing away from your Arduino),
      – Test with another power supply if you have one, even if it’s just for a few seconds to see if it works or not,
      – Bypass the 1st LED if needed, just to make sure.

      As for controlling all this through a Raspberry Pi: I have seen people where this worked, sometimes a little slower than desired. But at least the LEDs should light up initially.

      Hope this helps ….

      Reply

      hans

  • Apr 23, 2014 - 3:46 PM - Mark Comment Link

    Please help.

    I have led strip ws2812b 1meter 60 led.

    I recorded a library Adafruit NeoPixel (If you run strandtest led strip working)

    I recorded T4a Boblight (led strip shine white color)

    In xbmc i installed boblight

    I do not know how to “boblightd”  ,i have windows 8. I tried in  AmbiBox led shine white and nothing happens.

    Boblight Config file I created.Where do I copy it?

    Thank you for any advice.

    Reply

    Mark

    • Apr 23, 2014 - 4:44 PM - hans Comment Link

      Hi Mark,

      “boblightd” should  automatically come with the XBMC plugin, so I don’t think we need to worry about that, even under Windows.
      There is a second addon I used for XBMC config. The plugin I installed was OpenElec specific, so I’m not sure if there is one with a regular XBMC setup (I would assume so though).

      As for your LEDs not responding, I’d first check that your set the right “device” in your BobLight Config file, it will be different under Windows (when you run Boblight Config Maker, you’ll see a drop down with quite a few examples).

      Next, for where to store the config file: Under Windows 8, the Userdata folder should be “%appdata%\XBMC\userdata\” (see this XBMC Wiki page) which is usually something like this:

      c:\Users\<username>\AppData\Roaming

      (where <username> is of course your username. If not sure, then you can try in a DOS box: cd %appdata%)

      The plugin(s) I used created a special folder for addon data (called “addon_data”), this might be different under Windows.

      It can also be that boblight is installed in c:\boblight (see first article in list below), and the config file should be in that directory.

      Additional info that I found:

      The first 2 will help you find the device name, some Windows specifics, etc.
      Oh and before I forget; some Arduino boblight code uses a calculation to determine the prefix. The T4A code you’ve installed on your Arduino does not require this calculation, but the prefix must match the one in the code.

      Reply

      hans

  • Apr 24, 2014 - 5:41 AM - Mark Comment Link

    I do not really know what is wrong.Maybe not cooperate in T4a Boblight.

    There is also a different code boblight.ino what works from ws2812b?

    will react LED in program AmbiBox ?

    Reply

    Mark

    • Apr 24, 2014 - 9:24 AM - hans Comment Link

      Since everything work with the simple strand test and when you power the Arduino on, I’d say there are a few possibilities:

      1) Location of Config file
      2) Proper device name (often called something like “/dev/comx” where x is the number of the com port)
      3) Proper prefix (for T4A you’ll need to use the same prefix in the config as defined in the sketch)
      4) Matching speeds for the “serial” communication (Arduino and Conf file must match)
      5) Boblight must be installed (see links in my previous response).

      Unfortunately, I’m not familiar with the technical details of AmbiBox.
      I’m sure there are other examples out there, and the few that I tried worked. 

      Note: With some sketches a calculated prefix is being used, so use Boblight Config Maker to calculate that magic number.
      Bottom line with the prefix is that the one in the config must match the on in the Arduino sketch, even if you make up your own.

      Reply

      hans

  • Apr 24, 2014 - 11:09 AM - Mark Comment Link

    So here it comes

    Error was that I had a bad “/dev/comx”

    Thank you for your help.

     

     

    Reply

    Mark

  • Apr 27, 2014 - 4:27 AM - Mark Comment Link

    So I got another problem:

    Arduino after some time disconnect.Ambilightd report bugs:

    (CClientsHandler::ParseSet)     127.0.0.1:49205 priority set to 128
    (CClientsHandler::ParseSet)     127.0.0.1:49205 priority set to 255
    (CClientsHandler::ParseSet)     127.0.0.1:49205 priority set to 128
    (CDeviceRS232::WriteOutput)     ERROR: AmbiLight: /dev/com4: write() Permission
    denied
    (CDevice::Process)              AmbiLight: closed

    Then I have to pull the USB cable and reconnect.But after some time again disconnect.

    You do not know what could be wrong?

    Thank you for your advice.

    Reply

    Mark

    • Apr 27, 2014 - 9:38 AM - hans Comment Link

      I do not have a Windows setup, but what could be the problem is timing, as the USB port (serial) might be “in use” when Boblight tries to write to it.

      Some ideas:

      – Increase the “interval” value in boblight.conf
      – Decrease the baudrate (rate in boblight.conf and baudrate in the Arduino sketch)
      – Increase “showdelay” in the Arduino sketch

      I’d start with increasing “interval” though, start with something significant like twice the current value (you can always work your way down).

      Reply

      hans

  • Apr 28, 2014 - 5:43 AM - Mark Comment Link

    I guess I found the error in the com.I played from the USB port settings and I changed the baud rate.After restoring factory settings already are not separated.

    Thank you for your advice.

    Reply

    Mark

    • Apr 28, 2014 - 8:25 AM - hans Comment Link

      Awesome! Glad to hear it working now  

      Reply

      hans

  • Apr 29, 2014 - 4:08 AM - blacky Comment Link

     I have a stripe of 40 rgb leds WS2811 and the problem is that three of them allways stays red. Of course flashes the other colors when needs but i dont understand why are allways on….. I have a DC power supply 5V ,1000mA. is there any posibility i would need to connect any resistor?. Excuse my bad english! And thank you for any advice!

    Reply

    blacky

    • Apr 29, 2014 - 9:45 AM - hans Comment Link

      The first 3 always on, well, that can have several reason.

      I’ve found that not all strips are perfect, in my strips a few LEDs simply didn’t work, or didn’t relay data to the next LED. I had to remove those. If you have more than one strip; connect another strip in stead and see if it happens with that one too. If not; your first 3 LEDs might be defective.

      (your English is fine )

      Reply

      hans

  • May 2, 2014 - 5:07 AM - Nils Comment Link

    Hi,

    i tried to calibrate my WS2812b with a guide from a german forum (http://www.computerbase.de/forum/showthread.php?t=1030747&page=63   #1257). It realy looks a lot better than before. The colors are nearly the same as my TV. Here are my settings for the boblight.conf:

    name            red
    rgb FF0000
    gamma 2.47
    adjust 0.85
    name green
    rgb 00FF00
    gamma 2.58
    adjust 1.0
    name blue
    rgb 0000FF
    gamma 2.50
    adjust 0.63

    and for boblight addon

        <setting id="movie_autospeed" value="0.000000" />
        <setting id="movie_interpolation" value="false" />
        <setting id="movie_preset" value="0" />
        <setting id="movie_saturation" value="1.500000" />
        <setting id="movie_speed" value="65.000000" />
        <setting id="movie_threshold" value="15.000000" />
        <setting id="movie_value" value="2.0" />
    Reply

    Nils

    • May 2, 2014 - 8:14 AM - hans Comment Link

      Thanks Nils – That’s actually a good article/post (and Windows application) in this German forum to calibrate Boblight colors.
      I repost the direct link here one more time, so it jumps straight to the post that matters the most: link.

      Reply

      hans

      • May 23, 2014 - 12:30 AM - Russ Comment Link

        Any chance there’s an english write-up anyone knows about?  I finally got back to my RasPi project, have it overclocked to 900Mhz now and the lights are working but the colors are definitely not very accurate.

        (running via Arduino Mega @ 115200kbps btw – couldn’t get any reliable connection at a higher baudrate)

        Reply

        Russ

      • May 23, 2014 - 7:15 AM - hans Comment Link

        Hi Russ,

        From playing with my own setup: de connection speed doesn’t need to be all that high it seems, unless you have a LOT of LEDs … With 290 LEDs, I’ve had good experiences with lower speeds.

        How inaccurate are the colors?
        – I know, even with a faster computer, that the colors lag a little (a few milliseconds) and
        – the base settings can be tunes with XBMC Boblight Config (see some of the comments here). 

        Of course, the color settings can also be adjusted in the boblight.config, but I’ve found that quite hard to do.

        Are you running RaspBMC or OpenElec on your Raspberry Pi?

        Reply

        hans

        • May 23, 2014 - 1:38 PM - Russ Comment Link

          OpenELEC on the pi for me.  I’ll try messing around in the settings to see if I can speed it up some.  The delay is fairly noticeable.

          As for the colors, they seem a ways off, but I haven’t calibrated in any fashion yet.  They’re not even mounted on my TV yet.

          Reply

          Russ

        • May 23, 2014 - 2:36 PM - hans Comment Link

          I haven’t run into this, but if the colors are WAY off, check weather your LEDs use RGB or GRB – some LEDs have a different color sequence.

          Look at lines 31-34 of the Arduino sketch. (NEO_RGB vs NEO_GRB)

          Reply

          hans

          • May 26, 2014 - 11:23 PM - Russ Comment Link

            Hey Hans,

              That was actually one of the first things I had to fix.  I set the static backlight to green and realized it wasn’t displaying correctly.  re-programmed the arduino and it started working.  The problem was more with the settings for saturation and such.  I’m playing with them now.
              I got the RasPi up to 1100Mhz with heat sinks and cooling, and it still can’t keep up and run the boblight application smoothly.  So it looks like I’m going back to using my HTPC.  I’ve switched the cabling over to my OpenELEC PC and it runs like a champion.  Thanks for having a great write up on the setup as well as the software you created.  It had made altering my setup as it developed much easier.
               If anyone has a good write up for how to dial in the Gamma/Adjust/Blacklevel settings to get the most accurate coloring/smooth changes, I would love to give it a read… I just need it to be English please!

            Russ

          • May 27, 2014 - 9:59 AM - hans Comment Link

            Hi Russ,

            Yeah, I played with the Raspberry Pi for a bit, for OpenElec, an for regular use it works OK. I haven’t tried Boblight with this but I’d assume that it might be pushing it a little bit. I’m assuming you’ve already tested wit zero (other) plugins and Confluence skin … for Max resource availability.

            As far a tuning Gamm etc: I’d have to guess that there will be no one-fits-all solution. Each TV and each LED will display colors slightly differently (for example: some of my LED strands are more yellow than others when displaying “white”).

            If you run into an article (anyone for that matter), then please post the link here 

            hans

  • May 6, 2014 - 9:57 PM - Guðjón Guðjónsson Comment Link

    I wish I would have stumbled on your page before I started my adalight project.

    This is the best page on the net about Arduino and LED’s, not to talk about your software witch is so cool.

    p.s Do you use your Mac for adalight and what software do you use for it?

    Thank you very much :)

    Reply

    Guðjón Guðjónsson

    • May 6, 2014 - 11:09 PM - hans Comment Link

      Thanks Guðjón, I very much appreciate the great feedback! 

      I actually have my Boblight connected to a little AMD box that runs OpenElec (Linux).
      I did test my other Arduino sketches with the LEDs on a Mac though, just never ran boblight on my Mac (I know it’s available for the Mac though).

      Glad you like the app as well … I developed in Lazarus Pascal on my Mac and then recompiled under Windows and Linux. Love my Mac .

      Reply

      hans

  • May 7, 2014 - 5:41 PM - Guðjón Guðjónsson Comment Link

    Thanks for reply.

    I tried to day Prismatik.app on my Mac mini and that works well with vlc and xbmc. It is however a bit resorce hungry for my 2010 Mac.

    If you have time,what are the advances of using WS2812/WS2811 LEDs instead of 2801 in adalight.

    Thanks.

    Reply

    Guðjón Guðjónsson

    • May 7, 2014 - 5:53 PM - hans Comment Link

      Hi Guðjón,…

      Thanks for the tip! Did you ever try Boblight? (it’s available for MacOS X, Windows and Linux)

      I think the biggest difference between the 2801 and the 2811/2812 can be found in the way timing works. The 2811/2812 has timing build-in, where as the 2801 requires you to handle timing. As I understand from others, the 2811/2812 is more reliable when it comes to addressing individual LEDs. The timing is the reason why the 2811/2812 can be more of a challenge, for example on a slower computer (if you’d skip the Arduino and use for example the GPIO of a Raspberry Pi).

      The 2811/2812 also seems to use less power (but only a little bit less). 
      2801 uses 4 wires and the 2811/2812 use only 3.
      Some claim the 2801 is more expensive, even though it’s an older model, although I cannot really confirm that.
      Some people say that the 2811/2812 can be used for longer distance, again, can’t confirm that.

      That’s about all I know – so if you would have 2801’s and they work for you: perfect.

      Bottom line: I don’t think it matters much which one you pick …

      Reply

      hans

  • May 7, 2014 - 6:35 PM - Guðjón Guðjónsson Comment Link

    Thanks for that.

    I have tried Boblight on my Enigma2 satellite receiver that I have (linux based) and it works well there ,if I do not go over 10 fps.

    I am still trying to figure  out if I need another dedicated computer to feed xbmc on the mac or if I need to find local server for it.

    There is a difference if I look at the same test video. It seems much more accurate and more responsive from the Lightpack/Prismatik software.

    I am using 2801.

    Reply

    Guðjón Guðjónsson

    • May 7, 2014 - 8:14 PM - hans Comment Link

      Sounds like Boblight is less resource hungry then?

      Reply

      hans

      • May 7, 2014 - 9:38 PM - Guðjón Guðjónsson Comment Link

        Yes it seem so.

        I have only had this running for few days now (took me long time to get them to light up) so still tweaking and trying different things.

        Reply

        Guðjón Guðjónsson

  • May 9, 2014 - 5:36 PM - Mark Comment Link

    What is my value data prefix for 60 led?Now im using 41 64 61 00 18 4D.

    Reply

    Mark

    • May 10, 2014 - 8:55 AM - hans Comment Link

      The default value depends on the Arduino sketch you’re using.

      The T4A Sketch has a fixed prefix, no matter how many LEDs you use:

      const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D};  // Start prefix

      I have seen AdaFruit code that does expect a calculated code. For 60 LEDs it’s something like “41 64 61 00 3C 69”.
      Boblight Config Maker (link) has the ability to automatically calculate that for you.

      Reply

      hans

  • May 12, 2014 - 11:51 AM - Nils Comment Link

    I have a new problem. Maybe you can help me. If i set gamma values (e.g. 2.0) in the boblight.conf, the ambilight starts to flicker. It is seen clearly at the end of your test video.Is there something i can do?

    Reply

    Nils

    • May 13, 2014 - 7:54 AM - hans Comment Link

      Hi Nils,

      I haven’t experimented with the gamma just yet. In my Boblight config, I leave everything “default” and tune the colors in the XBMC Config add-on instead. I would have to guess that too much Gamma Correction makes colors either way too dark or way to bright. If too much dark, then Boblight might calculate that to black more often than desired and the LEDs will flicker.

      Reply

      hans

  • May 19, 2014 - 5:21 AM - Ivn Comment Link

    Hi!!

    Is compatible with the RaspBmc distribution??

    Thanks!!

    Reply

    Ivn

    • May 19, 2014 - 7:50 AM - hans Comment Link

      Hi Ivn,

      I have not tested this, but considering how Boblight works, I’d have to guess that it very likely will work just fine.

      If you plan to test this, then please let us know  

      Hans

      Reply

      hans

  • May 30, 2014 - 5:18 AM - Ivn Comment Link

    Hello Hans (another time),

    I received the leds (http://www.aliexpress.com/snapshot/6085107505.html), I have tryed with the demo and works fine, but with the application not. I have Arduino Mega connected by USB and I have followed the steps in the tutorial, what is the problem? Could you help me?

    In this picture you can see that all LEDs are white, except the firsts one. https://pbs.twimg.com/media/Bo3rnoRIgAAbaOM.jpg:large

    Part of the problem is that the message “can´t connect to boblight” displays every 5minutes, more o less, alternated with “connected to bobligth”

    Reply

    Ivn

    • May 30, 2014 - 7:20 AM - hans Comment Link

      Hi Ivn! 

      Can’t connect to Boblight indicates communication issues … typically:

      – Device settings in the the boblight.conf file (device type, speed)
      – Speed settings in the Arduino sketch

      Maybe select a lower speed.
      You also might want to verify the cable used between XBMC and the Arduino. 

      Reply

      hans

      • Jun 7, 2014 - 12:44 PM - Ivn Comment Link

        Hi Hans (Yes, it’s me again… :p)

        The problem could be the prefix??

        This is my configuration, there is something wrong?

        http://subefotos.com/ver/?48e0a9bb1b8f1f5092a734b58a57adb2o.png

        Thanks another time!!

        Reply

        Ivn

        • Jun 7, 2014 - 12:49 PM - Ivn Comment Link

          Ahhh I forgot this is my .config:

          [global]

          interface 127.0.0.1

          port 19333

          [device]

          name AmbiLight

          type momo

          output /dev/ttyACM0

          channels 225

          prefix 41 64 61 00 18 4D

          interval 20000

          rate 115200

          debug on

          delayafteropen 100000

          Reply

          Ivn

        • Jun 7, 2014 - 6:35 PM - hans Comment Link

          Hi Ivn  …

          If you’re using my Arduino sketch, then the prefix is correct in your config.

          These parameters:

          [device]
          type momo
          output /dev/ttyACM0

          depend on the OS you’re using (the example works for OpenElec, which is Linux based).

          Windows users and different distro’s might use different device “type” and/or “output”.

          Reply

          hans

          • Jun 8, 2014 - 9:59 AM - Ivn Comment Link

            Hi Hans,

            Thanks for your response, I’m using Raspberry (Last OpenElec Release) + Arduino Mega.

            I’m going back to check the tutorial in case I missed something.

            Thanks!!

            Ivn

          • Jun 10, 2014 - 4:18 AM - Ivn Comment Link

            Hi Hans,

            I have seen the log file that boblight sends data to 0. 

            Example: 41 64 61 00 18 4D 00 00 00 00 00 00 00 [more] 

            I think this is the problem. It may be some component boblight?

            Thanks!!

            Ivn

          • Jun 10, 2014 - 7:34 AM - hans Comment Link

            Hi Ivn,

            I’m not sure about all those “00” values … seems it’s all “black”.

            Either your config file uses a margin that is too narrow, or something is wrong with your Boblight add-on.

            Try reinstalling the Boblight add-ons (both).
            If that doesn’t work: increase the margin % in Boblight Config Maker.

            hans

          • Jun 12, 2014 - 2:58 PM - Ivn Comment Link

            Hi Hans,

            I put the RaspBmc distribution and what is my surprise that is not the boblight addon.  

            Is possible to install from a zip? Or other possibility?

            Thanks!

            Ivn

          • Jun 13, 2014 - 6:42 AM - hans Comment Link

            I have the impression (which could be wrong) that OpenElec works just as well or even better than RaspBMC – the distribution uses a much slimmer Linux version. Did you try it?

            I am however surprised there is no Boblight plugin for RaspBMC, maybe you need to use the default XBMC plugin?

            You can download it for free at OpenElec.tv.

            hans

  • Jun 14, 2014 - 2:23 PM - Mark Comment Link

    Hi i have another problem.Some movies in the format 21:9 does not light up and down the strip of LED.They do it only for a few movies 21:9.You do not know what it is about problem?

     

    Reply

    Mark

    • Jun 15, 2014 - 7:12 AM - hans Comment Link

      Hi Mark,

      I assume that with a 21:9 video, you might have black bars at the top and bottom.

      I was under the impression that Boblight compensates for that when the black bars are not part of the video file. Now if those black bars are part of the video, then Boblight might not identify them as such and consider them real video. These are just assumptions of course, I could be wrong. But if this is the case, you may want to test a version of the video file without the black bars and see if it makes a difference?

      I noticed that when the video does not have these bars that Boblight is not influenced by these black bars, even though you’ll see them on your TV ie. playing a 4:3 video on a 16:9 TV.

      Reply

      hans

  • Jun 16, 2014 - 4:37 AM - Mark Comment Link

    They do it only for some video.Moreover, 21:9 and 4:3 video sulfide right.I guess the problem is in the actual video.

    Reply

    Mark

  • Jun 18, 2014 - 6:10 PM - Jeff Comment Link

     

    Hi 

    I’m using  window 8.1 with Xbmc  12.3.  I done every thing on the tutorial . I test the the led light working fine . the only problem i get with boblight.conf where i put it exactly

        i need help on window 8.1 plz plz plz

    Reply

    Jeff

    • Jun 18, 2014 - 7:08 PM - hans Comment Link

      I hope there are some Windows users out there that can confirm this, but last time I looked it up I thought it was placed in a boblight folder that can be found in the root of your C: drive (ie. C:\Boblight). This directory should exist if you installed Boblight correctly.

      Go through the other comments and (if I recall correctly) you should find some links to Windows related setups …

      See for example these comments

      Reply

      hans

  • Jun 18, 2014 - 6:17 PM - Jeff Comment Link

    # config file created with BobLight Config Maker v.1.0
    # (C) Hans Luijten – //www.tweaking4all.com
    # Orientation naming as seen from the REAR of the TV
    # Date: 6/18/2014 15:33:14

    [global]
    interface 127.0.0.1
    port      19333

    [device]
    name            AmbiLight
    type            momo
    output          /dev/com3
    channels        600
    prefix          41 64 61 00 18 4D
    interval        20000
    rate            460800
    debug           off
    delayafteropen  100000

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

    [color]
    name            green
    rgb             00FF00

    [color]
    … code remove …

    Reply

    Jeff

  • Jul 5, 2014 - 4:20 AM - Seyhun Comment Link

    Hi. I have another question out this. I built the system and checked it with my raspberry I think it works. when I checked with test video it seems okay. I think I need to make same tries to make config better. but because of my rasp its old one (256 ram) can’t play hd videos well. I want to port this system to Ouya XBMC. Is it possible ? I found the Boblight in addon but I couldn’t found the boblightd to give a command. Is there anyone send me to boblightd as a zip to install it manually. regards.

    Reply

    Seyhun

    • Jul 5, 2014 - 8:39 AM - hans - Author: Comment Link

      Hi Seyhun!

      I’m not familiar with any of the Android systems that run XBMC, but I would imagine bolightd exists for those as well. Although, most of these systems are just not all that powerfull it seems, so maybe not … ?

      If you’re investing in hardware, I’d consider an AMD or Intel based system. They’re in the same price range or a litle bit more expensive, but so much more flexible …

      Running Boblight on a Raspberry Pi might indeed be pushing it … I have a few A models as well, but I thought they would do 1080p, a little over-clocking might help. 

      I bought this little Foxconn computer at Amazon for $175 at the time (Dec 2011).
      You’ll need to add memory and a disk though, which I both had laying around.
      And I’m sure there are comparable models available … for example from Zotac.
      My second XBMC box is Intel Atom based which runs very stable as well (it’s even fan-less so super quiet) – but I can’t find it at Amazon anymore.

      Reply

      hans

      • Jul 5, 2014 - 10:25 AM - Seyhun Comment Link

        Dear Hans

        thanks for your prompt answer. It seems using intel or amd  based pcs are better. also I have planto buy something zotac. by the way I forgot  thanks to you for this great guide.reagrds

        Reply

        Seyhun

  • Jul 13, 2014 - 4:27 AM - Niko Comment Link

    Hi,

    great site great guide. But iam hanging with the sketch upload.

    With the LedStream Sketch from adafruit, it works ok. That means when i upload it to the adurio the Led’s make a light wave ( red,green blue ).And in xbmc it works.

    But if i upload your sketch the Leds keep black, and in xbmc they are without any funktion.
    I have massive problems with the LedStream Sketch in some videos i lose Frames, the drop or the skip and i have jutter.
    So i thought i will try your sketch… but i didnt find the mistake i make.

    Reply

    Niko

    • Jul 13, 2014 - 9:06 AM - hans - Author: Comment Link

      Thanks Niko! 

      I’m not familiar with the LedStream Sketch (got a link?), but a few things you could check

      – Is your setup using the same pin on the Arduino? (line 17)
      – Is the LedStream project using WS2812 as well? (line 34)
      First test: When you power on the Arduino – not connected to XBMC – does it do a white power up swirl? (this is controlled by the Sketch and independent of XBMC/Boblight)

      Reply

      hans

  • Jul 14, 2014 - 4:13 AM - Niko Comment Link

    Hans,

    Link to the sketch that works for me : https://github.com/adafruit/Adalight

    – i testet pin 13 for Data and pin 11, because iam not sure in my setup. But nothing at both testings
    – here the link wich LED’s iam using http://www.aliexpress.com/snapshot/310861220.html
    – When iam power up adurio not connect to xbmc no lights up. ( with your sketch ) if i use the sketch above than it makes a power swirl ( 3 colors drive )

    I know its hard to find out whats wrong, i tried 7 houres with so many options but i didnt come further
    thanks niko

    Reply

    Niko

    • Jul 14, 2014 - 8:33 AM - hans - Author: Comment Link

      Hi Niko,

      since your LEDs do not even light up when you start, we should look at just the Arduino and LEDs.
      Looking at the LEDs you have, then I think that’s the problem … you’re using WS2801 LEDs (according to the link you provided), where as this project is aimed at the WS2811 or WS2812 LEDs. 

      I have zero experience with the WS2801’s … but I do know that the entire interfacing works different than the WS2811/WS2812.
      I’m not even sure that the NeoPixel library supports WS2801’s … 

      Reply

      hans

  • Jul 22, 2014 - 12:27 AM - Russ Comment Link

    Hi Hans,
       I’ve revisited my installation and cleaned up up nicely.  Ordered some quick-disconnect style connectors so I can break apart the strips if I need to do repairs (I installed right to the TV, no frame).   Wanted to say thanks again for the good help you gave me earlier this year with the setup.  I never did get the RasPi to run smoothly. even at 1100MHz overclocked.  So sad.  anyway…

        I’ve got a 3D TV and I’ve discovered that 3D content doesn’t work properly with the config setup.  I’ve been doing some quick reading on how to manually configure the config file to only use the left half of the screen (or right I suppose)  to properly process the side by side video. 

       In OpenELEC there are settings for movies / tv / files so you can have different settings for different modes – I’m curious if you’re aware of a way I could run a setting that will work with 3d video?

    Also – Looking at your arduino code, I’d like to add a function to use an I/O pin to control a relay that powers the LED power supply on/off with the video stream.  I don’t want to have to power it on/off manually each time.  Wondered if you could help me out with that…

    Reply

    Russ

    • Jul 22, 2014 - 9:43 AM - hans - Author: Comment Link

      Hi Russ!

      Glad to hear things worked out for you. But a 1100Mhz overclock, wow! … are you using a heatsink with that? 

      3D is indeed a little weird, I have not tested it yet (not a big 3D TV fan – but my TV does support 3D).
      As far as I understand, Boblight looks at the video file, and would see the whole width as the video feed.
      I think XBMC Gotham has some 3D option, but I never tested any of it.

      Being able to switch on/off could probably be done in the Arduino code.
      Something like checking if a pin is high, and if so, set all colors to black. 
      If not high do the usual thing.

      Something like this when pin 2 would be used to switch off leds.

      ...
      int LedsOffPin = 2; // the number of the input pin
      ...
      void setup()
      {
          pinMode(LedsOffPin, INPUT);
          ...
      }
      ...
      void setAllLEDs(uint32_t color, int wait)
      {
        for ( int Counter=0; Counter < LEDCOUNT; Counter++ ) // For each LED
        {
          if (digitalRead(LedsOffPin) == HIGH)
          {    
              strip.setPixelColor( Counter, strip.Color(0,0,0) ); // .. set to black
          } else {
              strip.setPixelColor( Counter, color ); // .. set the color
          }
          if( wait > 0 ) // if a wait time was set then
          {
            strip.show(); // Show the LED color
            delay(wait); // and wait before we do the next LED
          } // if wait
        } // for Counter
        strip.show(); // Show all LEDs
      } // setAllLEDs

      Note that this is untested code …. and for more info on using switches with your Arduino read “Arduino -Switch” on the Arduino website.
      Some more info on the color switching can also be found in this article I wrote.

      With an IR receiver “led”, you could even consider toggling on/off with your remote. But that would take a little bit more effort to figure out.
      Interesting to think about though   …

      Hope this helps 

      Reply

      hans

    • Jul 23, 2014 - 9:32 PM - Russ Comment Link

      So I have modified your code to include an event timer that monitors the data stream – if the serial stream is active, Pin 10 goes HIGH.  After 5 seconds of inactivity on the serial stream, I have the arduino change all the LEDs to black, and Pin 10 goes LOW.    Pin 10 is connected to a solid state relay that switches my 110V Mains AC Power to the LED power supply so I’m not wasting excessive energy, and now I don’t have to manually unplug or switch off anything – 5s after I power off my HTPC via the IR Remote, the system switches itself off.

      I modified my original setup a little as well – rather than use an expensive/bulky Arduino Mega, I’m using a 16Mhz ProMini 5V, and a cheap USB-RS232 adapter board ($8 total).  Now its small enough to stick in a small project case on the shelf in the closet behind the TV (with the rest of my AV gear).

      I have been reading about the hscan and vscan, and believe I can make a config file that will allow me to only use the left half of the video stream for my 3d movie playback so the visuals will match what my shutter glasses are presenting to my eyes…  But I’d really like to know if there’s a way to have boblight switch config files if I am playing from the “movie” collection vs the “TV” collection.

      Reply

      Russ

    • Jul 23, 2014 - 9:54 PM - Russ Comment Link

      I should add to my previous post that the arduino code I added forces the “state” variable back to “STATE_WAITING” (in case the HTPC power off left it in an unfinished working state) and when the serial stream resumes, it switches Pin 10 HIGH again, powering up the power supply, and immediately begins processing the color data again.   I’ve powered my system on/off several times now and it seems to be working perfectly.

      Next I’ll be looking into adding a “sleep” function (or sort of anyway) so that if I pause/stop a video, or turn the TV off but fail to actually power off my HTPC, the LEDs will detect that the color stream hasn’t changed values in 5 minutes and power off the system as well.  This seems a might bit more complicated, and might present some challenges given the limited memory I have to work with on the ProMini….

      As for the 3D – since the video files I play are SBS (Side by side), the 1920 pixels width is split in half (minus a few pixels in the center for black bar) with the left eye’s image getting the left ~960 pixels and the right eye getting the right ~960 pixels.  So it looks to me like I can create a custom boblightd.conf file where the hscan values only go from 0-50 (0% width to 50% of the width of the video stream).  Since the TV stretches the image back to a full 1920 pixels wide and shutters back and forth between the left/right eye, and since the LEDs haven’t physically moved, the alignment should be good enough to look like the system is processing the video correctly… at least that’s my theory.   Since there isn’t a handy tool to create a config file for only one HALF the screen, I will have to custom make my 3d one to test out….   I will report back if it works, and then it’ll be on to finding a way to automate the switch of the config files so that when i go into a menu that is all my 3D content, the lights will automatically start processing the modified image correctly, and return to standard when I’m done…   Seems like a tall task, but hopefully I can figure it out.  Maybe there’s some linux gurus out there that can help me with a script that renames the config file and restarts boblight or something….

      Side Note – YES, I did have auxiliary cooling for the RasPi.  It seemed to run pretty stable, and I didn’t experience the memory card corruption problems that some people seem to report when overclocking more than 800Mhz.  But I only ran it for a week or so since I couldn’t get the results I wanted…  I’ll likely revisit the attempt at some time down the road.

      Reply

      Russ

      • Jul 24, 2014 - 12:10 AM - Russ Comment Link

        I seem to have hit an interesting turn of events with my 3D & Boblight goals.

        I spent a couple hours manually editing the boblight.conf file to only use 0-49.5% of the hscan range in the various LED assignments (25-49.5% on the “start” objects, and 0-25% on the “end” objects – goal of only processing the left eye image).  I fired up one of the 3D files I have and began seeking back and forth looking to see if it lined up – it looked close but not right most of the time.

        In my pursuit of having the 3d stuff sorted out, I had also undertaken the task of getting OpenELEC to recognize the 3D files and automatically start them in stereographic SBS mode.  When I did this, apparently to my surprise, it corrected the alignment/dual-image issue I was experiencing with the standard boblight output, and therefor caused my “corrected” conf file to actually be processed wrong. 

        Sooooo – it looks like by adding the “.3D” to the filename (ie “Pacific Rim 1080p HSBS.3D.mkv) alerted the OS to the fact it was a 3D movie, and solved my problems.  It now auto-starts in 3D mode, and the boblight stream appears to be processing correct using the standard conf file created with your awesome software tool.

        Figured I’d share since I know there appears to be lots of us playing with the system now… :)  

        Reply

        Russ

        • Jul 24, 2014 - 9:37 AM - hans - Author: Comment Link

          Thanks for sharing Russ – now you’ve peaked my interest, and I’ll go try this myself! 

          So you’re saying that with OpenElec 4.x (XBMC Gotham), we only need to rename our files so it has “.3D” in it? Awesome!

          Reply

          hans

          • Jul 24, 2014 - 1:21 PM - Russ Comment Link

            Pretty much yes.  I did have to fiddle with a few of the files, seems it likes to only see the “.3D” or maybe it has to be before a resolution tag like “1080p” as I noticed the menus would identify the file as “HD” and not “3D” (yes there is a logo for it that shows up beside it) if i didn’t remove the other numbers.

            Remember you may have to clean and reload your library, or refresh the individual media files to show the updated info.  When you press play, it will pop up and ask what mode you’d like the stereographic image to be run in, and the OpenELEC OSD will adapt to show correctly through the glasses.

            Russ

        • Jul 24, 2014 - 5:06 PM - hans - Author: Comment Link

          My 3D movies are stored separate from the regular movies and XBMC is not index them … it became way to confusing.

          But with your findings I can actually do some testing! Thanks!

          Reply

          hans

  • Jul 26, 2014 - 9:24 AM - Niko Comment Link

    @Hans i have one question left.

    ambilight didnt work top and down under the cinemascope blocks… right and left it works. Wich setting i make wrong ? 

    thx 4 help

    Reply

    Niko

    • Jul 26, 2014 - 9:51 AM - hans - Author: Comment Link

      Hi Niko …

      Well, I’ve read somewhere that only SBS and full TAB formats are supported correctly in XBMC Gotham (link). Not sure if your TAB movies are full resolution or not. Not 100% sure what “full” and “not full” means, but I assume that full TAB means that the video file actually has a vertical resolution twice that of the actual movie. Then again, I did see conflicting info as well.

      As for filenames (can be upper- or lowercase):

      For all 3D files always seem to need “.3D.”, “_3D_”, “.3D-“, “.3D”, “3D.” or “3D”

      For Side-By-Side add: “.SBS.”, “.HSBS.”, “_SBS_”, “SBS”, “-SBS”

      For Top-and-Bottom add: “.TAB.”, “.HTAB.”, “_TAB_”, “TAB”, “-TAB”

      I noticed that just adding “3D”, and either “SBS” or “TAB” is already enough, no matter what characters before and after,…


      Filename examples:

      moviename (year).3d.hsbs.mkv

      moviename 3d sbs.mkv

      moviename.3D-HTAB.mkv

      moviename-3D.sbs-720p.mkv

      Reply

      hans

  • Aug 17, 2014 - 7:54 AM - Ollie Chalk Comment Link

    Thanks for the great article! I think I may need to invest in some of those LEDs :)

    Reply

    Ollie Chalk

  • Aug 28, 2014 - 2:07 PM - fflynt Comment Link

    First, sorry for my english.

    After several days looking for a valid code to ambibox and windows i found it. If you want that this strip works successful whit Ambibox and Windows 8 or other windows you have to put this code in the arduino (need fast spi library):

    //////////
    //
    // Arduino interface for the use of ws2812 operated LEDs
    // Uses Adalight protocol and is compatible with Boblight, Prismatik etc
    // "Magic Word" for synchronisation is 'Ada' followed by LED High, Low and Checksum
    //
    #include <FastLED.h>
    ///// User definitions /////
    // Define the number of LEDs
    #define NUM_LEDS 240
    // Define SPI Pin
    #define PIN 13
    // Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
    #define serialRate 115200
    // Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
    uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;
    // initialise LED-array
    CRGB leds[NUM_LEDS];
    void setup()
    {
      
      FastLED.addLeds<WS2812, PIN, GRB>(leds, NUM_LEDS);
      
      // initial RGB flash
      LEDS.showColor(CRGB(255, 0, 0));
      delay(500);
      LEDS.showColor(CRGB(0, 255, 0));
      delay(500);
      LEDS.showColor(CRGB(0, 0, 255));
      delay(500);
      LEDS.showColor(CRGB(0, 0, 0));
      
      Serial.begin(serialRate);
      Serial.print("Ada\n"); // Send "Magic Word" string to host
      
    }
    void loop() { 
      // wait for first byte of Magic Word
      for(i = 0; i < sizeof prefix; ++i) {
        waitLoop: while (!Serial.available()) ;;
        // Check next byte in Magic Word
        if(prefix[i] == Serial.read()) continue;
        // otherwise, start over
        i = 0;
        goto waitLoop;
      }
      
      // Hi, Lo, Checksum
      
      while (!Serial.available()) ;;
      hi=Serial.read();
      while (!Serial.available()) ;;
      lo=Serial.read();
      while (!Serial.available()) ;;
      chk=Serial.read();
      
      // if checksum does not match go back to wait
      if (chk != (hi ^ lo ^ 0x55))
      {
        i=0;
        goto waitLoop;
      }
      
      memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
      // read the transmission data and set LED values
      for (uint8_t i = 0; i < NUM_LEDS; i++) {
        byte r, g, b;    
        while(!Serial.available());
        r = Serial.read();
        while(!Serial.available());
        g = Serial.read();
        while(!Serial.available());
        b = Serial.read();
        leds[i].r = r;
        leds[i].g = g;
        leds[i].b = b;
      }
      // shows new values
     FastLED.show();
    }
    Reply

    fflynt

    • Aug 28, 2014 - 2:39 PM - hans - Author: Comment Link

      Thanks! 

      And dont worry about your English: It’s perfect 

      AmbiBox/Windows users will enjoy your sketch! 

      Reply

      hans

    • Jan 21, 2015 - 6:00 AM - FaUst Comment Link

      Have you do eny extra configs in AmbiBox? Because your sketch is working fine with boblight, but in AmbiBox i see only start sequence.

      Reply

      FaUst

  • Sep 1, 2014 - 2:07 PM - Matt Comment Link

    Hi Hans,

    All this afternoon, I tried to going ambilight work but I did not succeed. 

    I use OpenElec on Intel NUC, WS2812B and Arduino MEGA. 

    When I turn on the Arduino the initial color appear but when a movie is launch through XBMC the color doesn’t change.

    I think that Arduino part is correct because when I change initial color in sketch, real color change.

    Have you got an idea ?

    Log file seems to be ok :

    (InitLog)                       start of log /storage/.boblight/boblightd.log
    (PrintFlags)                    starting boblightd -c /storage/.xbmc/userdata/addon_data/service.multimedia.boblightd/boblight.conf
    (CConfig::LoadConfigFromFile)   opening /storage/.xbmc/userdata/addon_data/service.multimedia.boblightd/boblight.conf
    (CConfig::CheckConfig)          checking config lines
    (CConfig::CheckConfig)          config lines valid
    (CConfig::BuildConfig)          building config
    (CConfig::BuildConfig)          built config successfully
    (main)                          starting devices
    (CClientsHandler::Process)      opening listening socket on 127.0.0.1:19333
    (CDevice::Process)              AmbiLight: starting with output "/dev/ttyACM0"
    (CDevice::Process)              AmbiLight: setting up
    (CDevice::Process)              AmbiLight: setup succeeded
    (CClientsHandler::Process)      127.0.0.1:51359 connected
    (CClientsHandler::ParseMessage) 127.0.0.1:51359 said hello
    (CClientsHandler::ParseSet)     127.0.0.1:51359 priority set to 128
    # config file created with BobLight Config Maker v.1.0
    # (C) Hans Luijten - //www.tweaking4all.com
    # Orientation naming as seen from the REAR of the TV
    # Date: 1-9-14 20:07:18
    
    [global]
    interface 127.0.0.1
    port      19333
    
    [device]
    name            AmbiLight
    type            momo
    output          /dev/ttyACM0
    channels        276
    prefix          41 64 61 00 18 4D
    interval        20000
    rate            9600
    debug           off
    delayafteropen  100000
    /* t4a_boblight
    * (C) 2014 Hans Luijten, www.tweaking4all.com
     *
     * t4a_boblight is free software and can be distributed and/or modified
     * freely as long as the copyright notice remains in place.
     * Nobody is allowed to charge you for this code.
     * Use of this code is entirely at your own risk.
     */
    
    #include "Adafruit_NeoPixel.h"
    
    // DEFINITIONS
    
    #define STARTCOLOR 0xFF0015  // LED colors at start
    #define BLACK      0x000000  // LED color BLACK
    
    #define DATAPIN    13        // Datapin
    #define LEDCOUNT   92       // Number of LEDs used for boblight
    #define SHOWDELAY  200       // Delay in micro seconds before showing
    #define BAUDRATE   9600    // Serial port speed, 460800 tested with Arduino Uno R3
    #define BRIGHTNESS 75        // Max. brightness in %
    
    const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D};  // Start prefix
    char buffer[sizeof(prefix)]; // Temp buffer for receiving prefix data 
    Reply

    Matt

    • Sep 3, 2014 - 6:23 AM - Matt Comment Link

      I find the mistake !!

      I try with an arduino uno and now it work great !! 

      Thanks for this wonderful DIY guide 

      Reply

      Matt

  • Sep 5, 2014 - 1:31 AM Comment Link
    PingBack: zabuldon.bool.by

    […] выводах GPIO). Начал искать методы подключения и нашел вот такую статью. В ней предлагалось использовать arduino в […]

  • Sep 19, 2014 - 11:25 AM - K B Comment Link

    Can you advise on the cables that you are using to connect the strips together (in figures 8, 12 and 13)?

    What gauge would you recommend?

    Can you also tell me what the white wiring block that you are using to connect wires together is called?

    I am trying to put together a shopping list of all the items I need  

    Great guide by the way. I am looking forward to following it when I have everything I need.

    Reply

    K B

    • Sep 20, 2014 - 2:27 AM - hans - Author: Comment Link

      Thanks KB 

      I used the cables that came with my LED strips. Looking at this article, 6 gauge should be enough.

      My connectors came with my LED strips, and I did find them at eBay where the called them “3-pin JST SM connectors” (link). I’m sure there are smaller bundles available than 50 pieces 

      Hope this helps.

      Reply

      hans

  • Sep 23, 2014 - 10:04 AM - Teamo Comment Link

    Hi, 
    thanks for your great tut. Here is my problem: I have a flickering every 1 or 2 seconds (see video). I even tried to do it with FastLED, but that didn’t change anything. (I append the FastLED Sketch, maybe anyone has any use of it.)
    Video of flickering  – If anyone knows what to do I’d be happy. I am running on 30% Brightness, with 76 Pixels and a 5V/2A Power Supply. Flickering stays also when I reduce to 30 pixels.
    Additionally, it seems to be very slow. In the sample video it takes almost a second for the lights to snych. Is that normal?
    (Raspberry Pi + OpenElec + Arduino Nano (tested with mega aswell) + WS2812B (GRB) )
    FastLED Sketch:
    #include “FastLED.h”
    /* t4a_boblight * (C) 2014 Hans Luijten, http://www.tweaking4all.com&nbsp;* * t4a_boblight is free software and can be distributed and/or modified * freely as long as the copyright notice remains in place. * Nobody is allowed to charge you for this code. * Use of this code is entirely at your own risk. */
    //#include “Adafruit_NeoPixel.h”
    // DEFINITIONS
    #define STARTCOLOR 0xFFFFFF // LED colors at start#define BLACK 0x000000 // LED color BLACK
    #define DATAPIN 9 // Datapin#define LEDCOUNT 76 // Number of LEDs used for boblight#define SHOWDELAY 0 // Delay in micro seconds before showing#define BAUDRATE 115200 // Serial port speed, 460800 tested with Arduino Uno R3#define BRIGHTNESS 90 // Max. brightness in %
    const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D}; // Start prefixchar buffer[sizeof(prefix)]; // Temp buffer for receiving prefix data 
    // Init LED strand, WS2811/WS2912 specific
    // These might work for other configurations:// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)// NEO_KHZ400 400 KHz (classic ‘v1’ (not v2) FLORA pixels, WS2811 drivers)// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
    //Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDCOUNT, DATAPIN, NEO_GRB + NEO_KHZ800);
    CRGB leds[LEDCOUNT];
    int state; // Define current state#define STATE_WAITING 1 // – Waiting for prefix#define STATE_DO_PREFIX 2 // – Processing prefix#define STATE_DO_DATA 3 // – Handling incoming LED colors
    int readSerial; // Read Serial data (1)int currentLED; // Needed for assigning the color to the right LED
    void setup(){  //strip.begin(); // Init LED strand, set all black, then all to startcolor      FastLED.addLeds<WS2812, DATAPIN, RGB>(leds, LEDCOUNT);  //FastLED.showColor(CRGB::Red);  //setAllLEDs(BLACK, 0);  setAllLEDs(STARTCOLOR, 5);    Serial.begin(BAUDRATE); // Init serial speed    state = STATE_WAITING; // Initial state: Waiting for prefix}

    void loop(){  switch(state)  {    case STATE_WAITING: // *** Waiting for prefix ***      if( Serial.available()>0 )      {        readSerial = Serial.read(); // Read one character                if ( readSerial == prefix[0] ) // if this character is 1st prefix char          { state = STATE_DO_PREFIX; } // then set state to handle prefix      }      break;                case STATE_DO_PREFIX: // *** Processing Prefix ***      if( Serial.available() > sizeof(prefix) – 2 )       {          Serial.readBytes(buffer, sizeof(prefix) – 1);                    for( int Counter = 0; Counter < sizeof(prefix) – 1; Counter++)           {            if( buffer[Counter] == prefix[Counter+1] )             {              state = STATE_DO_DATA; // Received character is in prefix, continue              currentLED = 0; // Set current LED to the first one            }            else             {              state = STATE_WAITING; // Crap, one of the received chars is NOT in the prefix              break; // Exit, to go back to waiting for the prefix            } // end if buffer          } // end for Counter      } // end if Serial      break;                case STATE_DO_DATA: // *** Process incoming color data ***      if( Serial.available() > 2 ) // if we receive more than 2 chars      {        Serial.readBytes( buffer, 3 ); // Abuse buffer to temp store 3 charaters        leds[currentLED++].setRGB(buffer[1], buffer[0] , buffer[2]); // and assing to LEDs      }        if( currentLED > LEDCOUNT ) // Reached the last LED? Display it!      {          FastLED.show(); // Make colors visible          //delayMicroseconds(SHOWDELAY); // Wait a few micro seconds                    state = STATE_WAITING; // Reset to waiting …          currentLED = 0; // and go to LED one                    break; // and exit … and do it all over again      }      break;   } // switch(state)  } // loop

    // Sets the color of all LEDs in the strand to ‘color’// If ‘wait’>0 then it will show a swipe from start to endvoid setAllLEDs(uint32_t color, int wait){  for ( int Counter=0; Counter < LEDCOUNT; Counter++ ) // For each LED  {    //strip.setPixelColor( Counter, color ); // .. set the color    leds[Counter].setRGB(0, 255 , 0);    if( wait > 0 ) // if a wait time was set then    {      FastLED.show(); // Show the LED color      delay(wait); // and wait before we do the next LED    } // if wait      } // for Counter    FastLED.show(); // Show all LEDs} // setAllLEDs

    Reply

    Teamo

    • Sep 23, 2014 - 10:26 AM - hans - Author: Comment Link

      Hi Teamo,

      Yep, that flicker doesn’t lock right … I’ve never seen this though.

      My first guess: Your Raspberry Pi is not keeping up.

      Some things I’d try:

      – Disable all plugins (except Boblight of course)
      – Over-clock the Raspberry Pi (without burning it to a crisp)
      – Test the Arduino/LEDs on a normal PC/Laptop 

      Reply

      hans

      • Sep 23, 2014 - 11:10 AM - Teamo Comment Link

        Hi Hans, 

        thanks for your quick reply. Odd fact: I removed the external power supply and attached it directly to the arduino. The flickering is gone now. (Perviously I tried 5V/1A and 5V/2A) The Arduino gets its power from the 5V/1A Power supply that is attached to the raspberry pi (Just in case you hear that again).

        But I’m still far away from the performance you have in your videos. I did not install any plugins at all yet, since I just installed it yesterday (was using raspbmc before, but it didn’t work at all)

        Do you think overclocking will help with the speed issue? I changed showdelay to 0. The baudrate can’t be changed to anything above 115200, but as I’ve read, that isn’t a problem for the performance. I am really wondering why it’s so laggy… 

        Reply

        Teamo

      • Sep 23, 2014 - 11:46 AM - hans - Author: Comment Link

        5V/1A for the Raspberry Pi seems a little low? I always use at least 5V/2A for my Pi’s.

        Pi + Arduino + LEDs on 5V/1A seems super low …?!

        Lights will lag a few microseconds, not noticeable during video playback, but noticeable with the demo video – although I have seen plenty people who have a hard time seeing the lag.

        I too have noticed that serial speed doesn’t really make much of a difference.

        You could try to play with the “interval” value of your config file …

        Overclocking is recommended for a Raspberry Pi.

        Reply

        hans

        • Sep 24, 2014 - 5:02 PM - Teamo Comment Link

          Hi Hans, 

          big thx for the tip with the Overclocking. That speeded it up a lot. But still there is a noticeable delay. I activated the “High” setting (but did not overvolt). That means i have settings 950/450/450. Additionally I got the external power supply attached correctly, so it works like  it should. 

          Do you think I should lower or higher the interval? It doesn’t send 50 refreshes/second. It’s like the backlight changes 2-3 times per second. So in theory lowering might be the better choice, but did not work out (changed to 2000). If it worked like in the laser-show demo you posted above, everything would be fine. I think its just a small step to reach that. Just a few settings :)

          Reply

          Teamo

        • Sep 25, 2014 - 2:25 AM - hans - Author: Comment Link

          You could try a higher value for “interval”, serial speed of 9600 or 16840 should be good enough. For the interval I’d normally aim for half the refreshrate of my video. If 20,000 = 50x per second, then 40,000 should match 25x per second. 2 or 3 times per second would indeed be very visible delay wise …

          I have played only with the Raspberry Pi A model, might be that the B model performs better (more memory). Might also be that a faster class SD card performs better, or running at 720p instead of 1080p.

          With a heat-sink you might also be able to achieve better overclocking values.

          You might find more tricks in the OpenElec or Raspberry Pi forum as well … other folks in the OpenElec forum play with Boblight as well. I recall a special Boblight version for that purpose, but I could be mixing that up with Enigma version (sat box).

          Reply

          hans

  • Sep 24, 2014 - 3:42 AM - Seyhun Comment Link

    Dear Hans,

    Hi. My system is working well except that everytime I have to re-upload sketch to arduino. Have any idea to solve this problem ?

    Regards,

    Reply

    Seyhun

    • Sep 24, 2014 - 7:06 AM - hans - Author: Comment Link

      Hi Seyhun!

      Ehm, how do you mean re-upload the sketch?
      After you power down the Arduino? (which would point to some problem on your Arduino)
      Or after you modify the amount of LEDs?

      Reply

      hans

  • Sep 24, 2014 - 7:39 AM - Seyhun Comment Link

    Hi again :)

    Well I think I need to start over  because I did’t give any info about my project :) I have Zotac Mini with Win7. I applied all steps except boblightd. I downloaded boblight for windows and applied what

    it needs. When I first upload skecth then I run server for boblight windows. Everything had worked well. After couple days I want to use it again. when I turn on the computer  Arduino takes power and make the leds on with initial led colour (white). After that I stated server it worked with some warnings and then XBMC. LEDs didn’t take any effect. After all I re-upload skecth to Arduino then I started server it worked well. Every time I want to use I need to do same process. (re-upload sketch). Do you have any  idea for solution ?

    Regards,

    Reply

    Seyhun

    • Sep 24, 2014 - 8:36 AM - hans - Author: Comment Link

      Hi Again to you too 

      Does the Arduino remain powered when you shut down your computer?
      Just curious, since either the Arduino is not picking up the right data or the server can’t seem to find the Arduino.

      Reply

      hans

      • Sep 24, 2014 - 9:02 AM - Seyhun Comment Link

        Yes Arduino remains with power because of Zotac I think.

        I’ll post server’s message at night I can’t remember well now. Ambillight works fine out of this problem :)

        Reply

        Seyhun

      • Sep 24, 2014 - 12:38 PM - hans - Author: Comment Link

        If you use the setup above, the Arduino should shutdown when unplugging the power supply (the one in this schematic that is), even when the Zotac stays on …

        Reply

        hans

  • Sep 28, 2014 - 12:07 PM - Cole Comment Link

    Hi Hans,

    I’ve followed all of your articles for getting this ambilight working….and it works!!!

    I have 195 WS2812 LEDs powered by a 5V/10A supply that also powers the arduino. All of it’s connected to the PI (overclocked by turbomode) using Openelec & boblight with your config file. 

    My problem is that I have a ~4second delay for the LEDs to switch color (after the TV scene switches), and I am out of ideas. 

    Did you run into this issue? How did you set up your x3 channels? 

    I just tried a higher than 460800 baudrate on the arduino and pi boblight config, and now all USB ports on the PI dont work when the arduino is plugged in. They do work when i unplug the arduino usb. This still happens after switching back to 460800 baudrate! 

    Reply

    Cole

    • Sep 28, 2014 - 3:20 PM - hans - Author: Comment Link

      Hi Cole,

      seems you might be running into a similar issue Teamo has (above) – maybe he has made progress. A 4 second delay seems a bit rough though … 

      The OpenElect setup I’ve used was not on a Raspberry Pi, but by the time I get home again (about a month from now) I will most certainly try it with a Pi.

      Higher baudrates do not seem to matter much (dito experience with a regular PC).
      – Playing with the “Interval”  might help.
      – Disable all plugins,
      – Pick the faster UI (Confluence I think),
      – Try 720p playback to possibly gain some more speed.

      Reply

      hans

    • Oct 3, 2014 - 2:45 PM - Teamo Comment Link

      Hi Cole, 
      i did make a huge progess with overclocking the pi to high, but i only use 63 LEDs. Since you are using 195 it makes sense that you have a huge delay. The baudrate is not the problem. As it seems boblight uses 3 bytes per led and with a refresh rate of 25 times/s the formula would be refreshes_per_second*3 bytes*num_of_leds=required bytes per second (baudrate). So for me it would be  25*3*63=4725 so it works equally well with a baudrate of 9600 for me. When using a refresh rate of 50 and 195 LEDs a baudrate above 29250 should be sufficient anyways. The problem seems to be the speed of the rapberry and the large amount of LEDs you are using. I set the refresh rate to 25 refreshes per second, overclocked to high, used 63 LEDs and set the maximum brightness to 30% (which is perfectly sufficient for me). I will try to find out even better settings. If I get to a solution I will post it.

      Reply

      Teamo

      • Oct 4, 2014 - 2:55 AM - hans - Author: Comment Link

        Well, I’m not running OpenElec on a RPi, rather on a regular small PC, which gives Boblight more computing power to determine the colors for the LEDs.

        Raspberry Pi settings and suggestions are most welcome here, since some of the visitors use the Raspberry Pi with OpenElec. Would be a great addition to the current info!

        Thanks again Teamo! 

        Reply

        hans

  • Oct 7, 2014 - 1:37 AM - humsat - Author: Comment Link

    bravo!

    Reply

    humsat

  • Oct 10, 2014 - 5:18 AM - Mitch Comment Link

    I was wondering – have you have ever considered using Hyperion instead of Boblight? It’s supposed to be much more efficient and use less CPU.

    Reply

    Mitch

    • Oct 10, 2014 - 5:45 AM - hans - Author: Comment Link

      Hyperion is for Raspberry Pi only (as far as I understand) and the setup in this article is a regular PC (HTPC) … 

      Do you have any experience with it?
      I would assume that the hardware does not need to be different, just the installed software on the Raspberry Pi and possibly the config file?

      Reply

      hans

      • Oct 10, 2014 - 6:21 AM - Mitch Comment Link

        No, I’m still waiting for my strip and Arduino to arrive. But I’m exploring the options. It looks like, unfortunately, you are right – Hyperion seems to be made for Raspberry Pi only. :(

        The reason I like Hyperion is also that it can be controlled from a phone (Android). There is some mention how to get Hyperion working in tandem with boblight-x11 here: https://github.com/tvdzwan/hyperion/issues/62 (last comment)

        Reply

        Mitch

      • Oct 10, 2014 - 6:56 AM - hans - Author: Comment Link

        You might want to read this post in the XBMC Forum, which is a small “tutorial how to compile it on Linux and use it” … 

        Maybe I’ll look into this when I get back home (on vacation right now), I wouldn’t mind low CPU load and higher speed even on my HTPC, maybe it reduces the tiny lag (hardly noticeable though). Does not seem all that complicated …

        Note: For OpenElec this might require some extra work since it’s an embedded Linux version.

        Copy from the forum post:

        Guide supports effect engine and Hyperion on Android to v1.3.

        On Raspberry Pi it is very popular. So here is the tutorial how to compile it on Linux and use it. It is uses almost no CPU usage like 1% for 100 LEDs compared to Boblight which was using around 30-35% of cpu usage on AppleTV with CB2. On my Atom D2550 it is not worth a mention.

        I am using it also on regular HTPC based on Linux.

        First install pre-requirements and then compile:

        sudo apt-get update
        sudo apt-get install git cmake build-essential libprotobuf-dev libQt4-dev libusb-1.0-0-dev protobuf-compiler python-dev
        cd /tmp
        git clone https://github.com/tvdzwan/hyperion.git
        cd hyperion
        cmake -DENABLE_DISPMANX=OFF
        sudo make
        sudo mkdir -p /media/scripts/hyperion
        sudo cp -a /tmp/hyperion/effects /media/scripts/hyperion/effects
        sudo cp /tmp/hyperion/bin/hyperion-remote /usr/bin/
        sudo cp /tmp/hyperion/bin/hyperiond /usr/bin/
        sudo chmod +x /usr/bin/hyperion-remote
        sudo chmod +x /usr/bin/hyperiond

        Now you have compiled Hyperion and the binaries are now in place.

        In next step we will make it autostart. In Rpi it uses upstart script but in Linux HTPC the best way to start it is using autoexec.py under userdata folder of XBMC.

        If the file is not there then just create it and put this inside:

        import os, sys
        os.system('/media/scripts/hyperion_startup.sh');
        sys.exit()

        So now lets create the script under /media/scripts/hyperion_startup.sh

        The content of the script should be:

        #!/bin/bash
        /usr/bin/hyperiond /etc/hyperion.config.json >/dev/null 2>&1 &

        And also do not forget to make it executable.

        Maybe you can put the line (/usr/bin/hyperiond /etc/hyperion.config.json >/dev/null 2>&1 &) directly into autoexec.py, but i did not try.

        Now we need to create config file for Hyperion. Just download the file HyperCon from their page https://github.com/tvdzwan/hyperion/wiki/configuration and do a little reading.

        With the tool create a config file. Make sure that you will set the right type like “adaligh,…”, the right bound rate (very important!!!). adalight is using 115200 boundrate, the right type of LEDs (2801,…). For non RPi devices you can disable XBMC checker under the tab “External”.

        After you have created hyperion.config.json file, copy them under /etc/

        Now you need to download the addon for Hyperion. It is similar like the one from Boblight. You can get it here https://github.com/tvdzwan/hyperion/wiki…for-RPi%29

        This was the first step of compiling and basic installation of Hyperion.

        Note: Boblight and Hyperion can not run at the same time since they are using the same port and the same device. So disable the boblight first.

        If you would like to use the Hyperion with the light on all the time, also on visualizations and also on menus then you can use the boblight-x11 daemon. You will need to compile boblight and use just the binaries boblight-x11 (boblightd and boblight-constant you can delete).

        With this command you can call Hyperion with X11:

        /usr/bin/hyperiond /etc/hyperion.config.json >/dev/null 2>&1 &
        DISPLAY=:0.0 /usr/bin/boblight-X11 -f -x > /dev/null 2>&1 &

        For easy finding of perfect light configuration use Android app Hyperion from the google market. With this app you can see in realtime how the parameters effects the ambilight. When you will find the perfect spot just enter it into HyperConf.

        Reply

        hans

        • Oct 15, 2014 - 8:55 AM - Mitch Comment Link

          Thanks for this. It doesn’t seem that hard at all. But we would probably need to modify your sketch to some extent. I’m pretty sure Hyperion won’t send start prefix to Arduino for starters.

          Reply

          Mitch

        • Oct 15, 2014 - 10:10 AM - hans - Author: Comment Link

          I have not done any “deep” research on Hyperion yet, but the WS2801 seems to be favorite.
          Second thing I notice is that several setups use the GPIO of the Raspberry Pi directly, so no Arduino.

          However the Hyperion Wiki suggests that this setup could very well work just fine (USB-Arduino-LEDs). Read this section of the Wiki.

          Reply

          hans

  • Oct 10, 2014 - 10:22 AM - Mitch Comment Link

    Hans, one more question. For now I’ve ordered 2m of LED strap. 1m (30 leds) for top and 1m (15+15 leds) for left and right side. For now I’m not planning on having any leds at the bottom of TV. But your configuration tool doesn’t seem to like that as it alerts me about division by zero and it won’t compile the configuration file. Any ideas?

    Reply

    Mitch

    • Oct 11, 2014 - 3:39 AM - hans - Author: Comment Link

      I’m preparing a new release which allows this. Actually the error message is a mistake on my end where I forgot to not calculate the average LED width when zero LEDs is being entered.

      What you could do, for the time being, is configure it with 1 or 2 LEDs at the bottom, remove that part from the config file and reduce the channel count by the number of LEDs you had at the bottom times 3. Zo using 2 leds at the bottom mean reduce the cahnel count by 2 x 3 = 6 … (not pretty but at least you can work with it)

      Reply

      hans

      • Oct 11, 2014 - 3:55 AM - Mitch Comment Link

        Hans,

        Thanks for the reply. That’s exactly what I though and I did. But I still haven’t received my strip to test it out so I rather asked in advance. :)

        Reply

        Mitch

  • Oct 19, 2014 - 6:19 AM - zeremefico Comment Link

    Hi, great tutorial!

    Don’t know If this has been asked before, how many pixels/m (or leds/m) should be the strip? I see various types, would more be better?

    Reply

    zeremefico

    • Oct 19, 2014 - 12:29 PM - hans - Author: Comment Link

      Hi Zeremefico,

      Thanks for the compliment! 

      I’ve had great results with 60 LEDs per Meter. However, nothing stops you from using less or more.

      I guess it all depends how accurate (small) you want the “blocks” of light to be, but with 60/m I’d say you have an as good a resolution for [indirect] light as you can get. The indirect light that bounces of your wall will blur the colors anyway.

      Another reasons to use more LEDs is if you’d want a more intense light effect – I personally think 60/m is doing more than I need and I actually tone it down a bit to now be too overwhelming.

      I suspect that less than 60 LEDs/m will work just fine too (considering other designs I have seen).

      Also consider: more LEDs means stronger power supply (more Amps).

      Reply

      hans

  • Nov 3, 2014 - 7:40 AM - Alikindoy Comment Link

    Amazing work and a great tutorial!

    I have an AMD-powered HTPC and a RPi, and I have just one question: could it be possible to follow your tutorial, replacing the arduino for the RPi? I mean, what changes should be done for using the RPi just as a led controller receiving the image data through the usb ports. 

    I’ve seen other tutorials where the RPi is used also for running XBMC, and also some other “already-packed-thing” that charges 60€ just to be able to connect a HDMI device to the RPi, and I don’t like any of them.

    Reply

    Alikindoy

    • Nov 4, 2014 - 2:15 AM - hans - Author: Comment Link

      Thanks Alikindoy! 

      Theoretically the RPi should be able to control those LEDs, however, you’d need (from what I have read) a realtime operating system, which Linux is not. It is being said that timing can be unreliable.

      Since you have found guides/products for this: I’m wondering how “bad” the timing problem really is, or if they have a modified Linux version to support realtime controlling of the I/O ports …

      As for now: I wouldn’t know how.
      Not to mention that an Arduino Nano for example can be found dirt cheap in eBay.

      Why would you want to use a RPi for this? Or do you just have one laying around …?

      Reply

      hans

      • Nov 4, 2014 - 3:50 AM - Alikindoy Comment Link

        Hi Hans!

        thanks for your prompt response. And yes, I have a RPi laying around and I just wanted to give it a try with the ambilight-clone thing. Anyway, you’re right about the realtime control in Linux (I didn’t think about it, I was focusing just in the hardware part), so maybe it’s easier (and cheaper) to use an Arduino as you suggest. 

        Thanks again for you’re help!

        PD: Maybe I’ll have a look to some realtime options with RPi in the near future.

        Reply

        Alikindoy

      • Nov 4, 2014 - 3:53 AM - hans - Author: Comment Link

        Hi Alikindoy,

        no problem – I actually had the same thought before I decided to buy an Arduino – definitely worth looking at eBay for that stuff. The Chinese clones work just as well, just a lot cheaper 

        Reply

        hans

        • Oct 14, 2015 - 3:06 AM - Alikindoy Comment Link

          Hi Hans,

          just reporting the good news: I followed your amazing tutorial using an Arduino Nano with WS2811 leds and it all works perfectly fine. I’m just a bit annoyed about a small problem, probably caused by the leds and maybe the power supply, I’m not sure: when boblight is not working (I mean, just the daemon boblightd is running in the background) some leds randomly flash in different colors every now and then. Apart from that, everything works fine.

          My next step will be to learn how to load sketches in arduino from the command line, in order to be able to control the leds with different sketches depending on things like the application that I’m using each time or something similar. It could be nice… Anyway, thanks a lot for your fantastic work.

          Regards!

          Reply

          Alikindoy

        • Oct 14, 2015 - 3:14 AM - hans - Author: Comment Link

          Hi Alikindoy,

          thank you for the compliment! 

          The random flashing, when Boblight is idle, is definitely not normal.
          If this only happens when Boblight is idle, then I’m curious to see what is causing this.
          Does this also happen when you disconnect the Arduino from your HTPC (PC, RPI)? It should do the startup swirl and then remain stable. If not then I’d suspect that there is something wrong with one or more of the LEDs (they each have a “driver” chip, one of those might be defective).
          If your LEDs work normal when Boblight is active, then I would think your Power Supply is OK, and if the initial swirl looks good too then I would think the LEDs are OK as well.

          Did you set in the Boblight AddOn for XBMC/Kodi, that it should use a static background color for when there is no video?

          Reply

          hans

  • Nov 7, 2014 - 2:49 AM - simplyray Comment Link

    Hi,

    great tutorial and thanks for the code example! I’ve modified it and added IRremote to enable/disable and adjust the brightness during runtime with an TSOP4838 IR Reciever and an remote control.

    /* 
     * 2014 Raymond Schreiber, mail@simplyray.de
     * added IR remote support to adjust backlight brightness
     *
     * Original Credits:
     * t4a_boblight
     * (C) 2014 Hans Luijten, www.tweaking4all.com
     *
     * t4a_boblight is free software and can be distributed and/or modified
     * freely as long as the copyright notice remains in place.
     * Nobody is allowed to charge you for this code.
     * Use of this code is entirely at your own risk.
     */
     
    #include "IRremote.h"
    #include "Adafruit_NeoPixel.h"




    // DEFINITIONS


    #define STARTCOLOR 0xFFFFFF // LED colors at start
    #define BLACK 0x000000 // LED color BLACK


    #define DATAPIN 4 // Datapin
    #define LEDCOUNT 192 // Number of LEDs used for boblight
    #define SHOWDELAY 200 // Delay in micro seconds before showing
    #define BAUDRATE 115200 // Serial port speed, 460800 tested with Arduino Uno R3
    #define BRIGHT_INIT 50 // Initial Brightness
    #define BRIGHT_MAX 80 // Maximum Brightness


    const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D}; // Start prefix
    char buffer[sizeof(prefix)]; // Temp buffer for receiving prefix data
    int RECV_PIN = 11; // IR Datapin
    int bright_curr; // Brightness during runtime
    IRrecv irrecv(RECV_PIN);
    decode_results results;


    Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDCOUNT, DATAPIN, NEO_GRB + NEO_KHZ800);


    int state; // Define current state
    #define STATE_WAITING 1 // - Waiting for prefix
    #define STATE_DO_PREFIX 2 // - Processing prefix
    #define STATE_DO_DATA 3 // - Receiving LED colors


    int readSerial; // Read Serial data (1)
    int currentLED; // Needed for assigning the color to the right LED


    void setup()
    {
      strip.begin();
      strip.setBrightness( (255 / 100) * BRIGHT_INIT );


      setAllLEDs(BLACK, 0);
      setAllLEDs(STARTCOLOR, 5);
      
      bright_curr = BRIGHT_INIT; // Set current Brightness to initial


      Serial.begin(BAUDRATE);


      state = STATE_WAITING;
      
      irrecv.enableIRIn(); // Start the IR receiver
    }


    void loop()
    {
      switch(state)
      {
        case STATE_WAITING: // *** Waiting for prefix ***
          if( Serial.available()>0 )
          {
            readSerial = Serial.read();


            if ( readSerial == prefix[0] )
              { state = STATE_DO_PREFIX; }
          }
          break;


        case STATE_DO_PREFIX: // *** Processing Prefix ***
          if( Serial.available() > sizeof(prefix) - 2 ) 
          {
              Serial.readBytes(buffer, sizeof(prefix) - 1);


              for( int Counter = 0; Counter < sizeof(prefix) - 1; Counter++) 
              {
                if( buffer[Counter] == prefix[Counter+1] ) 
                {
                  state = STATE_DO_DATA;
                  currentLED = 0;     
                }
                else 
                {
                  state = STATE_WAITING;  
                  break;
                }
              }
          }
          break;


        case STATE_DO_DATA: // *** Process incoming color data ***
          if( Serial.available() > 2 )
          {
            Serial.readBytes( buffer, 3 );
            strip.setPixelColor( currentLED++, buffer[0], buffer[1], buffer[2]); 
          }


          if( currentLED > LEDCOUNT )
          {
              strip.show();
              delayMicroseconds(SHOWDELAY);


              state = STATE_WAITING;
              currentLED = 0;


              break;
          }
          break; 
      }
      
      // IR
      if (irrecv.decode(&results)) {
        watchIR();
        irrecv.resume(); // Receive the next value
      }
    }


    void setAllLEDs(uint32_t color, int wait)
    {
      for ( int Counter=0; Counter < LEDCOUNT; Counter++ )
      {
        strip.setPixelColor( Counter, color );


        if( wait > 0 )
        {
          strip.show();
          delay(wait);
        }
      }
      strip.show();
    }


    void watchIR() {
      switch(results.value) {
        case 0x40BD08F7: //UP
          setBacklightBrightness(5);
          break;
        case 0x40BD50AF: //DOWN
          setBacklightBrightness(-5);
          break;
        case 0x40BD9867: //POWER
          if(bright_curr > 0) {
            bright_curr = 0;
            setBacklightBrightness(0);
          } else {
            setBacklightBrightness(BRIGHT_INIT);
          }
          break;
        default: 
          break;
      }
    }


    void setBacklightBrightness(int val) {
      int bright_desired = bright_curr + val;
      
      if(bright_desired >= 0 && bright_desired <= BRIGHT_MAX) {
        strip.setBrightness( bright_desired );
        bright_curr = bright_desired;
      }
    }
    Reply

    simplyray

    • Nov 7, 2014 - 3:27 AM - hans - Author: Comment Link

      Excellent mod Simplyray! 

      I never thought about this, mostly because I watch TV at night, but I can see the benefits for sure! 

      Thanks for sharing your sketch here, it’s very much appreciated! 

      Reply

      hans

  • Nov 11, 2014 - 8:24 PM - Jason Olliff Comment Link

    Hello Hans,
    Thanks for an incredible write-up, on what has been a fun, yet challenging project. The challenge I’m facing is getting XBMC to change the LED’s while playing a video, and after reading through the entire article multiple times, and the comments section, I’m still at a loss as to what might be the issue. 

    Here’s my setup:
    HTPC – iMac bootcamped with Windows 8.1_x64, SSD for local disk, which is running XBMC/Kodi 13.2 (Aug 2014). 
    LED’s – WS2811’s, 5v10a PS – 60/meter at 4 meters = 240 LED’s
    Interface – Arduino OSEPP Uno R3 Plus

    The sketch seems to work fine, as it lights up with the swipe (love that), and I can modify the start color with no problems.

    ‘Installing’ boblightd took some time, as it’s not an available option within XBMC as described – I had to find the zip online, and extracted to c:/boblightd/. I assume this is the appropriate location on Windows 8, and that process is the same as ‘installing’? I am unsure how XBMC knows to find the ‘boblight.conf’ (that I created with your config builder application) file that I’ve dropped in this directory.

    Config file – Did not adjust any settings other than Output device, and total led’s on each side or top/bottom:
    Set LED count to 240, which returns a channel count of 720 (is this correct with a 240 LED strand?). Adjusted top, sides and bottom counts.
    Output device – /dev/com3
    Type – momo (Unsure what else to try here, other options don’t seem to make sense)=
    Baudrate – 460800
    Prefix – 41 64 61 00 18 4D
    Decimal separator set to Force Period.

    I’ve installed the XBMC Boblight add-on within XBMC, and when launching XBMC it says ‘Connected’. When opening a movie, or your test file within XBMC, the LED’s stay on the start color, and do not change, almost as if i’m not playing a video.

    I’ve also changed the Bits per second setting in -> Port Settings on the Windows USB Serial Port (COM3) properties, from the default 9600 baud to 460800 – matching the baud in the sketch and the config file.

    I tried adjusting the baud rate in the ‘Start.bat’ file from ( MODE COM3:9600,N,8,1 >NUL ) to ( MODE COM3:460800,N,8,1 >NUL ) as well.

    I’ve also tried copying the boblight.conf file to my C:\Users\%username%\AppData\Roaming\XBMC\ directory. 

    In looking through XBMC logs, it appears to talk to the config file, as it knows how many LED’s, and I do not see any apparent errors..

    Does OpenELEC need to be used in combination with XBMC, or can I choose to just use XBMC? OpenELEC doesn’t seem to fit my HTPC needs very well, as I’d like to USE XBMC within Windows, not boot to a partition with OpenELEC. 

    Any help that can be provided is greatly appreciated! If you need me to run any specific scenarios and post a log file, just let me know.

    Thank you!

    Reply

    Jason Olliff

    • Nov 12, 2014 - 9:41 AM - hans - Author: Comment Link

      Hi Jason,

      thanks for the nice compliment! 

      The article was written with OpenElec in mind, but with minor modifications it can most certainly be used under Windows.
      I have not tried running this under Windows, so the details concerning Boblight are only guess work on my end, and it seems you’ve done most of the work, the way I’d done it.

      I would consider using a lower baudrate, start (in conf and sketch) with 9600, 19200 or 38400. Much higher is not needed it seems. It might be that 460800 is too fast. Assuming the prefix matches the sketch.

      Everything else looks good (240 RGB LEDs = 3 colors * 240 = 720 channels).

      OpenElec is basically an embedded Linux distro optimized for XBMC use only. In essence running XBMC under Windows just has a few minor software config and install differences. The only difference is that for OpenElec a specific plugin is to be used.

      Give the lower baudrate a try and let me know your findings 

      Reply

      hans

      • Nov 12, 2014 - 9:49 AM - Jason Comment Link

        Thanks for the response and tip re: baudrate (same to you simpleray). I’ll give that a shot tonight and report back. ::fingers crossed:: :-)

        Reply

        Jason

    • Nov 12, 2014 - 9:42 AM - simplyray Comment Link

      Have you tried setting the baudrate to “115200”? That is the highest “legal” value. I’ve been unable to get my ambilight working under windows (7) with baudrates higher than that value.

      Reply

      simplyray

      • Nov 12, 2014 - 9:47 AM - hans - Author: Comment Link

        Thanks SimplyRay! Good to know, didn’t know that either! 

        Reply

        hans

      • Nov 13, 2014 - 10:31 AM - Jason Comment Link

        Well, I got it working by lowering the baudrate! A HUGE thank you to SimpleRay and Hans for the tip! I was going a bit crazy… :-)

        115200 is the highest rate that I could get Windows 8 to talk over, and in testing, it’s apparent, especially with the test video Hans provided, that there’s a slight delay in the changing of colors (1-2 seconds). Will look through the article again to see what other options I have to speed this up when I can’t adjust the baud rate further. Perhaps I need to move to OpenELEC for better performance? 

        Reply

        Jason

        • Nov 14, 2014 - 1:05 AM - simplyray Comment Link

          You could try my FastLED implementation (modified + found in the ardunino forums) which is working without delay or shuttering under OpenELEC. Downside: I’m currently unable to set the LED count to the correct amount (192 not 180). If i set a amount above 180, my LED strip starts to flicker irregular while processing data … i really have no idea why.

          BTW FastLED ist quite cool … some great features are implemented (color correction on the fly, blacklevel theshold, and so on)

          My Sketch (running with 460800 bauds under OpenELEC – you might want to initially set it to 115200 and try to set higher steps: 250000, 460600, etc.)

          Make sure you download the latest fastled version on github: https://github.com/FastLED/FastLED

          #include <FastLED.h>  // FastLED v3.0
          #define NUM_LEDS 180 //62
          #define DATA_PIN 6
          #define SERIALRATE 460800 //115200
          #define BLACK_THRESHOLD 20
          #define MIN_COLOR CRGB(0,0,0) // Farbe die angezeigt wird wenn Pixel < Schwarzschwelle
          #define CALIBRATION_TEMPERATURE TypicalLEDStrip // Farbkorrektur
          #define MAX_BRIGHTNESS 50 // 0-255
          CRGB incomes[NUM_LEDS]; // per Serial einkommende Pixelwerte
          CRGB leds[NUM_LEDS]; // Ausgabe Pixel
          // 6 Bytes für den Prefix aus der Boblight Config
          static const uint8_t prefix[] = {0x41, 0x64, 0x61, 0x00, 0xBF, 0xEA};

          void setup() 
          {
            delay(1000);
            FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
            FastLED.setTemperature( CALIBRATION_TEMPERATURE );
            FastLED.setBrightness( MAX_BRIGHTNESS );
            Serial.begin(SERIALRATE);
          }
          void loop() 
          {
            for(byte p = 0; p < sizeof prefix; ++p) 
            {
              waitLoop: 
              while (!Serial.available());
              if(prefix[p] == Serial.read()) continue;
              p = 0;
              goto waitLoop;
            }
            
            Serial.readBytes((char*)incomes, NUM_LEDS*3);
            
            for( int i = 0; i < NUM_LEDS; i++)
            {
              CRGB *led = leds+i; // Pointer auf die zu beschreibende LED
              CRGB *income = incomes+i; // Pointer auf den empfangenen Wert
              
              if( (*income).getAverageLight() < BLACK_THRESHOLD ) // Helligkeit des Pixels unter dem Schwarzschwellwert ?
              {
                *led = MIN_COLOR; // Pixel auf Minimalfarbe setzen
              }
              else
              {
                (*led).nscale8_video(127); // 50% vom vorherigen Pixelwert
                (*income).nscale8_video(127); // 50% vom aktuellen Pixelwert
              
                (*led) += (*income); // Werte addieren und zurückschreiben
              }
            }
            
            FastLED.show();
          }
          Reply

          simplyray

        • Nov 15, 2014 - 4:39 AM - hans - Author: Comment Link

          @Jason:

          115200 could be a limitation in the Windows version or in Windows itself. Seems that OpenElec (embedded Linux) allows higher speeds.
          I’m glad you got it to work !!

          @SimplyRay:

          Nice work on the sketch! There will always be room for improvements on my sketch, and suggestions like yours are more than welcome! Thanks for posting your code! 

          Reply

          hans

          • Nov 24, 2014 - 11:59 AM - simplyray Comment Link

            Update: I’ve managed to get my FastLED implementation working under Windows 7 + 8 with an baudrate of 460800!

            Downside: It currently only do work until the next reboot. So i have to recompile + upload my sketch to the arduino after every reboot. Currently not quite sure what is causing this … guess something happens when the system reboots.

            simplyray

          • Nov 25, 2014 - 2:19 AM - hans - Author: Comment Link

            Does this problem also occur when just powering down the Arduino (when rebooting Windows)?
            This should have the same effect as re-uploading the sketch to the Arduino.

            hans

  • Nov 16, 2014 - 3:35 PM - zeremefico Comment Link

    Hi again, I managed to finish the project but I face 2 problems:

    1. 4 leds in a raw in the same side of frame, flicker changing colours, in both idle & playing situation. Have you seen that, is this a led strip problem?

    2. When playing a video, I see some irregular flickering from various points of the strip.

    I use a genuine arduino, a 10amps power suply and I have raised config’s rate to match sketch’s rate.

    Reply

    zeremefico

    • Nov 17, 2014 - 2:17 AM - hans - Author: Comment Link

      The flickering could be caused by several things:

      – Baudrate too high for the serial port to keep up … (try a value lower or equal to 115200)
      – Power supply can’t keep up (see calculation about for proper Amps)
      – LED strand connections aren’t too great (although I’d guess that to be the least likely)
      – One or more LEDs are faulty and relay the data unreliably (have not seen this yet)

      Reply

      hans

  • Nov 18, 2014 - 11:18 AM - zeremefico Comment Link

    Hi again, fixed & matched the baudrate.

    Now I have a new problem, the only leds that light and work with boblight are the first line. The other are dead. Some times when I reconnect the power suply, they light but not work with boblight.

    Do you believe I need another power suply?

    Reply

    zeremefico

    • Nov 19, 2014 - 2:20 AM - hans - Author: Comment Link

      I’d check 3 things;

      1. Check the Amps of your power supply, see calculation above.
      2. Check the connections between strands.
      3. Swap strands, it could be that one LED is not relaying the data properly.
      Reply

      hans

  • Dec 5, 2014 - 3:04 PM - oyvind Comment Link

    As i search on ebay.co.uk, it seems to only give me ws2812B, is this gonna work just as good as the ws2812?

    And BTW nice tutorials you’ve got here.

    Reply

    oyvind

    • Dec 6, 2014 - 3:09 AM - hans - Author: Comment Link

      Hi Oyvind!

      Yes the WS2812B will work just as fine as the WS2812. The “B” version is actually an improved version. 

      Reply

      hans

      • Dec 6, 2014 - 6:59 AM - oyvind Comment Link

        Ok thanks for clarifying that, been searching and I couldn’t really find the exact difference exept for what you mentioned, and just wanted to be sure it actually would work the same way as ws2812(and not needing different sw uploaded etc).

        There is also the question wether to go with 30 led’s/m or 60 led’s/m, do you have any opinion about that, I mean would one actually notice the difference in ‘resolution’ on a normal TV like my now old 50″ plasma?

        I wonder if anyone have tried this in a homecinema, with let’s say 120″ screen, but then the led’s would have to be discretely hidden/masked, and also maybe the led’s would be too bright?!

        Unfortunately were I live now I don’t have room for my projector or any screen at all, but just something that came into my mind. 

        Reply

        oyvind

      • Dec 6, 2014 - 8:40 AM - hans - Author: Comment Link

        No problem – things can be confusing (for me as well) with all those silly type numbers 

        I have not tested 30 LEDs/m yet. I’d assume the total brightness will be less, but then again, I’m never running mine at 100% brightness.

        I would however be concerned about the potential gaps between LEDs, but I suppose that also depends on how close to the wall you are with the TV. A little further away from the wall would give a better diffuse effect, where the colors seem like one piece.

        But again: I have not tested this, I’m just speculating. Seeing others that did similar projects, I’d say 30/m might work just fine.

        In the end, I’d pick 60/m,… Keep in mind that if 60/m is too bright, then you can control that in the sketch by toning down brightness. I’d rather find myself with too many LEDs and having to go back to say 70% brightness than finding myself with 30/m LEDs and having to toss them because it didn’t work.

        With a projectors things do indeed get more complicated and I would not know if it would give the desired effect. Maybe if you can match the brightness with the projection brightness … but I’m guessing that matching the colors will be a pain. 

        I actually prefer my 80″ TV over a projector, but that’s a matter of personal taste, and one can’t argue about taste … 

        Reply

        hans

  • Dec 6, 2014 - 11:24 PM - taytos Comment Link

    Hi Hans. Great article! I have my setup running but I notice some delays like others. I have tried a few things (aka everything) but nothing seems to work. Do you think using a teensy 2.0 would perform better since it doesn’t use slower USB to serial? I’m running 196 LEDs on a Cubox i4 pro. I have some videos on youtube if you’d like to see the delay.

    Reply

    taytos

    • Dec 7, 2014 - 2:57 AM - hans - Author: Comment Link

      Hi Taytos!

      Thanks for the nice compliment. 

      As for the delay, I think a tiny delay might be unavoidable, since Boblight has to dissect the “screen” (played back at a pretty high speed, ie. 11.5, 15, 23, 25 or 30 screens per second). The speed of the XBMC/Kobi machine therefor will be the most critical point.

      I do not have the impression that a Teensy will be “better”, but then again: I have not tested this, so if you do, please let us know your findings.

      It might be an idea to test this with a beefy PC running OpenElec. Just for testing of course, to see if that improves things.

      I’ve noticed on my small PC (tiny AMD based box), that disabling all plugins significantly influenced the delay – but I never managed to get rid of the entire delay.
      During movie playback though, I hardly notice it, and I really have to pay attention to see it. The test video reveals the delay a lot better though.
      This gives me the idea that the HTPC is the most critical part causing delays.

      Feel free to post the links to your YouTube video’s, I’d be curious te see how it performs on your setup. 

      Reply

      hans

      • Dec 7, 2014 - 2:02 PM - taytos Comment Link

        I like the chain going on below me. I tried to use the FastLED sketch from a few posts up and like they said only able to use 180 LEDs (196 is extremely buggy). But even 180 was pretty bad delay wise. I think for starts I will try to use the FastLED posted below if not then I will try a teensy out for fun :). By the way, I read on another forum yesterday there is an attempt to bring Hyperion to more than just RPi!!! So that is something to look forward to testing out. Below is my video. 196 LEDs on 47″ TV. Brightness is 50%, baudrate is 115200 (460800 doesn’t appear to work. Not sure if its because cubox or what), Interval in this video was 100,000. Its now back to 20,000. I honestly don’t see any difference when changing that. I think boblight is 75% speed. When I run top on my cubox my cpu reaches 20% max so I don’t think the cubox is my bottle neck. I just see other peoples videos where it looks spot on. Even with a pi. But the number of channels plays a massive role in it because I think most of those setups are ws2801 30/meter. I have a decent PC laying around so I might try OpenElec for testing. Delay doesn’t look bad when you focus on the movie and not the lights.

        https://www.youtube.com/watch?v=6TiZaOWw8xk

        Reply

        taytos

      • Dec 8, 2014 - 2:51 AM - hans - Author: Comment Link

        Hi Taytos!

        I watched you YouTube video and you indeed have quite a delay. On my setup (290 LEDs, 60 LEDs/m, Arduino Uno, AMD Fusion 3500 PC) I do not see such delays.

        My guess too is that the majority of the speed is “done” by Boblight, a Hyperion port would be great.

        I’m not very familiar with the CuBox, but as far as I can see these are Android based – not what I’d call speed monsters. Seeing that CPU load is only 20%, it makes me indeed wonder what the deal is there. Looking at a post in the XBMC/Kobi forums, the config parameter “threadpriority” is being mentioned (set threadpriority to 99). As I understand, this parameter is not always implemented, but worth a try. 

        I have not seen any effect when I tested this way back when I build my setup, but I didn’t really try very hard either at the time to get this to work.

        Add this to the [device] section:

        threadpriority 99

        Reference: Boblightconf Wiki

        • threadpriority

        When this is set, it sets the scheduler of the device thread to SCHED_FIFO, and the number after it specifies the priority of the thread. The minimum and maximum values are determined by sched_get_priority_min() and sched_get_priority_max(), usual values for linux are 1 and 99. Setting this value will improve timing of the device thread.

        It is highly recommended that you set this to 99 when using a ws2801 device, because the ws2801 latches in data when the clock pin has been low for more than 500 microseconds, which might cause flicker when the boblightd device thread gets preempted during an spi write.

        In order to use this, the user you run boblightd as must have permissions to use SCHED_FIFO priority, the easiest way to accomplish this is to run boblightd as root, but this is not recommended (however it’s convenient for testing).

        If you want to give just your user SCHED_FIFO permissions, you can add this line to /etc/security/limits.conf:

        user – rtprio 99

        However this only works for PAM login shells, it will not work in a boot script.

        If you want to use SCHED_FIFO in boblightd, and run boblightd as a regular user, you can use this in your boot script:

        ulimit -r 99

        sudo -u user /usr/local/bin/boblightd

        For this to work the boot script has to run as root.

        Reply

        hans

  • Dec 7, 2014 - 5:13 AM - RanzQ Comment Link

    I have been struggling with the settings and different Arduino sketches for awhile and finally I think I got a working setup for Boblight with FastLED. I used this sketch at first but it caused this kind of flickering:
    https://www.youtube.com/watch?v=lB7RLaVdyOk
    I posted an issue to github and focalintent noticed that there’s a problem with the serial read and he provided a fix. So, here’s the fixed sketch I’m now using:

    #include <FastLED.h>
    #define NUM_LEDS 156
    #define DATA_PIN 6
    #define SERIALRATE 500000
    #define BLACK_THRESHOLD 20
    #define BLACK CRGB(0,0,0)
    #define CALIBRATION_TEMPERATURE TypicalLEDStrip // Color correction
    #define MAX_BRIGHTNESS 255 // 0-255
    CRGB incomes[NUM_LEDS];
    CRGB leds[NUM_LEDS];
    // Boblight Config Prefix
    static const uint8_t prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D};
    void setup() 
    {
      delay(1000);
      FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
      FastLED.setTemperature( CALIBRATION_TEMPERATURE );
      FastLED.setBrightness( MAX_BRIGHTNESS );
      Serial.begin(SERIALRATE);
    }
    void loop() 
    {
      for(byte p = 0; p < sizeof prefix; ++p) 
      {
    waitLoop: 
        while (!Serial.available());
        if(prefix[p] == Serial.read()) continue;
        p = 0;
        goto waitLoop;
      }
      Serial.readBytes((char*)incomes, NUM_LEDS*3);
      for( int i = 0; i < NUM_LEDS; i++)
      {
        CRGB *led = leds+i; 
        CRGB *income = incomes+i; 
        if( (*income).getAverageLight() < BLACK_THRESHOLD )
        {
          *led = BLACK; 
        }
        else
        {
          //(*led).nscale8_video(127); // 50% from previous
          //(*income).nscale8_video(127); // 50% from current
          //(*led) += (*income);
          (*led) = (*income);
        }
      }
      FastLED.show();
      // Drain the serial buffer (fixes flickering issue)
      while(Serial.available()>0){ Serial.read(); }
    }

    And the boblight settings (in boblight config maker I left the color settings to default, colors might still need a bit of fine tuning):
    – Speed: 80- Autospeed: 0- Interpolation: off- Saturation: 1.6- Value: 2.0- Threshold: 10.0
    My setup is latest KodiBuntu + Arduino Nano. 
    Here’s a video (sorry for the low audio volume): https://www.youtube.com/watch?v=2Uqdy2w59z8

    Reply

    RanzQ

    • Dec 7, 2014 - 5:30 AM - hans - Author: Comment Link

      Awesome!  Thanks RanzQ!

      As soon as I get home (late this week), I’ll give it a try!
      Always great to see improvements even on my own dabbling 

      Reply

      hans

      • Dec 7, 2014 - 8:36 AM - RanzQ Comment Link

        Thanks for this aweome tutorial too. :) I used your neopixel sketch for a while but it didn’t work so well when I tried to put more speed from boblight. With fastled the delay is now quite minimal. Have to try with a few movies to see if that speed is too fast for eyes. :)

        Also could try to adjust the saturation / value in boblight and different color temperatures for fastled. Do you know btw what does the ‘value’ mean? Cause I didn’t find what it is for.

        Reply

        RanzQ

      • Dec 7, 2014 - 11:06 AM - hans - Author: Comment Link

        Thanks  …

        I will most certainly start playing with NeoPixel! Specially if it reduces the delay! Good find! 

        As for the Saturation in the Boblight plugin: I honestly can only guess. It might be a multiplication factor, ie. 1 = normal, 0.5 is lower saturation, 1.5 is higher saturation. But I have no evidence to support that … 
        I can imagine that individual LEDs have a higher saturation than the LEDs in a TV screen.

        Reply

        hans

        • Dec 7, 2014 - 12:22 PM - RanzQ Comment Link

          I realized that the value means HSV value. And they both must be multipliers, actually they were explained somewhere in boblight related forum if I remember right. So, basically, according to that picture, lowering the saturation makes the colors closer to white and lowering the value makes them closer to black. If calibration is correct at Fastled (it has built in color correction), the colors should look as seen on TV if both are set to 1.0. I watched a movie and dark scenes often cast too bluish light when I had the value at 2.0. Trying with both at 1.0 for now.

          Reply

          RanzQ

        • Dec 8, 2014 - 2:53 AM - hans - Author: Comment Link

          Thanks RanzQ, also thanks for posting the HSV link! 

          The more info we collect here, the better educated we all become – good info!  

          Reply

          hans

    • Dec 7, 2014 - 2:20 PM - taytos Comment Link

      Thanks for posting this! I’m going to try it out later today. I tried a different FastLED sketch posted earlier in the comments and it was no good. That one didn’t work well with any LEDs over 180. I’m going to test with 196 and see. I will report my findings.

      Reply

      taytos

      • Dec 8, 2014 - 2:38 AM - hans - Author: Comment Link

        Looking forward to your findings,… I’m using 290 LEDs successfully with the sketch in this article, but I’d be pleased with any improvements we can come up with. 

        Reply

        hans

    • Dec 8, 2014 - 11:20 AM - RanzQ Comment Link

      I’m planning to make a test using hyperion.  First I thought it was for RPi only but it can be used with arduino too. People have commented that it’s better than boblight so going to give it a try. Here are the instructions if someone else is interested: http://forum.kodi.tv/showthread.php?tid=180472

      Reply

      RanzQ

      • Dec 8, 2014 - 11:51 AM - hans - Author: Comment Link

        Thanks again RnazQ! 

        Please let us know your findings, would be very interesting to find something faster than Boblight … 

        Reply

        hans

      • Dec 8, 2014 - 11:54 AM - hans - Author: Comment Link

        Seems it is more of a challenge when using OpenElec (instructions here – seems for RPi, but might work on others as well) – With a nice warning that updating OpenElec might brake it again.

        Reply

        hans

      • Dec 8, 2014 - 2:05 PM - RanzQ Comment Link

        Ok, got it working finally. Here’s my config (I can post the json if someone needs it):

        http://i.imgur.com/DOi9CbJ.png

        http://i.imgur.com/CSq4fq2.png

        http://i.imgur.com/ZZB44vY.png

        Notice the RGB Byte order, it must be RGB since Fastled handles the GRB if needed. Also the helper picture is from front of the screen, so the rotation is clockwise, when in boblight I had counter-clockwise. There’s still a small delay but I think it’s a bit faster than with boblight. You can play with the interval and smoothing. The prefix isn’t adjustable, so I found a processing code to calculate it: http://forum.kodi.tv/showthread.php?tid=132023&pid=1115381#pid1115381

        int N_LEDS = 25; // Max of 65536
        void setup()
        {
          byte[] buffer = new byte[6];
          noLoop();
          // A special header / magic word is expected by the corresponding LED
          // streaming code running on the Arduino. This only needs to be initialized
          // once because the number of LEDs remains constant:
          buffer[0] = 'A'; // Magic word
          buffer[1] = 'd';
          buffer[2] = 'a';
          buffer[3] = byte((N_LEDS - 1) >> 8); // LED count high byte
          buffer[4] = byte((N_LEDS - 1) & 0xff); // LED count low byte
          buffer[5] = byte(buffer[3] ^ buffer[4] ^ 0x55); // Checksum
        print("Prefix for "+N_LEDS+" LEDS: ");
        for(byte b : buffer)
           print(" "+hex(b));
        exit();
        }

        I just modified the prefix from the sketch and it works with hyperion now. Gotta try the android app for color calibration. 

        Reply

        RanzQ

      • Dec 8, 2014 - 5:20 PM - taytos Comment Link

        I’m curious to see your progress on this. Here is the post I was referring to earlier about hyperion running on something other than a RPi Right here. I’m going to see how this goes. I’m very hopeful.

        Also, your FastLED sketch works well for me. I tried it out last night. I first used 115200 as baud then upped it to 500000 and I could see the difference. Before I couldn’t get it to go past 460800. So thanks for that.

        Reply

        taytos

      • Dec 9, 2014 - 2:27 AM - hans - Author: Comment Link

        Thanks RanzQ and Taytos! Excellent find!

        I know what I’m going to be doing as soon as I get home! 

        Reply

        hans

      • Dec 9, 2014 - 2:41 AM - RanzQ Comment Link

        I found an improvement to the arduino sketch: https://code.google.com/p/adalight-ws2812/

        It had a checksum check so the prefix doesn’t have to be calculated manually. Modified my sketch to be similar. Also this seemed to work without the drain fix that I had before:

        #include <FastLED.h>
        #define NUM_LEDS 156
        #define DATA_PIN 6
        #define SERIALRATE 500000
        #define BLACK_THRESHOLD 10
        #define BLACK CRGB(0,0,0)
        #define CALIBRATION_TEMPERATURE TypicalLEDStrip // Color correction
        #define MAX_BRIGHTNESS 255 // 0-255
        // Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
        uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;
        CRGB leds[NUM_LEDS];
        CRGB incomes[NUM_LEDS];
        void setup()
        {
          FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
          FastLED.setTemperature( CALIBRATION_TEMPERATURE );
          FastLED.setBrightness( MAX_BRIGHTNESS );
          // initial RGB flash
          // LEDS.showColor(CRGB(255, 0, 0));
          // delay(500);
          // LEDS.showColor(CRGB(0, 255, 0));
          // delay(500);
          // LEDS.showColor(CRGB(0, 0, 255));
          // delay(500);
          // LEDS.showColor(CRGB(0, 0, 0));
          Serial.begin(SERIALRATE);
          Serial.print("Ada\n"); // Send "Magic Word" string to host
        }
        void loop() {
          // wait for first byte of Magic Word
          
          for(i = 0; i < sizeof prefix; ++i) {
            waitLoop: 
            while (!Serial.available());
            if (prefix[i] == Serial.read()) continue;
            i = 0;
            goto waitLoop;
          }
          // Hi, Lo, Checksum
          while (!Serial.available());
          hi = Serial.read();
          while (!Serial.available());
          lo = Serial.read();
          while (!Serial.available());
          chk = Serial.read();
          // if checksum does not match go back to wait
          if (chk != (hi ^ lo ^ 0x55)) {
            i = 0;
            goto waitLoop;
          }
          Serial.readBytes((char*)incomes, NUM_LEDS*3);
          for(i = 0; i < NUM_LEDS; i++) {
            CRGB *led = leds+i; 
            CRGB *income = incomes+i; 
            if( (*income).getAverageLight() < BLACK_THRESHOLD ) {
              *led = BLACK; 
            } else {
              //(*led).nscale8_video(127); // 50% from previous
              //(*income).nscale8_video(127); // 50% from current
              //(*led) += (*income);
              (*led) = (*income);
            }
          }
          // shows new values
         FastLED.show();
        }
        Reply

        RanzQ

      • Dec 9, 2014 - 2:49 AM - hans - Author: Comment Link

        Awesome RanzQ! 

        I very much appreciate you digging in deeper and sharing your experiences here! 

        Reply

        hans

    • Dec 9, 2014 - 3:10 AM - RanzQ Comment Link

      I’ve put the sketch also to github so it doesn’t get lost. 

      https://github.com/RanzQ/adalight-fastled

      I’m still wondering why some of the baud rates work and some don’t. I ended up to 500000 after checking this:

      http://www.wormfood.net/avrbaudcalc.php?postbitrate=500000&postclock=16&bit_rate_table=1&hidetables=1

      See the color table at bottom, it tells that error rate is zero with 500000 but not with 115200. My Nano specs say 16 MHz so I used it in that calculator. I’m quite newbie with the low-level stuff. 

      Reply

      RanzQ

      • Dec 9, 2014 - 7:29 AM - hans - Author: Comment Link

        Nice find!

        I can only image why certain speeds work very well, were other [lower] speeds fail.

        • Calculation issue. Maybe there is a rounding error or something like that, causing certain values to go bonkers. Not sure what UBRR registers are, but I’m sure they are used to calculate the proper speed. When looking at UBRR and Clockspeed, then certain speeds show a mismatch, possibly the cause of issues.
        • The data goes over a simple copper wire. Maybe certain speeds hit the magic zone where the pulse speed actually causes interference.
        Keep in mind though; I’m not an expert on these details either. Just recall some funky stuff from back in the day when a 9600 baud modem was considered super fast. 

        Reply

        hans

      • Dec 9, 2014 - 8:58 AM - RanzQ Comment Link

        I also found the “official” hyperion sketch: https://gist.github.com/tvdzwan/9008833

        I don’t know why it was so hard to find it, was linked in github issues. Anyway, it seems to be written for older FastLED, so maybe my version is better. 

        Reply

        RanzQ

  • Dec 9, 2014 - 3:53 PM - mrBic Comment Link

    Hello tweak4all,

    I have the following issue, I uploaded the sketch with the 154 leds i use and it only lights up 48 leds and then another 40 are blinking, this is also the case with a test sketch.

    The psu i use is 5 volt 7amp could it be that i need 9.24 amp and there for not all leds are working?

    Thanks in advance!

    Mr Bic

    Reply

    mrBic

    • Dec 10, 2014 - 4:08 AM - hans - Author: Comment Link

      Hi Mr. Bic!

      Two possible causes;

      1. Your powersupply might not keep up … as always, some power supplies exaggerate about their potential “power” … which could mean that a pull of too many amps will cause a drop in voltage or worse. Considering that you’re using only half the number of LEDs I do, I’d say that 7A should be sufficient (I use 10A for 290 LEDs).

      2. The connections between strips might not be conducting all that great. Only applicable of course if you use individual strips. Check and see if the issues occur specifically after a specific connection.

      3. An issue I ran into myself was that one or two LEDs in the strand were defective and caused following LEDs not to work or behave oddly. To test this, if you have access, is by bypassing the LED as of which point “problems” occur.

      Hope this helps you “debugging” this issue …  

      Reply

      hans

      • Dec 12, 2014 - 5:08 PM - mrBic Comment Link

        Hello Hans,

        Thanks for the response, I RMA the psu and got a 5volt 16 amps one, now all leds are one but they blink from led 48 till the end, if I dc the arduino from the pc/openelec left and right lit up in the configured color the top strip lit up in red and blue.

        Should I try option 3 that you suggest? or could this be software related?

        Regards,

        Mr Bic

        Reply

        mrBic

        • Dec 13, 2014 - 5:39 AM - hans - Author: Comment Link

          Option 3 is relatively easy to test, if you can reach the 3 connectors between the LEDs. Meaning: if you don’t have a cover over it.

          You can short “Di” of LED-1 to “Do” of LED-1 to “skip” this LED. I’d take the LED just before the issue begin (so LED 47 in your case), and the one where it actually begins (LED 48).

          So, since as of LED 48 things start flickering, first test:

          Connect “Di” of LED47 to “Do” of LED 47.
          If that doesn’t improve things, do the same for LED 48.

          You can use a simple copper wire for this, holding them on “Di” and “Do”.
          The “proper” way of doing this, is by making this connection before switching everything on.
          I personally, with my own stuff (!), wouldn’t mind doing this while everything is on, but you have to be very careful that the wire will not tought +5 and/or GND, which will cause an undesired short, potentially damaging the LED and/or your Arduino.

          Reply

          hans

          • Dec 14, 2014 - 6:50 AM - mrBic Comment Link

            Hello Hans,

            So I have bin fiddling around and now I have everything hooked up and semi working. When everything starts the led strand (all of them) lights up white as configured.

            But if openelec shows the main screen i have 3 to 4 blinking leds at the start of my third led strand at the right side while they should be out. I tried setting the data signal from the second to the third strand with no succes. 

            I run the test sketch again and that works good, swirls rainbows and that kinda things from beginning to the end all good, so iam a little confused now it its software or hardware.

            I meassured the voltage comming trough the strand and upped/adjusted the psu  so the third led strand also has 5 volt instead of 4.9.

            when I start a movie it all works but when the screen goes black in between scenes leds go black and the same 3 blink.

            Last comment I have is that when i hook everything up to a raspberry with openelec the the led blinking starts from led 6 to 9 on the third led strand.

            Thanks in advance for your time!

            Mr Bic

            mrBic

          • Dec 14, 2014 - 8:31 AM - hans - Author: Comment Link

            Hi MrBic,

            My first guess would be that your 3rd strands has some defective LEDs that do not seem to reset properly to “off”. Can you, temporary, disable strand 3 (bypass it completely) to see if the oddities occur in strand 4? (if you have a 4th strand). Or swap the strand, temporary, with another one?

            Seems your voltage/PSU is fine now,…

            hans

        • Dec 16, 2014 - 5:36 PM - mrBic Comment Link

          Hello Hans,

          You where right! third strand had defected leds, I swapped it for another strand and everything is working as it should now!

          Thanks for the awesome guide as you made it really easy for me to understand and build!

          Regards,

          Mr Bic

          Reply

          mrBic

  • Dec 11, 2014 - 10:12 AM - Nicolas Comment Link

    Hi,

    Firstly, very nice project ;)

    I would like to know if it’s better to use a Raspberry Pi or an Arduino Uno ?

    And is it possible to use it with XBMC for Windows ?

    Thanks ! 

    Reply

    Nicolas

    • Dec 12, 2014 - 8:04 AM - hans - Author: Comment Link

      I’ve not yet used “just” a Raspberry Pi for this kind of project.

      Commonly you’ll see a computer handling XBMC/Kobi.
      This can be a regular Windows PC, a Linux (recommend OpenElec!) or Mac, or a Raspberry Pi (running OpenElec, RaspBMC). I prefer to have some good power, so I always use an [OpenElec] PC (not RPi).

      For controlling the LEDs, the Arduino is used as a USB device for the XBMC player.

      For Windows, you’ll find some good tips in these comments, since Boblight and the XBMC plugin work slightly different. But people have successfully used this combo.

      Technically one could use the PIO pins of the Raspberry Pi, but due to the nature of the operating system (not being realtime) and the available resource (CPU) being limited, I suspect this might be difficult to run smoothly.

      Hope this helps 

      Reply

      hans

      • Dec 12, 2014 - 8:22 AM - Nicolas Comment Link

        Many thanks, so I can start to search all hardware to made it myself :)

        A last question : could you tell me what is the name / type / other of blue-red-green wires with connector ? I can’t find it.

        Thanks !

        Reply

        Nicolas

      • Dec 12, 2014 - 9:40 AM - hans - Author: Comment Link

        Hi Nicolas! 

        Not very obvious to find, but the info on those connectors can be found in this post (above).

        So called 3-pin JST SM connectors” (example link to eBay ). Pretty cheap, $10/20 connectors. 

        I have to admit that the name can be hard to figure out (took me a while as well). 

        Reply

        hans

        • Dec 12, 2014 - 10:35 AM - Nicolas Comment Link

          Hi Hans, 

          Thank you ! I’ll try to find but I’m French ans it seems to be more difficult to find LEDs stripes ans components.  

          Thank you again !

          Reply

          Nicolas

        • Dec 12, 2014 - 10:51 AM - hans - Author: Comment Link

          Hi Nicolas,

          I’m sure when you order through ebay that it will be delivered in France,… Not sure if customs in France is such a pain as the one from Holland, … I hear others ordering from Amazon, and from AliExpress/Alibaba (the latter wouldn’t be my first choice).

          Reply

          hans

          • Dec 12, 2014 - 5:54 PM - Nicolas Comment Link

            Thanks again, I’ve said it was the last question but I’ve another : do you use 30 leds/meter or 60 leds/meter ? And have you tried diffference between both ?

            Thanks !

            Nicolas

          • Dec 13, 2014 - 5:32 AM - hans - Author: Comment Link

            No Problem 

            I use 60 LEDs/m, the only obvious difference is really the space between the LEDs being bigger with 30 LEDs/m vs 60 LEDs/m.
            Since some other have used even less LEDs/m, 30 LEDs/m might work just fine for your purposes.
            The “gaps” between the LEDs will be bigger and the total amount of light will be a little less of course.
            If anyone here uses 30 LEDs/m, please post your findings! 

            hans

          • Dec 14, 2014 - 4:19 AM - Nicolas Comment Link

            Thanks Hans, it’s a pleasure to talk with you :)

            A little advice : do you think it’s better to install LEDs “in front of a wall” or each side of the TV (with 90° angle compared to TV) ? I’ve seen both, but 90° angle seems to be often used with “classic” LED, not SMD.

            Thanks !

            Nicolas

          • Dec 14, 2014 - 8:19 AM - hans - Author: Comment Link

            Hi Nicolas,

            You’re most welcome! 

            Honestly haven’t tried the “pointing the LEDs to the outside” (vs pointing to the wall).
            I think pointing towards the wall will be the best, since the wall reflects the light best this way.

            But that’s just my opinion … the larger loose LEDs also “radiate” light sideways much better than the tiny flat SMD LEDs on strips, so they would probably work fine either way.

            hans

  • Dec 11, 2014 - 3:25 PM - David Comment Link

    Hi,

    Is it necessary to add a power supply to Arduino or USB power is sufficient ? I will add of course a power supply to LEDs ;)

    Thanks !

    Reply

    David

    • Dec 12, 2014 - 7:57 AM - hans - Author: Comment Link

      Hi David!

      The Arduino can be powered through the USB, no separate powersupply needed.

      Obviously, because of the high Amps needed, you’d need one for the LEDs.

      The above shown connections do exactly that. Power Arduino through USB and power LEDs separately.

      Reply

      hans

  • Dec 19, 2014 - 12:13 PM - Dennis Comment Link

    I finally got it working, but I might be needing a fine tune.

    I have 112 LEDs (36+20+36+20). When I run the test video I see that when the vertical stripes come in, it does not disable my leds on these positions. It does on the wider stripes.

    I want boblight to turn of the LED if there is black at that particular spot.

    Can you advice?

    Reply

    Dennis

    • Dec 20, 2014 - 8:41 AM - hans - Author: Comment Link

      Hi Dennis,

      glad to hear you’ve got it to work!

      As for the vertical stripes: I think this might have to do with the “resolution” and “position” of your LEDs. To get this perfect might be challenging, but I don’t think it’s impossible. I’d start playing with the size and position of the LED “blocks” in the config file. If it were me, then I’d probably first look were roughly the thinner black lines are on the screen and then try to match it to a specific LED.

      The problem you’re most likely running into is that the black thinner line is not 100% matching the LED “block”, so Boblight will take an average, which might include some white as well.

      Reply

      hans

  • Dec 20, 2014 - 2:47 AM - RanzQ - Author: Comment Link

    I’d like to introduce my project for hyperion: https://github.com/RanzQ/hyperion-audio-effects

    It’s working for Linux (on Windows a bit laggy), but my goal is to get it running via the hyperion effects engine.

    Reply

    RanzQ

    • Dec 20, 2014 - 8:38 AM - hans - Author: Comment Link

      Nice! Thanks for sharing you “Hyperion audio effects” project RanzQ! Awesome! 

      Reply

      hans

  • Dec 28, 2014 - 4:08 AM - Tidehunter Comment Link

    Guys,

    Maybe this will help anybody. Just want to tell you how I fixed flickering problem (arduino nano + win8 + ambibox 2.1.6)

    I took the sketch from this site and updated fastled library from here

    Now the flickering is gone.

    Reply

    Tidehunter

    • Dec 28, 2014 - 4:21 AM - hans - Author: Comment Link

      Thanks TideHunter for posting the tip – I’m sure others will benefit from it! 

      Reply

      hans

  • Jan 2, 2015 - 9:18 AM - tzahi Comment Link

    HELLO

    First thanks alot of this grate guide.

    I have 2 questions about the config file I need to create using the config maker.

    picture

    I add a picture show that in the creator the device menu is upside down (so I don’t know if the perfix is right like this).

    what’t do you think ? is it a probleam or to leave like this ?

    second question, I undestand that the Baudrate need to be the same as in the skatch, so why in the sketch the value is 460800 and in the config make is 115200 ? what to do ?

    thanks 

    Reply

    tzahi

    • Jan 2, 2015 - 12:02 PM - hans - Author: Comment Link

      Hi Tzahi,

      I’m not sure what you mean with the picture upside down?

      As for the baudrate: the application defaults to 115200 since this can be a limit for Windows machines. It should match the speed in the sketch. So if you choose 115200, then set it to 115200 in the sketch as well. I actually had good results with lower speeds as well (even 9600). Try a low speed first (ie. 9600) and go to higher speeds later when you see that things seem to work OK.

      Reply

      hans

  • Jan 3, 2015 - 1:30 AM - tzahi Comment Link

    Thanks

    I think I can Increase the baudrate to 460800 in the config creator, will it be better than changing the sketch ?

    about the first question, my mistake, I didn’t meant upside down, I meant that the square near perfix is writen from right to left at my computer, and in picture in the guide and in the sketch is writen left to right (please se the picture I add before).

    I don’t know why it happen like this.

    Reply

    tzahi

    • Jan 3, 2015 - 3:35 AM - hans - Author: Comment Link

      I’d start with 115200 in the sketch and the config file.

      I think you meant the checkbox near prefix that’s displayed on the left of the text but on the right on your screenshot?
      I suspect it might have to do with the language settings of your PC, I wouldn’t worry about it … 

      Reply

      hans

  • Jan 3, 2015 - 8:52 AM - Nicolas Comment Link

    Hi :)

    I’m back :D I’ve received all elements to make my own Ambilight (WS2812B, power supply 5V 10A, Arduino Uno and I’ve even bought a RPi but it’s only to test).

    I’ll build my frame today or tomorrow then I’ll setup LEDs and Arduino Uno.

    I’ve read some informations about Hyperion but it’s not very clear : is it possible to use Arduino Uno and Hyperion on Windows OS now ? Or Hyperion must work with a RPi ?

    Thanks !

    Reply

    Nicolas

    • Jan 4, 2015 - 2:17 AM - hans - Author: Comment Link

      Hi Nicolas,

      Welcome back!  

      As far as I know is Hyperion created with RPi in mind. Some users however seem to have managed to get Hyperion to run on other hardware running Linux and/or Windows. You’d have to Google that, a first attempt by myself didn’t bring up any very clear info … but others did experiment with that.

      Reply

      hans

      • Jan 4, 2015 - 4:04 AM - Nicolas Comment Link

        Thanks :)

        I’ve contacted RanzQ to ask him how to use his project, I’m waiting for him ;)

        I would like to use Hyperion because it can be controled with an Android app, so when I don’t use Ambilight for a movie I would like to use it for “decoration”…

        Reply

        Nicolas

      • Jan 5, 2015 - 2:36 AM - hans - Author: Comment Link

        As soon as I can work with my equipment again (traveling right now), maybe we can start a new article based on RanQ’s findings.
        Would be awesome to run a lightweight Boblight like Hyperion on Windows, Linux, Max and Android,…

        Reply

        hans

  • Jan 5, 2015 - 3:11 AM - hans - Author: Comment Link

    Since a few users (also in the Dutch version of this article) are interested in playing with Hyperion (instead of Boblight), here a link to an article on the Kodi/XBMC forums, explaining Hyperion installation for Linux and Android. I hope this is helpful.

    For those unfamiliar with Hyperion: 
    Hyperion is a lightweight Boblight alternative, originally developed for Raspberry Pi. It’s not only small but also very efficient with CPU resources, promising a more responsive alternative to Boblight.

    I have not tested this [yet], as I do not have access to my hardware at the moment.

    For those who tried: please let us know your findings! 

    Content of the article: (source – by illiac4 at the Kodi forum)

    On Raspberry Pi Hyperion is very popular. So here is the tutorial how to compile it on Linux (and Android) and use it. It is uses almost no CPU usage like 1% for 100LEDs compared to boblight which was using around 30-35% of cpu usage on AppleTV with CB2. On my Atom D2550 it is not worth a mention.

    I am using it also on regular HTPC based on Linux.

    First install pre-requirements and then compile:

    sudo apt-get update
    sudo apt-get install git cmake build-essential libprotobuf-dev libQt4-dev libusb-1.0-0-dev protobuf-compiler python-dev
    cd /tmp
    git clone https://github.com/tvdzwan/hyperion.git
    cd hyperion
    cmake -DENABLE_DISPMANX=OFF
    sudo make
    sudo mkdir -p /media/scripts/hyperion
    sudo cp -a /tmp/hyperion/effects /media/scripts/hyperion/effects
    sudo cp /tmp/hyperion/bin/hyperion-remote /usr/bin/
    sudo cp /tmp/hyperion/bin/hyperiond /usr/bin/
    sudo chmod +x /usr/bin/hyperion-remote
    sudo chmod +x /usr/bin/hyperiond

    Now you have compiled Hyperion and the binaries are now in place.

    In next step we will make it autostart. In Rpi it uses upstart script but in Linux HTPC the best way to start it is using autoexec.py under userdata folder of XBMC.

    If the file is not there then just create it and put this inside:

    import os, sys
    os.system('/media/scripts/hyperion_startup.sh');
    sys.exit()

    So now lets create the script under /media/scripts/hyperion_startup.sh

    The content of the script should be:

    #!/bin/bash
    /usr/bin/hyperiond /etc/hyperion.config.json >/dev/null 2>&1 &

    And also do not forget to make it executable.

    Maybe you can put the line (/usr/bin/hyperiond /etc/hyperion.config.json >/dev/null 2>&1 &) directly into autoexec.py, but i did not try.

    Now we need to create config file for Hyperion. Just download the file HyperCon from their page https://github.com/tvdzwan/hyperion/wiki/configuration and do a little reading.

    With the tool create a config file. Make sure that you will set the right type like “adaligh,…”, the right bound rate (very important!!!). adalight is using 115200 boundrate, the right type of LEDs (2801,…). For non RPi devices you can disable XBMC checker under the tab “External”.

    After you have created hyperion.config.json file, copy them under /etc/

    Now you need to download the addon for Hyperion. It is similar like the one from Boblight. You can get it here https://github.com/tvdzwan/hyperion/wiki…for-RPi%29

    This was the first step of compiling and basic installation of Hyperion.

    Note: Boblight and Hyperion can not run at the same time since they are using the same port and the same device. So disable the boblight first.

    If you would like to use the Hyperion with the light on all the time, also on visualizations and also on menus then you can use the boblight-x11 daemon. You will need to compile boblight and use just the binaries boblight-x11 (boblightd and boblight-constant you can delete).

    With this command you can call Hyperion with X11:

    /usr/bin/hyperiond /etc/hyperion.config.json >/dev/null 2>&1 &
    DISPLAY=:0.0 /usr/bin/boblight-X11 -f -x > /dev/null 2>&1 &

    For easy finding of perfect light configuration use Android app Hyperion from the google market. With this app you can see in realtime how the parameters effects the ambilight. When you will find the perfect spot just enter it into HyperConf.

    Reply

    hans

    • Jan 5, 2015 - 6:04 AM - Nicolas Comment Link

      Hi,

      Very interesting !

      I have build my Ambilight yesterday, I have a little (hardware ?) problem but I’ll look at this.

      About this article, how can we connect Ambilight to Linux HTPC ? With Arduino ? If yes, do ou have informations about sketch to use ?

      Thanks !

      Reply

      Nicolas

    • Jan 5, 2015 - 6:19 AM - hans - Author: Comment Link

      Hi Nicolas!

      This article is based on OpenElec, which in essence is Linux. So everything will be the same.

      So: 

      1) HTPC -> Arduino -> LED strands.

      2) Install Boblight and get the Boblight addon (assuming you’re using XBMC/Kodi).

      The sketch should be the same, the device in the Boblight config files is most likely called “momo” (see als Boblight Config Maker article).

      Ehm …. Unless you’re referring to the Hyperion Article …?
      In that case we’d still used the same hardware, however we replace Boblight with Hyperion and Hyperion’s config file seems very similar to the one used by Boblight. In theory anyway … I have not been able to test all of this.

      Reply

      hans

      • Jan 5, 2015 - 6:44 AM - Nicolas Comment Link

        Yes pardon me if I expressed myself poorly, I was talking about Kodi article. I think sketch is different, like RanzQ said in another comment.

        Reply

        Nicolas

      • Jan 5, 2015 - 7:24 AM - hans - Author: Comment Link

        No problem … I wasn’t 100% awake either … and just realized at the end that you might actually be talking about something else .

        Reply

        hans

      • Jan 5, 2015 - 4:38 PM - Nicolas Comment Link

        So, I have made a new test with Arduino Uno and Raspberry Pi and now all is OK with Hyperion ! (except a hardware bug, I think, because in a corner a LED seems to not work all the time and so next LEDs don’t work anymore so I’ll try to replace this LED and I hope it will be OK).

        My RPi is running OpenElec, so I could think it will be OK with OpenElec ? If I can I will install OpenElec on my HTPC and run with Arduino Uno

        Reply

        Nicolas

        • Jan 5, 2015 - 10:58 PM - Jason Olliff Comment Link

          So due to the LED delays (too slow of a baudrate) I’ve been experiencing with XBMC in Windows + Arduino, I decided it was time to go the RPi + Hyperion route. Unfortunately, from what I’ve found so far, it looks like Hyperion is almost strictly meant to work with WS2801 LED’s (four wires, the extra acting as a clock for additional timing), and does not appear to support WS2811/2812 strands (3 wires)…. 

          If anyone has seen evidence to support 2811/2812’s over Hyperion, PLEASE post here, as I’m really not wanting to purchase another set of LED’s just to get Hyperion working. Unfortunately, I’m already invested with all the other needed hardware. Nicolas – it sounds like you have it working with a 2812 strand, right? If so, can you share your config file settings?

          I’m also considering this method , and pray that it will work with 2811’s, as it would be great to play any content from an HDMI source. Still need to find the time to test.. and will gladly report my findings.

          Reply

          Jason Olliff

          • Jan 6, 2015 - 1:27 AM - Nicolas Comment Link

            Yes I’m using RPi + Arduino Uno + Hyperion + WS2812B LEDs strip ;)

            On Arduino Uno, I use this sketch : http://pastebin.com/zhQCRFhd

            But I have made few modifications like this :

            – define NUM_LEDS 240 : replace by LEDs number

            – define DATA_PIN 6 : replace by PIN number

            – define COLOR_ORDER RGB : replace RGB by GRB

            – FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); : replace RGB by COLOR_ORDER and if you use WS2811, replace WS2812B also

            I use Arduino 1.0.6 and I have also change buffer size on the Arduino Uno from 64 to 256 : http://www.hobbytronics.co.uk/arduino-serial-buffer-size

            Thanks to rick164 from MediaPortal forum for all informations ;)

            Nicolas

          • Jan 6, 2015 - 2:25 AM - hans - Author: Comment Link

            @Nicolas;
            If you have a link to the relevant posts at the MediaPortal, then please feel free to post those here 

            hans

          • Jan 6, 2015 - 2:54 AM - Nicolas Comment Link

            @Hans : When I add the link, my reply doesn’t seem to appear :(

            Nicolas

          • Jan 6, 2015 - 2:57 AM - hans - Author: Comment Link

            @Nicolas:

            Oh that’s … different …
            Are you using the link button? You can post it as plain text as well (even though it will not become clickable) … 

            hans

          • Jan 6, 2015 - 4:33 AM - Nicolas Comment Link

            @Hans : Yes I’ve tried with or without link button, same result…

            Nicolas

          • Jan 6, 2015 - 4:47 AM - hans - Author: Comment Link

            @Niclos: 

            What browser and OS are you using (so I might be able t debug the editor).

            The link you’re talking about, is it this one at MediaPortal?

            hans

          • Jan 6, 2015 - 6:48 AM - Nicolas Comment Link

            @Hans : I’ve tried with Chrome on Win 7 and Chrom on Win 8. And no the good link is the same until threads/ but there is diy-in-progress-amblight-project-guide-hyperion-ws2801-ws2812b.128526/ after

            Nicolas

          • Jan 6, 2015 - 7:39 AM - hans - Author: Comment Link
          • Jan 6, 2015 - 8:08 AM - Nicolas Comment Link

            Yes the link is OK with you, I don’t know why not for me

            Nicolas

          • Jan 6, 2015 - 8:34 AM - hans - Author: Comment Link

            Might be a security setting of my server and/or WordPress setup … (I’m an Admin so I won’t run into many limitations)
            Sorry for the inconvenience and thank you for the helpful info! 

            hans

  • Jan 5, 2015 - 4:59 AM - Zack Comment Link

    Any chance anyone has code to get WS2812 working in Windows without using Xbmc/Kodi? 
    Ive followed various tutorials online and attempted to modify the code to get it working with my 92 LED setup but it just wont work. Ive asked on a few forums as well but nobody seems willing to help. I want to be able to use the lighting I made with Media Player Classic and Netflix. 
    -Zack

    Reply

    Zack

    • Jan 5, 2015 - 5:53 AM - hans - Author: Comment Link

      Hi Zack,

      well that’s a tricky one indeed … 

      After some searching I did find something called “MoMo” light, where the state the following for use with Boblight.
      I carefully assume that MoMo uses Boblight as well, just the hardware might be different, which should not be a problem.

      Windows Media Player (WMP) Classic (with Boblight):
      Start WMP Classic, go to view and select options. In the options menu go to playback and select output. In the output screen select under DirectShow Video VMR9 (renderless)**! Now restart WMP Classic and open a video (either DVD, avi, divx or something else). The Momolight system should now work with WMP Classic using the Boblight software!

      Windows Media Player (WMP): The only way to get Momolight working with standard WMP is by turning of overlay (for example by turning of Hardware Acceleration with your video device). This also only works together with the Boblight software.

      VLAN player (with Boblight): Setting the video output in the video options menu to OpenGL will enable AmbX lighting effects with playback of video’s (DVD, divx, etc) with the VLAN player.

      I hope this is helpful – please let us know 

      Reply

      hans

    • Jan 5, 2015 - 7:00 AM - Tidehunter Comment Link

      Hi, you can try ambibox 2.1.6. and adalight-ws2812 arduino sketch.

      Reply

      Tidehunter

      • Jan 6, 2015 - 2:22 AM - Zack Comment Link

        Ended up getting Ambibox mostly working. Playclaw does not fully work for apps like MPCHC – it only works in windowed mode for some reason. I am running Windows 7 with the latest versions of both. Here is what I used:

        // Slightly modified Adalight protocol implementation that uses FastLED
        // library (http://fastled.io) for driving WS2811/WS2812 led stripe
        // Was tested only with Prismatik software from Lightpack project
         
        #include "FastLED.h"
         
        #define NUM_LEDS 92 // Max LED count
        #define LED_PIN 6 // arduino output pin
        #define GROUND_PIN 10
        #define BRIGHTNESS 90 // maximum brightness
        #define SPEED 115200 // virtual serial port speed, must be the same in boblight_config
         
        CRGB leds[NUM_LEDS];
        uint8_t * ledsRaw = (uint8_t *)leds;
         
        // A 'magic word' (along with LED count & checksum) precedes each block
        // of LED data; this assists the microcontroller in syncing up with the
        // host-side software and properly issuing the latch (host I/O is
        // likely buffered, making usleep() unreliable for latch). You may see
        // an initial glitchy frame or two until the two come into alignment.
        // The magic word can be whatever sequence you like, but each character
        // should be unique, and frequent pixel values like 0 and 255 are
        // avoided -- fewer false positives. The host software will need to
        // generate a compatible header: immediately following the magic word
        // are three bytes: a 16-bit count of the number of LEDs (high byte
        // first) followed by a simple checksum value (high byte XOR low byte
        // XOR 0x55). LED data follows, 3 bytes per LED, in order R, G, B,
        // where 0 = off and 255 = max brightness.
         
        static const uint8_t magic[] = {'A','d','a'};
        #define MAGICSIZE sizeof(magic)
        #define HEADERSIZE (MAGICSIZE + 3)
         
        #define MODE_HEADER 0
        #define MODE_DATA 2
         
        // If no serial data is received for a while, the LEDs are shut off
        // automatically. This avoids the annoying "stuck pixel" look when
        // quitting LED display programs on the host computer.
        static const unsigned long serialTimeout = 150000; // 150 seconds
         
        void setup()
        {
          pinMode(GROUND_PIN, OUTPUT);
          digitalWrite(GROUND_PIN, LOW);
          FastLED.addLeds<WS2811, LED_PIN, BRG>(leds, NUM_LEDS);
         
          // Dirty trick: the circular buffer for serial data is 256 bytes,
          // and the "in" and "out" indices are unsigned 8-bit types -- this
          // much simplifies the cases where in/out need to "wrap around" the
          // beginning/end of the buffer. Otherwise there'd be a ton of bit-
          // masking and/or conditional code every time one of these indices
          // needs to change, slowing things down tremendously.
          uint8_t
            buffer[256],
            indexIn = 0,
            indexOut = 0,
            mode = MODE_HEADER,
            hi, lo, chk, i, spiFlag;
          int16_t
            bytesBuffered = 0,
            hold = 0,
            c;
          int32_t
            bytesRemaining;
          unsigned long
            startTime,
            lastByteTime,
            lastAckTime,
            t;
          int32_t outPos = 0;
         
          Serial.begin(SPEED); // Teensy/32u4 disregards baud rate; is OK!
         
          Serial.print("Ada\n"); // Send ACK string to host
         
          startTime = micros();
          lastByteTime = lastAckTime = millis();
         
          // loop() is avoided as even that small bit of function overhead
          // has a measurable impact on this code's overall throughput.
         
          for(;;) {
         
            // Implementation is a simple finite-state machine.
            // Regardless of mode, check for serial input each time:
            t = millis();
            if((bytesBuffered < 256) && ((c = Serial.read()) >= 0)) {
              buffer[indexIn++] = c;
              bytesBuffered++;
              lastByteTime = lastAckTime = t; // Reset timeout counters
            } else {
              // No data received. If this persists, send an ACK packet
              // to host once every second to alert it to our presence.
              if((t - lastAckTime) > 1000) {
                Serial.print("Ada\n"); // Send ACK string to host
                lastAckTime = t; // Reset counter
              }
              // If no data received for an extended time, turn off all LEDs.
              if((t - lastByteTime) > serialTimeout) {
                memset(leds, 0, NUM_LEDS * sizeof(struct CRGB)); //filling Led array by zeroes
                FastLED.show();
                lastByteTime = t; // Reset counter
              }
            }
         
            switch(mode) {
         
             case MODE_HEADER:
         
              // In header-seeking mode. Is there enough data to check?
              if(bytesBuffered >= HEADERSIZE) {
                // Indeed. Check for a 'magic word' match.
                for(i=0; (i<MAGICSIZE) && (buffer[indexOut++] == magic[i++]););
                if(i == MAGICSIZE) {
                  // Magic word matches. Now how about the checksum?
                  hi = buffer[indexOut++];
                  lo = buffer[indexOut++];
                  chk = buffer[indexOut++];
                  if(chk == (hi ^ lo ^ 0x55)) {
                    // Checksum looks valid. Get 16-bit LED count, add 1
                    // (# LEDs is always > 0) and multiply by 3 for R,G,B.
                    bytesRemaining = 3L * (256L * (long)hi + (long)lo + 1L);
                    bytesBuffered -= 3;
                    outPos = 0;
                    memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
                    mode = MODE_DATA; // Proceed to latch wait mode
                  } else {
                    // Checksum didn't match; search resumes after magic word.
                    indexOut -= 3; // Rewind
                  }
                } // else no header match. Resume at first mismatched byte.
                bytesBuffered -= i;
              }
              break;
         
             case MODE_DATA:
         
              if(bytesRemaining > 0) {
                if(bytesBuffered > 0) {
                  if (outPos < sizeof(leds))
                    ledsRaw[outPos++] = buffer[indexOut++]; // Issue next byte
                  bytesBuffered--;
                  bytesRemaining--;
                }
                // If serial buffer is threatening to underrun, start
                // introducing progressively longer pauses to allow more
                // data to arrive (up to a point).
              } else {
                // End of data -- issue latch:
                startTime = micros();
                mode = MODE_HEADER; // Begin next header search
                FastLED.show();
              }
            } // end switch
          } // end for(;;)
        }
         
        void loop()
        {
          // Not used. See note in setup() function.
        }
        Reply

        Zack

        • Jan 6, 2015 - 2:27 AM - Zack Comment Link

          I think I figured out the problem… I am using MadvR with MPCHC to get the maximum image quality out of my videos. I think when it goes full screen it is rendered different or something because it works after I changed it. 

          Reply

          Zack

          • Jan 6, 2015 - 2:45 AM - Zack Comment Link

            Fixed it. 

            I went into MadVR settings and disabled exclusive full screen mode. 

            Just to recap:
            You can use the sketch I posted and it is fully compatible with Ambibox using WS2812b leds. I have tried using both a genuine Arduino Uno and a generic Arduino Uno “compatible” device. After messing around with Ambibox and half a dozen other similar programs I cannot fathom why anyone would use anything but Ambibox. 

            Zack

          • Jan 6, 2015 - 2:55 AM - hans - Author: Comment Link

            Thanks Zack,

            I guess most of us do not use AmbiBox because we are simply not familiar enough with it, and because it’s Windows only, where as most people use Linux (either x86 based or Raspberry Pi based) … (correct me if I’m wrong please! )

            For those that are interested:

            AmbiBox Homepage
            AmbiBox Downloads

            hans

          • Jan 6, 2015 - 3:05 AM - Zack Comment Link

            I use Windows because MadVR is not available in Linux. The difference in image quality when using properly set up hardware assisted rendering is borderline mind blowing. The worse quality the original source is (480p for example) the more of a difference you will see when using MadVR. Artifacts, fuzz and other visual garbage is non-existent with my ripped and compressed TV seasons.

            Zack

          • Jan 6, 2015 - 3:11 AM - hans - Author: Comment Link

            As soon as I can access my equipment again, I’ll give MadVR a try.
            Most of us do not like to have to purchase a Windows license or prefer to use cheap hardware not capable of running Windows properly combined with a media player … 
            But since I do have a Windows laptop laying around, I will give it a try! 

            hans

    • Jan 5, 2015 - 7:22 AM - hans - Author: Comment Link

      Thanks Tidehunter!

      Reply

      hans

      • Jan 5, 2015 - 7:27 AM - Zack Comment Link

        Awesome. Im going to look into both options and try them out. I will report back if it works out. 

        Reply

        Zack

  • Jan 9, 2015 - 4:39 AM - tzahi Comment Link

    HeyI got the LED strip (ws2812b, I add a picture) but have a very basic question,I didn’t understand the connection well (figure 14)the side with the female connection (without the wings at the side) is the side with the arrows direction (like in figure 14).I need to connect only this side ? the othe side of the strip in not in use ?and how do I splitt the GND connection to the DC and to the arduino ?led strip
    thanks

    Reply

    tzahi

    • Jan 9, 2015 - 5:03 AM - hans - Author: Comment Link

      Hi Tzahi!

      Well, if I understand you correctly;

      If you use (for example) only one strand of LEDs, then yes: you’d use only one side of the strip, and the other end stays unconnected.
      If you use 2 strands, then the end of strand 1 will be connected to the beginning of strand 2, but the end of strand 2 will not be connected.

      So basically:   Arduino -> beginning strand 1 — end strand 1 -> beginning strand 2 — end strand 2 (not connected)

      It is critical to follow the arrows on the strand! The arrow has to point AWAY from the Arduino. 

      Splitting the GND connection: what I did was one GND wire from the LED strand twisted together with a wire that goes to the Arduino and one that goes to the power supply. You could use a screw terminal for that (Wiki), or solder the wires together.

      Reply

      hans

  • Jan 9, 2015 - 10:30 AM - Guðjón Guðjónsson Comment Link

    Hope someone is interested in this.

    I finally found some use of my Raspberry Pi. Reading here about Hyperion I tested it on the pi. Installed Raspmc and Hyperion.

    The problem I had before with my setup is that I was using a Dreambox with Boblight and Arduino,and if I wanted to use my Mac I had to unplug the usb and hook it to my Mac. Now however all is connected to lan and I can easily use the lights without any problem.

    On the Mac I use XBMC with Hyperon add on and on the Dreambox Boblight in network mode. Bob light on the Dreambox was recourse hungry so this setup seem to work much better.

    Reply

    Guðjón Guðjónsson

  • Jan 9, 2015 - 6:54 PM - Jonathan C Comment Link

    Hello Hans,

    Thank you for the guide, and all the work you have put into this site in general its quite wonderful. But as many folks here I am in need of help getting this set up to run.

    My setup is 161 leds ws2812b (43 per side, 75 on top, 0 below I had to cheat the config to avoid divide by zero issues) 

    Windows 7 

    Kodi 14 (formerly xbmc) 

    Boblight Add-on from the repository

    boblightd.exe from the thread on the kodi forums (located at c:\boblight\)

    My issue is that as a few here have stated, everything appears to work up to the point when you play a video. So I get the light strip when I power the arduino. The when I start Kodi the boblight add says it connects to boblightd. But the background colour I set does not apply and if I play a video nothing changes.

    I suspect that boblight and boblightd are indeed speaking to each other but the arduino and boblightd are not. I have tried 9600, 115200, and 460800. I tried changing the com port in windows from com2,3,10 just cause I had no idea what else to try. Also FYI no caps when specifying device in the conf file. /dev/com3 works /dev/COM3 does not.

    Thanks in advance for the help!

    Here is my conf  

    [global]
    port 19333
    [device]
    name AmbiLight
    type momo
    output /dev/com3
    channels 483
    prefix 41 64 61 00 18 4D
    interval 20000
    rate 115200
    debug off
    delayafteropen 100000
    Reply

    Jonathan C

    • Jan 10, 2015 - 3:06 AM - hans - Author: Comment Link

      Hi Jonathan!

      Sounds like you’re right. The test light after firing up the Arduino is fully initiated by the Arduino Sketch (if you use mine).

      Commonly problems occur in:

      • Baudrate (but you already played with that and 9600 should at least give something)
      • Device name and type (but those seem OK)
      • Prefix (this has to match the code in my sketch or the magic code when you’re using an ADA Fruit like sketch)
      • “interval” and “delayafteropen” are values you could play with, but I doubt these are problematic (use later for finetuning is needed)
      In your case I’d most certainly double check the “prefix” code (assuming you’re using the right com port).
      The prefix is either a fixed code (like in my sketch) or a code calculated based on a string and/or the number of LEDs (Boblight Config Maker offers both).

      Reply

      hans

      • Jan 10, 2015 - 5:09 PM - Jonathan C Comment Link

        I am using both your sketch and config maker. not sure how boblight handles the conf file but the prefix matches and I tried spaces and no spaces and still nothing.

        Reply

        Jonathan C

      • Jan 10, 2015 - 7:19 PM - Jonathan C Comment Link

        So in an effort to learn more about where specifically the communication is not working I downloaded real term and attempted to use it to debug the situation. I had your adruino sketch reply with whatever it put into readSerial variable. It seems my mega does not like 115200 as the replies were all garbled. I reduced speed to 9600 and voila clear messages were being exchanged. Next I tried making my own message to “manually” change the colour. Mostly nothing happened, but if I repeatedly sent the same message eventually some lights changed but only a few would be correct and often they would all change to a repeat of blue, red, white, green. So this leads me to believe my mega is done for or windows has issues I cannot solve.

        My next move is to borrow an UNO from someone and or build my dual boot laptop into an open elec machine to try that

        I’ll post if anything new emerges.

        Cheers

        Reply

        Jonathan C

      • Jan 11, 2015 - 4:12 AM - hans - Author: Comment Link

        Hi Jonathan,

        Garbled text sure indicates a mismatch in baudrate / serial speed. Also good to know is that for most Windows machines 115200 seems to be their top limit for serial port (which in essence is what your Arduino/USB is). Also keep in mind that long wires could contribute to it as well (although I assume your wires are not all that long).

        Testing with another Arduino Uno is a good step …

        I assume that the initial LED sweep (one after another LED is switched on [white] during initialization of the Arduino) works fine. If this is not the case, then trouble should be located in the LED strip.

        If colors are weird or odd then consider looking at the part of the code where either RGB or GRB is being selected (NEO_RGB, NEO_GRB) or the bitstream speed of the LEDs (NEO_KHZ400 vs NEO_KHZ800), although I doubt this is an issue, just double check anyway.

        // Init LED strand, WS2811/WS2912 specific
        // These might work for other configurations:
        // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
        // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
        // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
        // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
        Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDCOUNT, DATAPIN, NEO_GRB + NEO_KHZ800);
        Reply

        hans

        • Jan 14, 2015 - 6:29 PM - Jonathan C Comment Link

          So I tried the UNO with no change and then used open elec on an old laptop and it worked. So not being attached to windows on my old HTPC I migrated it to open elec. But now what was working on the laptop is not working there. When the htpc starts up it says “Failed to connect to boblightd” but never connects after which is what you describe in the article and also how the laptop behaved.

          Any thoughts? I am not certain how to trouble shoot this branch of the system. As in LEDs and UNO’s and serial baud rates are one thing but xbmc add ons and daemons are another thing all together.

          Reply

          Jonathan C

        • Jan 15, 2015 - 5:31 AM - hans - Author: Comment Link

          Failing to connect to Boblight is typically caused by the points mentioned earlier.

          Since everything seems to work under OpenElec, I’d assume your problem lies in the device type/name. Under Windows this should be something like “output /dev/com3” – you can check the Windows device manager to verify that the com-port hasn’t changed …?

          Reply

          hans

  • Jan 10, 2015 - 5:18 AM - tzahi Comment Link

    hello again

    I still trying to understand somthing about the GND.

    in my ws 2812 in the input side (which connect to the arduino) I have a connector with 3 wires connect to it (red, black, green) and another 2 single wires black and RED).

    my input connector

    are those 2 same GND ?

    I can connect the GREEN PIN AND BLACK GND from the connector to the arduino ?

    and the 2 single wires black and red to the AC plug ?

    so I don’t need to split the GND

    like in this picture : picture ?

    Reply

    tzahi

    • Jan 11, 2015 - 4:23 AM - hans - Author: Comment Link

      Hi Tzahi,

      it appears that the two loose wires are for providing power – you’ll have to use a multi-meter (set to diode) to test if these wires are indeed the same as in the connector. In that case you’d indeed do not need to split the wires. Like I just said: double check this with a multi-meter or physically follow the wires if you can see that they connect to the same points.

      Reply

      hans

  • Jan 11, 2015 - 10:37 AM - Kris Comment Link

    Hey, firstly great guide. Followed it to the letter and my stuff is working ALMOST perfectly. I’ve changed the prefix based on having 150 lights, however any LED after number 50, just flashes through the 3 colours wildly!

    I have tested the strip with the NeoPixel test and it works perfectly, but when trying to use boblight/your sketch it doesnt work past LED 50. Do you hvae any idea what this may be? I’d love to get it fixed being so close is torture!

    Reply

    Kris

    • Jan 12, 2015 - 3:34 AM - hans - Author: Comment Link

      Does the strip (if you use my sketch) show the initialization swirl (one led after the other is switched on, until all are on)?

      For my sketch one would normally not need to modify the prefix, since it’s fixed.
      If the swirl does not work properly;
      – Check the power supply, if it can keep up (not sure if the NeoPixel test switches all LEDs on)
      – Make sure all strands work properly (swirl test should show all)
      If none of this appears to be a problem, check timing settings like baudrate and such to see if it can keep up.
      Disable all other plugins in XBMC/Kodi as well, to make sure they don’t take too much CPU resources (I had this with a few plugins).
      Reply

      hans

  • Jan 16, 2015 - 3:40 AM - tzahi Comment Link

    Does Everything it work on KODI  ?

    Boblightd and XBMC BobLight are the same ? or diffrent names ?

    Reply

    tzahi

  • Jan 16, 2015 - 9:21 AM - Seyhun Comment Link

    Hi Hans and other guys. Is there any exact solution with XBMC Android ? I have barebone pc but it is not practical as media players. I holding my pc just because of Boblight system.

    Reply

    Seyhun

    • Jan 16, 2015 - 2:09 PM - hans - Author: Comment Link

      I do not have an Android box available to test with, but others (in the comments) appear to have a setup with Android running, either directly or via a master/slave setup.

      I personally use a small PC (app $160, AMD Fusion based). It’s about the size of a small cigar box, fast enough, quiet,… and running OpenElec.

      Maybe I should look for a sponsor to drop off one of these Android boxes … or maybe someone can point me in the right direction to find an affordable model?

      Reply

      hans

  • Jan 17, 2015 - 7:54 AM - Mike Comment Link

    Dear everyone,

    I have a serious problem and I’d like to kindly ask you for help.

    I have KODIbuntu (KODI 14.0, based on Ubuntu 14.04 LTS). I cannot install boblightd service, the Boblight Add-on can be installed the standard way. But boblightd isn’t present in the addons. When I search files in the computer, there is nothing like boblightd. Please, point me into some direction how to solve this. Maybe add repo of open elec some way, but I have no idea how.

    Thank you very much for any helpful replies.

    Mike

    Reply

    Mike

    • Jan 17, 2015 - 8:11 AM - hans - Author: Comment Link

      Hi Mike,

      I have no experience with installing Boblight under Ubuntu, but I did find this guide: Adalight, Arduino, Boblight, Ubuntu and XBMC

      Quoted from that guide (slightly modified):

      First off; open a terminal and install the prerequisites for Boblight:

      sudo apt-get install libx11-dev libgl1-mesa-dev libxrender-dev libxext-dev portaudio19-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev libusb-1.0-0-dev

      Next, ensure that G++ compiler is installed:

      apt-get install g++

      Once done you’ll need to install Subversion to get the Boblight codebase:

      apt-get install subversion

      Now your environment is all set; you can checkout Boblight and build it:

      svn checkout http://boblight.googlecode.com/svn/trunk/ boblight-read-only

      Once it’s downloaded, you should have a folder in your ‘Home’ directory called ‘boblight-read-only’; Change into this folder:

      cd ~/boblight-read-only/

      Once in there issue the ./configure command:

      ./configure

      Once it’s run; you can then get on with make and install Boblight:

      make

      and

      sudo make install

      Optional step: update ldconfig – I had an issue where one part of boblights install wasn’t referenced in another location (reported by boblight-X11: ERROR: libboblight.so: cannot open shared object file: No such file or directory); so I had to run

      sudo ldconfig

      to update my links.

      Boblight needs a .conf file to initialize the lights.

      It needs to be placed in your /etc folder; unzip the file and copy it to the right location; you’ll need to be sudo to do this:

      sudo cp 'PATH-TO-FILE' /etc/boblight.conf

      If you’re still with me; fire up a new terminal and type:

      sudo boblightd

      If your config file is correct; this will start the Boblight daemon and you should see the LEDs cycle through RGB once more, and the terminal will state that boblight has successfully connected. Open a second terminal window and type:

      boblight-constant FF0000

      Your LEDs should now all be red! To kill this command simply press ctrl+C (Don’t shutdown the boblight terminal or you’ll lose the connection and will have to issue ‘sudo boblight’ again!

      Install XBMC boblight addon

      To install this add-on you must do so from the Add-on Manager from within XBMC by going to:

      Settings – Add-ons – Get add-ons – XBMC.org Add-ons – Services – XBMC Boblight – Install

      Once installed you should see a notification on screen that it has connected to boblight! Then choose a film, sit back in a dark room and marvel at your creation!

      Hope this gets you started … 

      Reply

      hans

      • Jan 17, 2015 - 9:57 AM - Mike Comment Link

        Damnit you’re fast.

        Thank you very much for the reply, I am obviously incompetent googler. I tried the guide, boblightd runs after startup and XBMC reports successfull connection. I could check that on virtual serial port the messages work when using boblight-constant. I don’t know how to create virtual serial port on startup to check if it works with video, too. And I don’t have a scope at home to see what happens on actual serial port.

        But soon I will try to connect it to an MCU and see what it does.

        Unless you are planning to visit Prague to let me invite you for a beer, can I donate somehow so you can get the beer yourself?

        Reply

        Mike

      • Jan 18, 2015 - 8:18 AM - hans - Author: Comment Link

        Hi Mike,

        Don’t worry about the Google thing: I actually like figuring it out as well, and I think posting the answer here serves others as well 

        I did find this blog post on how to work with virtual com ports under Ubuntu … I hope it’s helpful .

        When I visit Prague, I’ll most certainly let you … I wouldn’t mind a beer.
        Donating can be done through PayPal (hans at luijten dot net), but it’s not required,… 

        Reply

        hans

  • Jan 21, 2015 - 2:55 AM - FaUst Comment Link

    Hi,

    I tried some of sketch – only that works, but only in boblight – ambibox and prismatik dont. Does abyone had the same problem?

    Reply

    FaUst

    • Jan 21, 2015 - 5:20 AM - hans - Author: Comment Link

      Hi Faust,

      unfortunately, I haven’t tried the sketch with either AmbiBox or Prismatik … Do they use the same config file? It could be related to the prefix code maybe?

      Reply

      hans

      • Jan 21, 2015 - 5:58 AM - FaUst Comment Link

        In AmbiBox i can only set baudrate and port, besides prefix code is Ada – it seems OK

        Reply

        FaUst

  • Jan 21, 2015 - 12:09 PM - Guðjón Guðjónsson Comment Link

    Hi Hans.

    I was wondering do you know anything about TM1803 strips?

    Are they the same or similar software wise as WS2812/2811

    Thanks.

    Reply

    Guðjón Guðjónsson

    • Jan 22, 2015 - 4:33 AM - hans - Author: Comment Link

      Hi Guðjón,

      I did find this article at Sprakfun which suggests the TM1803 might be a WS2811/WS2812 clone. Spec sheet can be found here.

      At the Github page of FastLED, they claim TM1803 support as well. FastLED works slightly different than NeoPixel (see this article for a comparison).

      An article in the Arduino forum might give more insight into the specifics as well, but when using FastLED you might not need any of this.

      I do not have these LEDs at hand so I can’t test anything

      If you find out how to do it, would you mind posting it here?

      Reply

      hans

      • Jan 22, 2015 - 11:26 AM - Guðjón Guðjónsson Comment Link

        Hi Hans,thanks for replay.

        I bought them by mistake a year ago and have been in closed since. But reading here about 2812 they seem to be almost identical.

        If I find something out I will post here.

        Reply

        Guðjón Guðjónsson

      • Jan 23, 2015 - 3:30 AM - hans - Author: Comment Link

        Thanks Guðjón!

        I understand the mistake, I almost made a similar mistake (that’s why I wrote the Arduino/WS2812 article to present my findings, and even with the WS2811/2811 I almost feared having bought the wrong ones as well).

        Thank you for willing to share your findings when you’ve got things working! 

        Reply

        hans

  • Jan 24, 2015 - 7:59 AM - tzahi Comment Link

    hello

    why after I upload the T4a Boblight sketch the leds stays on ?

    Reply

    tzahi

    • Jan 24, 2015 - 9:39 AM - hans - Author: Comment Link

      Hi Tzahi,

      the LEDs should first make a swirl/loop and then go OFF if Boblight takes over control … So in this case I suspect that Boblight is not sending any data, or the data is not properly recognized (check prefix/baudrate/device type).

      Hope this helps 

      Reply

      hans

  • Jan 25, 2015 - 2:33 AM - tzahi Comment Link

    Thanks

    the probleam was the baudrate, I change it to 9600 like you advice befor and it work fine, but it too slow.

    460800  dose’t work so I will try to rise to 115200, is this the max I can get ?

    Reply

    tzahi

    • Jan 25, 2015 - 3:14 AM - hans - Author: Comment Link

      Specially Windows seems to dislike speeds above 115200, so yes, I’d give 115200 a try … or maybe a step lower like 57600 …

      FYI: Standard baud rates supported by most serial ports (read: old and Windows): 

      • 110
      • 300
      • 600
      • 1200
      • 2400
      • 4800
      • 9600
      • 14400
      • 19200
      • 28800
      • 38400
      • 56000
      • 57600
      • 115200

      Standard baud rates supported by some serial ports:

      • 128000
      • 153600
      • 230400
      • 256000
      • 460800
      • 921600

      Reply

      hans

  • Jan 26, 2015 - 11:14 PM - tzahi Comment Link

    Hey

    thanks, I upgrade the speed to115200, it’s better but still slow.

    in fast scenes the led light don’t compatible with the picture light, I mean the light is a little slower then the picture.

    is there anything I can do to improve the light speed ?

    Reply

    tzahi

  • Jan 27, 2015 - 2:19 PM - Martin Comment Link

    Hi Hans! 

    Exellent guide! finally got my setup working, had some trouble with the “prefix” and “momo” parts in my config file.

    So it is up and running, but im not to happy about my blackness. 

    for example when the picture is very dark, i see blueish/white colors instead, this seems pretty random, can also be red. Bu when the scene goes completly dark my leds turn black(off). Bu not in dark scenes.

    I am using ws2801 leds with the “ledstream” sketch.

    is it possible to use your sketch by “simply” modifi it to work with the 2801?

    here is my sketch anyway:

    #include <SPI.h>


    // LED pin for Adafruit 32u4 Breakout Board:

    //#define LED_DDR DDRE

    //#define LED_PORT PORTE

    //#define LED_PIN _BV(PORTE6)

    // LED pin for Teensy:

    //#define LED_DDR DDRD

    //#define LED_PORT PORTD

    //#define LED_PIN _BV(PORTD6)

    // LED pin for Arduino:

    #define LED_DDR DDRB

    #define LED_PORT PORTB

    #define LED_PIN _BV(PORTB5)


    // A 'magic word' (along with LED count & checksum) precedes each block

    // of LED data; this assists the microcontroller in syncing up with the

    // host-side software and properly issuing the latch (host I/O is

    // likely buffered, making usleep() unreliable for latch). You may see

    // an initial glitchy frame or two until the two come into alignment.

    // The magic word can be whatever sequence you like, but each character

    // should be unique, and frequent pixel values like 0 and 255 are

    // avoided -- fewer false positives. The host software will need to

    // generate a compatible header: immediately following the magic word

    // are three bytes: a 16-bit count of the number of LEDs (high byte

    // first) followed by a simple checksum value (high byte XOR low byte

    // XOR 0x55). LED data follows, 3 bytes per LED, in order R, G, B,

    // where 0 = off and 255 = max brightness.


    static const uint8_t magic[] = {'A','d','a'};

    #define MAGICSIZE sizeof(magic)

    #define HEADERSIZE (MAGICSIZE + 3)


    #define MODE_HEADER 0

    #define MODE_HOLD 1

    #define MODE_DATA 2


    #define STARTCOLOR 0xFFFFFF // LED colors at start

    #define BLACK 0x000000 // LED color BLACK


    // If no serial data is received for a while, the LEDs are shut off

    // automatically. This avoids the annoying "stuck pixel" look when

    // quitting LED display programs on the host computer.

    static const unsigned long serialTimeout = 15000; // 15 seconds


    void setup()

    {

      // Dirty trick: the circular buffer for serial data is 256 bytes,

      // and the "in" and "out" indices are unsigned 8-bit types -- this

      // much simplifies the cases where in/out need to "wrap around" the

      // beginning/end of the buffer. Otherwise there'd be a ton of bit-

      // masking and/or conditional code every time one of these indices

      // needs to change, slowing things down tremendously.

      uint8_t

        buffer[256],

        indexIn = 0,

        indexOut = 0,

        mode = MODE_HEADER,

        hi, lo, chk, i, spiFlag;

      int16_t

        bytesBuffered = 0,

        hold = 0,

        c;

      int32_t

        bytesRemaining;

      unsigned long

        startTime,

        lastByteTime,

        lastAckTime,

        t;


      LED_DDR |= LED_PIN; // Enable output for LED

      LED_PORT &= ~LED_PIN; // LED off


      Serial.begin(460800); // Teensy/32u4 disregards baud rate; is OK!


      SPI.begin();

      SPI.setBitOrder(MSBFIRST);

      SPI.setDataMode(SPI_MODE0);

      SPI.setClockDivider(SPI_CLOCK_DIV16); // 1 MHz max, else flicker


      // Issue test pattern to LEDs on startup. This helps verify that

      // wiring between the Arduino and LEDs is correct. Not knowing the

      // actual number of LEDs connected, this sets all of them (well, up

      // to the first 25,000, so as not to be TOO time consuming) to red,

      // green, blue, then off. Once you're confident everything is working

      // end-to-end, it's OK to comment this out and reprogram the Arduino.

      uint8_t testcolor[] = { 0, 0, 0, 255, 0, 0 };

      for(char n=3; n>=0; n--) {

        for(c=0; c<25000; c++) {

          for(i=0; i<3; i++) {

            for(SPDR = testcolor[n + i]; !(SPSR & _BV(SPIF)); );

          }

        }

        delay(1); // One millisecond pause = latch

      }


      Serial.print("Ada\n"); // Send ACK string to host


      startTime = micros();

      lastByteTime = lastAckTime = millis();


      // loop() is avoided as even that small bit of function overhead

      // has a measurable impact on this code's overall throughput.


      for(;;) {


        // Implementation is a simple finite-state machine.

        // Regardless of mode, check for serial input each time:

        t = millis();

        if((bytesBuffered < 256) && ((c = Serial.read()) >= 0)) {

          buffer[indexIn++] = c;

          bytesBuffered++;

          lastByteTime = lastAckTime = t; // Reset timeout counters

        } else {

          // No data received. If this persists, send an ACK packet

          // to host once every second to alert it to our presence.

          if((t - lastAckTime) > 1000) {

            Serial.print("Ada\n"); // Send ACK string to host

            lastAckTime = t; // Reset counter

          }

          // If no data received for an extended time, turn off all LEDs.

          if((t - lastByteTime) > serialTimeout) {

            for(c=0; c<32767; c++) {

              for(SPDR=0; !(SPSR & _BV(SPIF)); );

            }

            delay(1); // One millisecond pause = latch

            lastByteTime = t; // Reset counter

          }

        }


        switch(mode) {


         case MODE_HEADER:


          // In header-seeking mode. Is there enough data to check?

          if(bytesBuffered >= HEADERSIZE) {

            // Indeed. Check for a 'magic word' match.

            for(i=0; (i<MAGICSIZE) && (buffer[indexOut++] == magic[i++]););

            if(i == MAGICSIZE) {

              // Magic word matches. Now how about the checksum?

              hi = buffer[indexOut++];

              lo = buffer[indexOut++];

              chk = buffer[indexOut++];

              if(chk == (hi ^ lo ^ 0x55)) {

                // Checksum looks valid. Get 16-bit LED count, add 1

                // (# LEDs is always > 0) and multiply by 3 for R,G,B.

                bytesRemaining = 3L * (256L * (long)hi + (long)lo + 1L);

                bytesBuffered -= 3;

                spiFlag = 0; // No data out yet

                mode = MODE_HOLD; // Proceed to latch wait mode

              } else {

                // Checksum didn't match; search resumes after magic word.

                indexOut -= 3; // Rewind

              }

            } // else no header match. Resume at first mismatched byte.

            bytesBuffered -= i;

          }

          break;


         case MODE_HOLD:


          // Ostensibly "waiting for the latch from the prior frame

          // to complete" mode, but may also revert to this mode when

          // underrun prevention necessitates a delay.


          if((micros() - startTime) < hold) break; // Still holding; keep buffering


          // Latch/delay complete. Advance to data-issuing mode...

          LED_PORT &= ~LED_PIN; // LED off

          mode = MODE_DATA; // ...and fall through (no break):


         case MODE_DATA:


          while(spiFlag && !(SPSR & _BV(SPIF))); // Wait for prior byte

          if(bytesRemaining > 0) {

            if(bytesBuffered > 0) {

              SPDR = buffer[indexOut++]; // Issue next byte

              bytesBuffered--;

              bytesRemaining--;

              spiFlag = 1;

            }

            // If serial buffer is threatening to underrun, start

            // introducing progressively longer pauses to allow more

            // data to arrive (up to a point).

            if((bytesBuffered < 32) && (bytesRemaining > bytesBuffered)) {

              startTime = micros();

              hold = 100 + (32 - bytesBuffered) * 10;

              mode = MODE_HOLD;

     }

          } else {

            // End of data -- issue latch:

            startTime = micros();

            hold = 1000; // Latch duration = 1000 uS

            LED_PORT |= LED_PIN; // LED on

            mode = MODE_HEADER; // Begin next header search

          }

        } // end switch

      } // end for(;;)

    }


    void loop()

    {

      // Not used. See note in setup() function.

    }

    Reply

    Martin

    • Jan 28, 2015 - 3:02 AM - hans - Author: Comment Link

      Hi Martin,

      Great to hear you’ve got your setup going … 

      I have no WS2801’s available for testing, and in this AdaFruit Forum Post you can read that WS2801’s are maxing out at 90 LED … if NeoPixel supports WS2801, then it would just be a matter of changing this line:

      Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDCOUNT, DATAPIN, NEO_GRB + NEO_KHZ800);

      What the proper settings will be, I honestly do not know …

      As for the proper “black” goes, I’d play with the settings in the Boblight plugin of XBMC. You can change it darker, or adjust the gamma to get a proper black. Read the comments made by others above (link).

      Reply

      hans

      • Jan 28, 2015 - 3:46 AM - Martin Comment Link

        Wow, that post came out really long ^^

        I did some searches last night and it looks like the fastLED are supporting ws2801. Not sure about neopixel yet.

        i also found a supposed fastled sketch that should work. But havent tried it out just yet. Will be back with results

        Reply

        Martin

      • Jan 28, 2015 - 3:55 AM - hans - Author: Comment Link

        Haha, no problem  ….

        Yes, please let us know what you’ve figured out to get it to work with WS2801’s … 

        Reply

        hans

  • Jan 27, 2015 - 4:34 PM - Justin Comment Link

    Hi,

    I just installed my Ambilight with succes and have a correct configuration now, yay! I had a lightpack before and OpenElec 4.x just recently updated to Kodi. 3D content used to play on my lightpack quite well, top/bottom and sides where playing (not totally correct, but it didn’t bother me). Now I only get lights on both sides, top and bottom stay off :-( any idea how this happened? Does it have something to do with the fact that the LED block depth size is set a lot smaller now. I went from a 30 channel kit to a 810 channel kit, so I had some performance issues, I set it to 5% right now. 

    Reply

    Justin

    • Jan 28, 2015 - 2:53 AM - hans - Author: Comment Link

      Hi Justin,

      congrats on a working setup! 

      As for 3D: I honestly never tried it, I’m not much of a 3D movie watcher.
      You could try to increase to 10% of the height, even if it can’t keep up, you’d at least have an idea if it’s related to that.

      270 LEDs (810 channels) should work just fine though unless your HTPC is not keeping up (disable all other plugins when testing). My setup uses more LEDs and my AMD Fusion box keeps up just fine. Some additional plugins may slow down Boblight significantly though. One plugin I had, which checked for new files frequently, did bring Boblight to a freeze …

      Reply

      hans

  • Feb 1, 2015 - 1:58 PM - Justin Comment Link

    Hi Hans,

    Thanks so much for your advice!

    I tried using Boblight X11 for my visuals when playing music, super fast and fluid. However, when I play a music framerate is just a lot slower :-( Would it help if I purchase a different HTPC faster CPU and better GPU?

    Apparently the guys from AmbiledHD use a specific firmware for the kit, they do provided a adalight firmware which I have installed. I asked them if I can speed up the process. They provided the following instruction:

    No, Adalight firmware is refreshing all 512 LEDs. If you have an Arduino IDE, you can download the adalight firmware source from our repository (https://code.google.com/p/ambiled-hd/source/browse/#svn%2Ftrunk%2FAmbiLED_Firmware%2FAmbiLED_Adalight%253Fstate%253Dclosed) and change the LED count from 512 to real one. It increases the speed a bit.

    I did download the Arduino IDE but I get all kinds of errors when i’m compiling. Any suggestions?

    Reply

    Justin

    • Feb 2, 2015 - 2:55 AM - hans - Author: Comment Link

      Hi Justin,

      I can imagine that the the resources need to play music is significantly lower than movie playback. I’m not sure what your current hardware specifications are? I’m using a tiny AMD Fusion HTPC and Boblight works great, unless I add additional plugins, then performance tanks …

      You could try a regular PC, just for testing purposes, to see if it’s worth the investment.

      When I look at the code (your link), then it only steers 200 LEDs (int LED_Count = 200) – setting it to the real number might make a difference but I wouldn’t expect too much of it.

      The AdaFruit example should not produce errors, unless you did not install NeoPixel (see this post how to install under the chapter “AdaFruit NeoPixel“).

      I’ll post the code for reference for others as well below (source).

      #include <Adafruit_NeoPixel.h>
      #define PIN 2
      #define LED 13
      #define total_led_support 512
      Adafruit_NeoPixel strip = Adafruit_NeoPixel(total_led_support, PIN, NEO_GRB + NEO_KHZ800);
      int i = 0;
      int Ri = 0;
      int Gi = 0;
      int Bi = 0;
      int LED_Count = 200;
      byte magic1,magic2,magic3,magic4,magic5,magic6;
      unsigned long lastByteTime, t;
        
      void setup() {
        pinMode(LED, OUTPUT);  
        
        Serial.begin(115200);
        
        strip.begin();
        strip.show(); // Initialize all pixels to 'off'
        
        Serial.print("Ada\n");   
      }
      void loop() {
        t = millis(); //Time Data
        if (Serial.available()>0) // Serial command received
                              { 
                                int cmd = Serial.read();
                                
                                magic1 = magic2;
                                magic2 = magic3;
                                magic3 = cmd;
                                
                                if ((magic1 == 'A') && (magic2 == 'd') &&(magic3 == 'a')) { LED_Count = i-3; i=0;} 
                                else {
                                    if (i%3 == 0) Ri = cmd;
                                    else if (i%3 == 1) Gi = cmd;
                                    else if (i%3 == 2) Bi = cmd;
                                    i++;
                                  
                                    if (i%3 == 0) strip.setPixelColor((i/3)-2,Ri,Gi,Bi); //tek renk
                                    if (i == LED_Count) { strip.show(); }
                                    lastByteTime = t;
                                    }
                              }
          if((t - lastByteTime) > 1000) {
              for (i=0;i<total_led_support;i++) strip.setPixelColor(i,0,0,0);
              strip.show(); // Initialize all pixels to 'off'
            
              Serial.print("Ada\n"); // Send ACK string to host
              lastByteTime = t; // Reset counter
            }                       
      }
      Reply

      hans

      • Feb 2, 2015 - 3:16 AM - Justin Comment Link

        Hi Hans,

        I use a HP MicroServer AMD Turion II Neo N54L + 2GB RAM equiped with a Zotac GeForce GT 630 ZONE Edition 2GB. Don’t think a SSD will make a huge difference. I do have plugins installed, its my HTPC and download machine combined. So it’s running SabNZB, Sickbeard and Couchpotato.

        Greets Justin

        Reply

        Justin

      • Feb 2, 2015 - 3:50 AM - hans - Author: Comment Link

        Hi Justin,

        form what I could quickly Google, the Turion and the Fusion could perform comparable … the video of the Fusion should be faster, but I just have this info from I could quickly find. Links: AMD E-Series E-350 vs Turion II Neo N54L and Fusion vs Turion X2 (if I picked the right CPU’s). It seems the Turion could be a smidge faster when it comes to CPU power. Not sure how this will pan out in reality though …

        I’d recommend doing some tests with your download tools all disabled/removed, as they are pretty file intense, and could give a good slowdown while downloading (SABNzbd) or while looking/storing (Sickbeard/Couchpotato).

        As for the SSD: I’ve noticed significant speed improvements over a regular HDD, specially when there is a lot of file activity.

        Reply

        hans

  • Feb 1, 2015 - 2:02 PM - Justin Comment Link

    Typo:  ….when I play a MOVIE…

    Reply

    Justin

  • Feb 3, 2015 - 3:39 PM - Nicolas Comment Link

    Hi :)

    I’m back to the project, I was very busy but now I think I could find time to test !

    Does anyone use Arduino / WS2812B / Hyperion on Windows now ? Or definitively not ? If not, does anyone use Aduino / WS2812B / Hyperion with a standard PC and OpenElec/Kodibuntu ?

    Thanks ;)

    Reply

    Nicolas

    • Feb 4, 2015 - 3:48 AM - hans - Author: Comment Link

      I’d be very interested as well … once I get back home (still traveling) I’d love to start experimenting with Hyperion.

      Reply

      hans

      • Feb 4, 2015 - 4:02 PM - Nicolas Comment Link

        I’m going to convert my HTPC to dual boot Windows / Ubuntu so I could try Hyperion ASAP :)

        Reply

        Nicolas

      • Feb 5, 2015 - 2:02 AM - hans - Author: Comment Link

        Awesome! Keeps us posted 

        Reply

        hans

        • Feb 8, 2015 - 3:46 AM - Nicolas Comment Link

          Ok so I have installed Ubuntu and hyperion with the link you have provided in an other comment, and hyperion service is OK on Ubuntu. I can connect to it with Android app, server is synchronized but now I have a problem : there is no LEDs activity… I think it’s a problem with my Arduino Uno and HTPC communication, so perhaps my sketch is not the good. I’m going to try with RanzQ sketch.

          Reply

          Nicolas

        • Feb 8, 2015 - 4:32 AM - hans - Author: Comment Link

          Hi Nicolas – try testing with low baudrates first, for example 9600.
          Also triple check the com-port/device and the “prefix” code you’re using.
          With most users those are the points where it most frequently fails.

          Please let us know if you found a working solution or what the problem might have been … 

          Reply

          hans

          • Feb 8, 2015 - 5:27 AM - Nicolas Comment Link

            Thanks for informations :)

            So I’ve made several changes and now Hyperion is OK (but not with Kodi, I’ll try later but I think to know what is the problem).

            So I’ve used sketch made by RanzQ but I have modified baudrates 500000 to 460800 (same modification to Hyperion JSON) and change PIN and LED number but it’s normal.

            And the most important : when you use an Arduino with Ubuntu, you must add user to 2 local groups :

            usermod -a -G tty user_name 

            usermod -a -G dialout user_name

            Or (like I have do) install Arduino package (apt-get install arduino) and at first launch it will ask you if you want to add user to groups. 

            I’m following my tests and I’ll tell you when all will be OK ;)

            Nicolas

          • Feb 8, 2015 - 10:42 AM - hans - Author: Comment Link

            Thanks for posting Nicolas! 

            In the near future I’ll see if I can modify Boblight Config Maker to generate Hyperion config files as well. 
            Not sure if such high baudrates are needed, I’d try something like 115200 as well, even if it’s just to see that such high speeds really make a difference. 

            Anyhow; when I get back home, I most certainly will give Hyperion a try as well.

            hans

  • Feb 8, 2015 - 12:35 PM - Nicolas Comment Link

    You’re welcome, thanks to you to give me a way to start this project ;-)

    I have installed Hyperion service with Kodi (you need to download a zip and unzip it into addons folder) and it works ! I’ll try later with a complete movie to see because I think I have a buffer problem with my Arduino but I’m not sure. I have already talk about this buffer problem in a previous comment.

    Reply

    Nicolas

    • Feb 9, 2015 - 4:33 AM - hans - Author: Comment Link

      Looking forward to your findings Nicolas! 

      Reply

      hans

      • Feb 10, 2015 - 1:48 PM - Nicolas Comment Link

        Hi ;)

        I’ve tried with the same config than RanzQ (baudrate 500000, same settings than his Hyperion config file) and it seems to be better and less laggy. I must follow my tests.

        Reply

        Nicolas

  • Feb 9, 2015 - 4:35 AM - Justin Comment Link

    I’m happy to report I decided to use my NAS/HTPC as a NAS only, I bought a Raspberry PI 2 now for the HTPC part with Hyperion, and refresh rate is much much better then with Boblight!

    Reply

    Justin

    • Feb 9, 2015 - 5:18 AM - hans - Author: Comment Link

      Oh Nice! A RPI 2 is on my wish-list as well … 

      What XBMC/Kodi distro are you running? OpenElec? RaspBMC?
      I’m considering getting one myself, and even though OpenElec for example is not yet optimized for the new CPU, it should already work faster. What are you findings in general?

      Reply

      hans

  • Feb 9, 2015 - 5:35 AM - Justin Comment Link

    I use Openelec, havent tried RaspBMC. I like the fast boottimes from Openelec.

    It’s quite fast, no lags, I’ll report back later, just installed it yesterday :D

    Reply

    Justin

  • Mar 9, 2015 - 9:43 AM - tzahi Comment Link

    HelloI have 2 questions :1.  some times the led just start working alone, and stay’s on till I turn the computer and it connect to boblight server and just then they turn back off.why is that ? and how Prevent it ?2. I undestand some people use resistor  in the connection, what for ?
    THANKS

    Reply

    tzahi

    • Mar 9, 2015 - 10:02 AM - hans - Author: Comment Link

      Hi Tzahi!

      1) I have no idea why the LEDs would do that, but you can set your Arduino Sketch to set all LEDs to black – just remove line 51 (setAllLEDs(STARTCOLOR, 5);) from the sketch and it should set all LEDs to black.

      2) The resist is optionally used to “dampen” – see the excellent explanation of Grumpy Mike.

      Reply

      hans

  • Mar 16, 2015 - 10:26 AM - Jack Comment Link

    Hi

    I got little promblem. At first everything was working fine. I decided to make some fine tuning on led positions and made new boblight.conf . After that boblightd start.bat does not work? It says boblight system cannot find batch file labeled -running ? and it closes… any idea whats is problem?

    I instaled XMBC boblight again and boblightd = did’t help

    I am running Windows 8 and Kodi with Arduino mega 2560 + WS2812B

    Reply

    Jack

    • Mar 16, 2015 - 10:50 AM - Jack Comment Link
    • Mar 16, 2015 - 2:31 PM - hans - Author: Comment Link

      I hope one of the other Windows users can help you with this.

      As far as I can see in this kodi forum post, your start.bat matches that one – they also provide a start.exe as an executable replacement for the .bat file. Did you try that one?

      Reply

      hans

      • Mar 18, 2015 - 10:20 AM - Jack Comment Link

        It’s working again .. Don’t sure what i did exactly but basically i just tried different boblight deamons software with administrator rights. Here’s link to the daemon that works for me.. And thanks for great tutorial about lights and software  
        Btw Ambilight is awesome 

        Reply

        Jack

      • Mar 18, 2015 - 10:39 AM - hans - Author: Comment Link

        Awesome! 

        Reply

        hans

  • Mar 17, 2015 - 5:38 AM - culprit Comment Link

    Excellent work here that really helped me getting my RaspBMC/Boblight set up working.  I’m trying to fine tune the config file and what would really help would being able to set a single LED “on” to confirm it’s position IRL.

    Does anyone know the boblight-constant command to make a specific LED turn on?  e.g. “sudo boblight-constant [lightname] FF0000”

    Reply

    culprit

    • Mar 17, 2015 - 6:13 AM - hans - Author: Comment Link

      Thank you Culprit!

      I like your question – it would most certainly help when finetuning colors and positions.
      At the moment I wouldn’t know how, but I’ll look into it! 
      Maybe I can incorporate that into my Boblight Config Maker … 

      Reply

      hans

    • Mar 17, 2015 - 9:21 AM - hans - Author: Comment Link

      I found two posts in Google Groups:

      Now I’ll be the first one to admit that I have no clue how to get started with that, and any tests I’d like to do cannot be done, since I’m nowhere near my Boblight setup …  

      Another idea, yet very cumbersome, is to modify the config file and setting certain LEDs to zero, ie.

      hscan 0 0
      vscan 0 0 

      For example, for each 5 LEDs, set 4 to zero like this – in the hope that they won’t produce any lights.
      This might be a lot of work … specially when you have 290 LEDs like I do … 

      Reply

      hans

      • Mar 17, 2015 - 10:30 AM - culprit Comment Link

        If you call boblight-costant from the CLI without specifying any options the following outputs:

        @raspbmc:~$ boblight-constant
        ERROR: no color given
        Usage: boblight-constant [OPTION] color
          color is in RRGGBB hex notation
          options:
          -p priority, from 0 to 255, default is 128
          -s address[:port], set the address and optional port to connect to
          -o add libboblight option, syntax: [light:]option=value
          -l list libboblight options
          -f fork

        so it must be something like: “boblight-constant -o T15 color=red”

        Reply

        culprit

      • Mar 17, 2015 - 12:32 PM - hans - Author: Comment Link

        Interesting! This worked for you? Or it didn’t work?

        If it didn’t work … maybe something like this:

        boblight-constant -o T15:color=FF0000

        Not sure where you got “T15”, I’m guessing the name of the light (below: “start1“)?
        Or maybe it has to be “Ambilight 1” (less likely though), or just “1” (more likely).

        [light]
        name start1
        color red Ambilight 1
        color green Ambilight 2
        color blue Ambilight 3
        hscan 31 34.5
        vscan 92 100

        I read somewhere that this should set all LEDs to red (for example):

        boblight-constant FF0000

        I unfortunately cannot access my Boblight to test it myself 

        Reply

        hans

        • Mar 18, 2015 - 4:34 AM - culprit Comment Link

          T15 is the name of one of my lights yes. I’ve tried different versions of the syntax but the daemon just complains that the option=value part is wrong.

          Maybe the easiest thing to do would be to make a video file with a black background and one white square in each corner. Boblight would turn on the LEDs it thinks corresponds to those corners. I’ll give it a try.

          Reply

          culprit

        • Mar 18, 2015 - 6:23 AM - hans - Author: Comment Link

          Did you try something like:

          boblight-constant T15:FF0000

          No idea if that would work … just an idea – we should probably study the Boblight source to see what might work.

          As for a video:
          I created the T4A test video for testing – I’m sure it can be improved up, but it might be a good start.

          Reply

          hans

  • Mar 19, 2015 - 6:46 AM - Jack Comment Link

    Hi

    Can anyone give me an idea ,why 2 last leds are light blue the time? I have calculaced number of leds two times now and it should be right.. Those leds aren’t broken because they change color when using adafruit “rainbow” code.. 

    Win8,Arduino mega ,WS2812B (using 359leds) / 20A power source 

    Reply

    Jack

    • Mar 19, 2015 - 6:55 AM - hans - Author: Comment Link

      Hi Jack,

      kind-a difficult to debug from a distance of course … but you could try adding 2 LEDs to the config file, just to see what happens?
      Maybe you’ve already tried that … ?

      Reply

      hans

      • Mar 19, 2015 - 8:55 AM - Jack Comment Link

        When i add 2 leds on arduino code and boblight.conf. boblightd says “ERROR boblight.conf line 2586 : Channel 1369 wanted but device ambilight has 1368 channels” It says same when trying to add 1led  except channel’s number is different

        Reply

        Jack

        • Mar 19, 2015 - 10:20 AM - Jack Comment Link

          One other thing is that right side leds are bit off sync(position) and also bottom leds… i think its something to do with those 2 all the time blue leds on bottom left…

          Here is a LINK to picture to showing what i am trying to say

          Any thoughts about that?

          Reply

          Jack

        • Mar 19, 2015 - 11:08 AM - hans - Author: Comment Link

          I see what you mean … although it’s a little hard to see, since your wall isn’t white.

          What is the starting point and in what direction do the LEDs go?
          (ie. bottom middle, clockwise as seen from the front of the TV)
          You said these are the last 2 LEDs, so seen from the front of the TV, counter clockwise (bottom->right->top->left)?

          I would say that these 2 LEDs are not of influence … since the position and size of LED are set in hscan and vscan, ad I would assume that Boblight analyzes only that part of the screen for that given LED.

          Reply

          hans

          • Mar 19, 2015 - 11:44 AM - Jack Comment Link

            start of leds is left bottom corner and clockwise direction. 

            Jack

          • Mar 19, 2015 - 12:20 PM - hans - Author: Comment Link

            So it’s the first 2 LEDs that remain blue-ish?

            I see a little shift in the top, right and bottom middle … almost like the LEDs aren’t positioned exactly right.

            Also, seems that 20A should be sufficient for your LEDs, I’m curious if connecting +5 and GNG at the end (and maybe in the middle) will help …

            hans

          • Mar 19, 2015 - 12:55 PM - Jack Comment Link

            Maybe this picture soon as i can. I allready connect ground wire to the end , because purple/pink did’t go through to end .I will connect also 5v soon as i can. Here is link to boblight config file .. maybe it would help some? 

            Jack

          • Mar 19, 2015 - 2:01 PM - hans - Author: Comment Link

            Your config file looks fine to me … 

            I’m keeping my fingers crossed for the +5V … specially now that you mention that you needed it for GND as well .

            Did you create the config with Boblight Config Maker?

            hans

          • Mar 19, 2015 - 2:46 PM - Jack Comment Link

            me too because white color is more yellow than white end of strip, when usign 90% brightness. No in some reason i haven’t been able to make working config with boblight config maker It’s connecting and driving the white light test but after that it just stay white. I’ll been using some other confing maker can’t remember what something like boblightconfigmaker.jar 

            Jack

          • Mar 20, 2015 - 2:37 AM - hans - Author: Comment Link

            Once I get home, I’ll try +5V and GND at the end of the strip as well; the end of my strip is also more yellow when it is supposed to be white. I’m curious why Boblight Config Maker didn’t work – I’m creating a new version at the moment. Given your config, I’ll give it a try and see if I can make it generate one that works for your setup. 

            hans

          • Mar 20, 2015 - 11:06 AM - Jack Comment Link

            Yeah . let’s try with that :)  .So you are going to make config file and send it to me ? I soldered +5volts on end , now light flickering stopped and white is pure white:) but still that one leds stays blue :S 

            Jack

          • Mar 21, 2015 - 5:47 AM - hans - Author: Comment Link

            I’m still working hard on a v2 for Boblight Config Maker. I’ll have it generate a config file, and will see if it matches your config file. For one, to see why the current config of BCM would fail … 
            I’ll let you know once I get to that point, since I’m rewriting BCM from scratch.

            +5V: Awesome, I’ll test that with my setup as well! 

            Can you find the hscan and vscan for that annoying blue LED?
            Maybe there is something wrong with it’s “location”, or we could toy with it, to see if making it wider (without changing other LEDs) will make a difference.

            hans

          • Mar 21, 2015 - 4:49 PM - Jack Comment Link

            New information about the problem. So those “blue” leds aren’t the last leds they are 3 and 4th last , and third one is light blue/greenish and fourth is white/blue.
            First i tested leds with strand test and they work as it supposed. But still when i start boblight deamon it starts running white light “test” and open up and those 3,4th leds go on and stay on all the time. Until i upload new sketch or take power cord out. Here’s link to picture
            So i decided to change those “broken leds” replace last 6 leds and still same problem. I even tried to change
            vscan/hscan it did’t make any difference Only thing that i can think of is that those leds some reason don’t get (data in) command to turn. So => problem could be on configfile.. but .. 

            Jack

          • Mar 21, 2015 - 11:48 PM - Jack Comment Link

            One thing that I wonder is. If i have understand correctly 1 led is 3 channels RGB , so 10 leds have 30 channels and so on. But i am using 359 leds so i should have 1377 channels. Why boblight config file it says 1365 channels? maybe configmaker.jar has some promblems counting led, cos i have entered right number of leds…

            Jack

          • Mar 22, 2015 - 3:09 AM - hans - Author: Comment Link

            Hi Jack,

            You’re right,… 

            # of channels = 3 x # of LEDs

            so in your case 3 * 359 = 1077.
            Or do you have 459 LEDs? (typo?)

            hans

          • Mar 22, 2015 - 3:28 AM - Jack Comment Link

            Typo , 459 is right amout

            Jack

          • Mar 22, 2015 - 5:52 AM - hans - Author: Comment Link

            Maybe Boblight can handle only 455 LEDs (ie. 1365 channels)?
            I doubt this would be the case, but 1365 is definitely wrong for 459 LEDs.

            I’ve looked around and could not see such a limitation (let alone that 455 would be a “weird” number for that) … 

            hans

          • Mar 22, 2015 - 6:07 AM - hans - Author: Comment Link

            OK, took a better look at your boblight.conf.

            The config file you posted, says:

            LEFT: 83
            TOP: 145
            RIGHT: 82
            BOTTOM RIGHT: 45
            BOTTOM CENTER: 49 (not real LEDs!)
            BOTTOM LEFT: 50

            So that would not match the picture you’ve posted.
            The config file suggest 405 LEDs (or 1215 channels).

            Also note that the bottom center LEDs are not real LEDs, just fake place holders.
            If this would not be the case, and they are real LEDs, then your count is 455 (or 1356 channels).
            The “center” strip at the bottom is only intended to keep some space for the TV foot.
            If you have LEDs at the bottom, for the full width of the TV (as it’s hanging on the wall), then you’d only need 1 of the “bottom” parts, for example BottomLeft = 144, BottomCenter = 0 , BottomRight = 0.

            All this of course according to the conf file you posted.

            Maybe we should do a re-count for all the LEDs, to see what’s really there …?

            hans

          • Mar 22, 2015 - 8:05 AM - Jack Comment Link

            I must have mistakenly sent you the wrong config file . I did the many test with different settings and variations. But i going to count leds again and then get back to you.

            Jack

          • Mar 22, 2015 - 9:28 AM - Jack Comment Link

            I’m still getting 359 leds. So decided to test yout config maker again . Here’s setting pic. So channel number looks great :) changing settings on the arduino sketch and double checking baudrate and prefix , so they are okey. Next upload to arduino works nicely , after uploding leds turns white one by one as usually. Starting deamon no problems everything working as it suppose. But when i start Kodi nothing happens (expect leds all burn white still) RGB light’s did’t flash on start up. When i start watching movie white stays white, and even with bobdroid i can’t change color of leds 

            Jack

          • Mar 22, 2015 - 9:30 AM - Jack Comment Link

            typo again :D 84+146+83+146=459leds

            Jack

          • Mar 22, 2015 - 10:36 AM - hans - Author: Comment Link

            Haha, yeah counting can be a pain … 
            (same for me)

            And the generated config from BCM does NOT work, right?
            Can you send me the working and not working config?
            Right now I’m not seeing anything unusual.

            hans

          • Mar 22, 2015 - 12:31 PM - Jack Comment Link

            it sure is Here is link to working and not working config i included skecth also. Happy hunting 

            Jack

          • Mar 23, 2015 - 3:20 AM - hans - Author: Comment Link

            Today is a busy day – I’ll see if I can make time to look at it though! 

            hans

      • Mar 19, 2015 - 10:15 AM - hans - Author: Comment Link

        So communication seems to work … but they stay light blue. Weird.
        Does this happen with the demo video as well?
        Did you experiment with the depth of a LED (ie. increased hscan or vscan – depending on where the LED is located).

        For example 

        hscan 100 90

        to 

        hscan 100 80

        I’ll admit that I’m guessing now as well … the LEDs do work with the color swirl, so I assume it can make red, green and blue.

        Reply

        hans

        • Mar 19, 2015 - 10:23 AM - Jack Comment Link

          yeah i can make red,green and blue.. but some reason it’s stuck on blue.. I was wondering would it help if i solder +5v input to the end side as well

          Reply

          Jack

        • Mar 19, 2015 - 11:10 AM - hans - Author: Comment Link

          You have a lot of LEDs, so soldering +5V and GND to the ends as well will probably not hurt. I’ve seen suggestions like that elsewhere (might have been on AdaFruit).

          Reply

          hans

  • Mar 20, 2015 - 1:13 PM - owar - Author: Comment Link

    Hi,

    thank you for the oppurtinity to have boblight on my TV. But I have some problems with it and I do not know what to do next…

    I am using openelec on my raspberry B 2
    I have neopixel strand from Adafruit connected to Arduino Mega
    The initial white(or any other color which I set up in sketch) will light
    The RX LED on Arduino is glowing, so I assume the output device in config file is correct
    I have checked, that the prefix in config file and in sketch is the same
    I have tried several baudrates from 9600 to 460800
    I can see the “boblight connected”  message

    But when I play the video, the LEDs are still white…
    Do you know where could be the problem?

    Reply

    owar

    • Mar 20, 2015 - 1:19 PM - owar - Author: Comment Link

      Here is settings from the Arduino sketch:

      #define STARTCOLOR 0xFFFFFF // LED colors at start

      #define BLACK 0x000000 // LED color BLACK

      #define DATAPIN 8 // Datapin

      #define LEDCOUNT 60 // Number of LEDs used for boblight

      #define SHOWDELAY 200 // Delay in micro seconds before showing

      #define BAUDRATE 9600 // Serial port speed, 460800 tested with Arduino Uno R3

      #define BRIGHTNESS 10 // Max. brightness in %

      const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D}; // Start prefix

      And here is my config file:

      [global]interface 127.0.0.1port 19333


      [device]name AmbiLighttype momooutput /dev/ttyACM0channels 180prefix 41 64 61 00 18 4Dinterval 20000rate 9600debug offdelayafteropen 100000

      And here is service.log:

      (InitLog) start of log /storage/.boblight/boblightd.log(PrintFlags) starting boblightd -c /storage/.kodi/userdata/addon_data/service.multimedia.boblightd/boblight.conf(CConfig::LoadConfigFromFile) opening /storage/.kodi/userdata/addon_data/service.multimedia.boblightd/boblight.conf(CConfig::CheckConfig) checking config lines(CConfig::CheckConfig) config lines valid(CConfig::BuildConfig) building config(CConfig::BuildConfig) built config successfully(main) starting devices(CClientsHandler::Process) opening listening socket on 127.0.0.1:19333(CDevice::Process) AmbiLight: starting with output “/dev/ttyACM0”(CDevice::Process) AmbiLight: setting up(CDevice::Process) AmbiLight: setup succeeded(CClientsHandler::Process) 127.0.0.1:44942 connected(CClientsHandler::ParseMessage) 127.0.0.1:44942 said hello(CClientsHandler::ParseSet) 127.0.0.1:44942 priority set to 128

      Reply

      owar

    • Mar 21, 2015 - 5:43 AM - hans - Author: Comment Link

      Hi Owar,

      First thing, your brightness is rather low (only 10%), but I guess it works since the start swirl is visible.
      Not sure how that affects less bright colors though …

      Boblight Connected is a good thing (always make sure that prefix and baudrate match in config file and Ardiuno Sketch).

      The XBMC/Kodi Boblight plugin has brightness settings as well – check those out. The plugin for OpenElec also allows a LED color when there is no video playing – you could use that for testing.

      I hope this is helpful 

      Reply

      hans

      • Mar 21, 2015 - 6:14 AM - owar - Author: Comment Link

        I cut down the brightness just because when I was teting it at night it was killing my eyes :D I set the “menu color” to something blueish and that does not help me too… I will try it with Arduino Uno as somebody said, it does not work on another type, but that is just a shot into darkness :D

        Reply

        owar

      • Mar 21, 2015 - 7:34 AM - hans - Author: Comment Link

        Oh gee, I totally overlooked that you’re using an Arduino Mega … but I’m not sure that would the problem, since the init swirl worked and Boblight confirmed that it connected … hmm,… let me know what you find out – I’m curious! 

        Reply

        hans

        • Mar 22, 2015 - 12:53 PM - owar - Author: Comment Link

          So, I have to confirm, that on Arduino Uno it works just fine and on Mega it does not work at all.. I do not know why, but I am happy that it works! :D

          Reply

          owar

        • Mar 23, 2015 - 3:19 AM - hans - Author: Comment Link

          Awesome …!

          Then we’d have to find out why the Mega refuses to cooperate … 

          Reply

          hans

          • Mar 23, 2015 - 9:00 AM - owar - Author: Comment Link

            It could be the USB driver…my UNO is rev 1 and Mega rev3 which both have differnet USB chips..

            owar

          • Mar 23, 2015 - 9:11 AM - hans - Author: Comment Link

            Interesting … good to know this might be an issue.
            I have a few Mega’s laying around … 

            hans

  • Mar 27, 2015 - 10:08 AM - David Counter Comment Link

    Apologies if this question has already been answered (I didn’t see it anywhere) but when it is said that software requires an LED light in each corner, is that for the purposes of calculating luminosity of pixels, or for resolution purposes, or what, and is there a way around it? I ask because I was intending on using a strip of LEDs for each side of the TV, and then using a solderless connector at each corner. The LEDs I intend using are 5050 10mm, which I assume would be OK? Thanks – great article (and very helpful diagrams)

    Reply

    David Counter

    • Mar 28, 2015 - 4:09 AM - hans - Author: Comment Link

      Hi David!

      Thanks for the compliment! 

      As for your question: I’m not 100% sure what you mean?
      LEDs can be positioned anywhere, even if you’d use only one or two LEDs.
      So a strip Left and one Right would work just fine. 

      It’s just a matter of setting the config file properly. Boblight Config Maker v1.4 supports this.

      Is that what you meant?

      Reply

      hans

      • Mar 28, 2015 - 10:24 AM - David Counter Comment Link

        I think your answer cleared things up – re-reading my question, it was worded really badly! :(
        What would you recommend regarding the strip of LEDs? From what I have read, 5050 10mm would be OK, but I could well be wrong, and I want to make sure I source the parts correctly before beginning the project

        Thanks again
        David 

        Reply

        David Counter

      • Mar 28, 2015 - 11:07 AM - hans - Author: Comment Link

        Don’t worry about the wording – it happens 

        The 5050 is a standard LED model and is used in most strands I have seen so far.
        However, this is just the LED. You’d need to choose the right strand type.
        The WS2811, WS2812, WS2812B are all pretty much the same and it’s what I’ve used.
        The WS2801 could work as well, however controlling them works differently. So you’ll have to watch that part.
        There are loads of other “models” out there, even based on the 5050, but they can all work differently.
        So I’d stick with the WS2812 (commonly advertised as such).
        I’d also recommend using the Arduino Uno R3 – cheap clones do work, but some really weird ones have surfaced lately for less that $5, causing all kinds of problems and complications.
        I recommend to just spend the few extra $ and get the real deal (white back, and has “made in Italy” on it) – it might save you a lot of headaches.
        Another thing to watch is a proper power supply. 
        Reply

        hans

  • Mar 30, 2015 - 7:58 AM - David Counter Comment Link

    Thanks –

    You’ve been really helpful. One last question – I know there are 4 pin solderless connectors out there, but I’ve not seen any 3 pin. I recently broke my right wrist and I don’t really want to tackle any soldering left-handed. Do you know if the necessary connectors are available in 3 pin versions? Also (OK, so that wasn’t the last question, but this one is), would you recommend 30 LED strips or 60 LED strips for a 55″ TV? I tend to think that when people say they prefer 30 LED strips, and that 60 LED strips spoil the effect, it is because their LEDs are too close to the edge of the screen…

    Many thanks

    David

    Reply

    David Counter

    • Mar 30, 2015 - 8:36 AM - hans - Author: Comment Link

      Hi David!

      You’re most welcome 

      Connectors:
      The 3 pin connectors I use are called “3-pin JST SM connectors” (eBay link), those are the ones that were connected to the strands I bought and they do the job just fine.

      LEDs/meter:
      Well, I think 30/m would be sufficient, but if you’re in a room with a lot of light or light sources, you could consider 60/m. If they turn out to be too bright, then you can still turn down brightness (defined in the Arduino sketch). I’ve been very satisfied with 30/m so far.

      Hope this is helpful 

      Reply

      hans

  • Mar 30, 2015 - 9:47 AM - Marini Comment Link

    Hi Hans! Your posts were fantastic! But after making Boblight setup I noticed that the lag is almost 1000ms even though I am using Raspberry Pi 2. Also I had many problems setting up serial port parameters (115200 was maximum). Then I decided to setup Hyperion, also using OpenElec, and it was very good decision because it works fantastic (no lag at all!) and you can use your phone as remote.

    There were many traps but your posts and config utility were helpful (I included links to them) so I made online guide for Raspberry Pi2, Hyperion on OpenElec :  http://ai.rs/reviews/rgb-delight-raspberry-pi2-arduino-nano-ws2812b-using-hyperion-on-openelec/

    PS now remains to setup ambilight for Netflix (using DNS) for external player (apple tv in my case)

    Reply

    Marini

    • Mar 30, 2015 - 10:29 AM - hans - Author: Comment Link

      Thanks Marini!

      Just looked at your guide, and that one looks pretty extensive, well done! 
      Thank you for sharing the link!

      I am planning on writing an article using Hyperion as well, possible one with EnigmaLight. But first I want to finish a new version of Boblight Config Maker (add features, and support EnigmaLight, LightPack, Ambioder, and Hyperion). After that: Hyperion!! 

      Mostly because I have a Raspberry Pi 2 and … I have a HDMI splitter that (by accident?) strips HDCP … the idea being to split the HDMI feed to my TV and grab video on the 2nd splitter output so Ambient Lighting works on all video sources.
      I’ll try LightBerry with that.

      And Netflix and Amazon through DNS still works like a charm!

      Reply

      hans

    • Mar 31, 2015 - 3:51 PM - Martin Comment Link

      This is a nice guide.

      Im running a bit different system. using ws2801 leds with audrino and htpc (asrock ION 330) with openelec. i had to fiddle some with the audrino program to get it working (using Hans guide). Im pretty pleased with my result. only the endless color/light tweaking in boblight is getting on my nerves :-D

      My question is. 

      Is it any different installing it to openelec on a different platform than raspberry. does it work fine just run the scripts and make the hypercon setup etc?

      Reply

      Martin

      • Apr 1, 2015 - 11:20 AM - hans - Author: Comment Link

        Hi Martin,

        I’m not sure what you mean with “the script” – do you mean the Arduino sketch. 
        This article is written with an x86 HTPC in mind (ie. a “regular” PC).

        It should work on Raspberry Pi and Android devices as well – although for those I’d recommend using Hyperion instead of Boblight. 

        As for the sketch;

        For WS2801’s (untested) you might need to adapt line 34 … if NeoPixel even supports WS2801 LED strips.

        For other systems, you’ll only need to make sure you do the proper device settings in the boblight.conf file, where baudrate and prefix should match the values used in the Arduino sketch.

        Does this answer your question? 

        Reply

        hans

        • Apr 1, 2015 - 11:57 AM - Martin Comment Link

          Hi

          Sorry i made that unclear. i was refering to Marinis guide. Of installing Hyperion, but that guide was for a raspberry. “installguide

          My question was will the repository files (scripts?) work on an x86 system. (like my htpc)

          I do not use NeoPixel on my arduino. I use Adalights LEDstream. that one worked fine with the ws2801 together with boblight, on a openelec system. But i want to see if Hyperion performs better =)

          Cheers

          Reply

          Martin

          • Apr 1, 2015 - 5:30 PM - Marini Comment Link

            First ws2801 and ws2812 are totally different. Your diodes use 4 pins and different way of communication. 

            Second, I do not know whether install_hyperion.sh script will work on non openelec OS (hardware is there less problem, OS and installed binaries / libraries could make problem if they are missing). Why don’t you just try? 

            Marini

  • Mar 30, 2015 - 11:08 AM - Marini Comment Link

    Hyperion is really much better and it would be easier for you to write Config Maker update if you can test it properly 

    or just mail me if you need beta testing 

    I read about your splitter, and planing but I am planing to order EasyCap HDMI grabber… what do you think about that? 

    I do not yet know for sure if Hyperion can support external video source (grabber) but it looks like it is possible?

    Ha! you managed to setup DNS for Netflix?

    Reply

    Marini

    • Mar 30, 2015 - 11:23 AM - hans - Author: Comment Link

      I’m hearing very good things of Hyperion – so I will go test that for sure!
      (I’m still traveling, so I don’t have my 80″ TV with my Boblight setup with me, for testing )

      I looked at the HDMI grabber briefly, but I’m not sure it handles HDCP (hence the splitter), and I’m not sure if there is support for it, in for example OpenElec? I have the stuff for LightBerry ready. It uses a HDMI splitter, a HDMI->Composite converter and a Composite->USB grabber. I did play an Elgato Game Capture HD, a very good HDMI grabber. But no support for it in OpenElec. No Linux support, period. 

      I’m wondering how “low” the resolution for the HDMI grabbing can go with the grabber you’re thinking of.
      I’m not sure one would really need 1080p as it will come with a load of data to process.
      I can imagine that a lower resolution might be quicker in proecssing, and offer just as good an end result, but I’m not sure if EasyCap HDMI can do this?

      However, straight HDMI to USB would most certainly be “cleaner” … 
      I’m very curious now …

      Well, I’ll admit, I’ve been lazy and I’m still using UnoTelly … 

      Reply

      hans

      • Mar 30, 2015 - 12:09 PM - Marini Comment Link

        I will research HMDI grabber 

        If you have static IP I can add it to my server and save you some money for LEDs 

        Reply

        Marini

      • Mar 30, 2015 - 12:51 PM - hans - Author: Comment Link

        I’m curious about the HDMI grabber! 
        I wished the Elgato would do the trick … works super fast and smooth – I’m actually impressed how well that thing works. Just no Linux support … 

        And as soon as I’m home again, I’ll take you up on the DNS 

        Reply

        hans

    • Mar 30, 2015 - 4:14 PM - Martin Comment Link

      This Hyperion thing has a great guide here: GreatScott

      i ordered the easycap, but got a wrong one “easiercap” witch has a different chipset, i now ordered 2more and one of them was the “easycap” but i have not tried to setup my build again after that.

      Reply

      Martin

      • Mar 30, 2015 - 6:43 PM - Marini Comment Link

        Martin, that is composite grabber? not hdmi?

        Reply

        Marini

        • Mar 30, 2015 - 6:51 PM - Marini Comment Link

          I am thinking about EzCap 280 or EzCap 282 but yet do not know will they will work on linux/raspberry and what about HDCP… Any idea?

          Reply

          Marini

          • Mar 31, 2015 - 1:28 PM - Martin Comment Link

            Ooh, that one looks nice.

            In the video he is using a hdmi2av converter, and a hdmi splitter before that. a lot of electronics, but it seems to work fine. 

            I would love to have a single device such the one above to do the work.

            Martin

          • Apr 1, 2015 - 11:23 AM - hans - Author: Comment Link

            If I recall correctly, LightBerry offers a all-in-one device (HDMI splitter, HDMI2AV Convert and USB Grabber in one device). But I doubt it will handle HDCP … 

            hans

      • Mar 31, 2015 - 5:16 AM - hans - Author: Comment Link

        Thans for the link! 

        I was recommended the “UTV007 Fushicai grabber” by the owner of LightBerry.eu.
        OpenElec appears to support this one natively.

        Some additional info links:

        Another comment I found (on the page with the last link):
        OpenELEC does support Utv007 grabber (so called Fushicai) already, but the chip is no longer available on the market and even Fushicai factory is producing now only stk1160 and it looks like it’s gonna stay like this for a while.
        As for HDCP stripping; well, getting one of the HDCP stripping HDMI splitters would do the trick – you’d probably have to split the video anyway. 
        I tried the Elgato Game Capture HD, which is awesome hardware and grabs HDMI really well, but seriously lacks Linux support … an attempt to reverse engineer can be found at GitHub, maybe one day this results in a workable driver. Another advantage of this grabber, that is if it would support HDCP stripping, is that it has HDMI pass-through … so a splitter would then not be needed .
        No dice so far … please let me know if you find a good working HDMI capture device, suitable for use with Raspberry Pi and/or OpenElec …

        Reply

        hans

  • Mar 31, 2015 - 4:04 AM - Dennis Comment Link

    Hi!

    First of all thank you for the guide, it has been really helpful. Before I’m going to buy anything I want to be sure I understand everything. So I have a few questions. First of all how do you connect you DC adapter. Looking at your picture you would connect it directly to the strip and the Arduino? Second what are the green-red-blue connector cables called you use between the stands. And finally how big is the difference in detail between 60 leds/m and 30led/m 

    Thank you in advance! 

    Reply

    Dennis

    • Mar 31, 2015 - 5:00 AM - hans - Author: Comment Link

      Hi Dennis!

      No problem … better ask than ending up with the wrong stuff 

      The DC adapter is connected to the LED strip (+5 and GND) and the Arduino (only GND) – see figure 14.

      The connectors is called “3-pin JST SM connectors” (eBay link).

      Theoretically the 60 LEDs/m should offer more detail, but practically I think it will only add more brightness. 
      The detail would fade since the colors mix on the wall behind your TV.
      The brightness increase might be useful in rooms where you have multiple or bright light sources.
      I used 30 LEDs/meter

      Hope this helps get you started. 

      Reply

      hans

      • Apr 2, 2015 - 11:19 AM - Dennis Comment Link

        Hi Hans!

        Thank you for the fast and clear answer!

        I just ordered the 3-pin JST SM connectors you linked me to and the led strip (http://www.aliexpress.com/item/5M-30Pixel-M-150-5050-RGB-SMD-WS2811-IC-Built-in-WS2812B-WS2812-white-PCB-Addressable/1998194636.html).

        There is still something I don’t understand. How do you connect the +5 and the GND to the strip. Can you just plug the DC adapter into the JST SM connector or do I need to fabricate something myself like in figure 20?

        I hope my question aren’t that obvious. This is the first time I’m building something myself.

        Thanks again!

        Reply

        Dennis

        • Apr 2, 2015 - 1:40 PM - hans - Author: Comment Link

          Hi Dennis … You’re welcome 

          I used Screw Terminals (second picture on the right on this Wiki page) – meaning: I have cut the 2 wires (for GND and +5V) from the leads that come from the strip and placed a screw terminal in between so that I can connect the GND of the power supply and the Arduino, and the +5V of the power supply, to the LED strip without needing to solder anything.

          Feel free to ask if I didn’t explain that too clear … (absolutely no pun intended – I’m just re-reading y response and I’m not sure if I explained it clear).

          Reply

          hans

  • Apr 2, 2015 - 1:35 PM - tzahi Comment Link

    hello

    is there a way to control on witch addons the leds work on ?

    I want that the led will only work on movies, I disable on the boblight setting all the options but the movies, but still some addons starts the leds.

    Reply

    tzahi

    • Apr 2, 2015 - 2:08 PM - hans - Author: Comment Link

      Hmm, interesting. The OpenElec Boblight plugin should allow you to disable the LEDs for pretty much everything.

      Could it be that the other plugins use video as well and therefor cause the plugin to see it as such?

      For example, the plugin Genesis (streaming video) would probably activate the LEDs as well … which is what I’d expect it to do.
      Which plugins activate the LEDs in your case?

      Reply

      hans

  • Apr 2, 2015 - 3:03 PM - tzahi Comment Link

    when I play a series from gensis it dosen’t active the leds because I disable this serias on boblight settings, somthing wird is when I add seirias to library on gensis it does activate the leds.

    the leds also play on kids addon that I have install and dont want them to activate the leds.

    Reply

    tzahi

    • Apr 3, 2015 - 5:15 AM - hans - Author: Comment Link

      Interesting … and a little weird yes 

      So TV series in the Library are marked series or maybe (internally) as movies?

      Are you using the official XBMC Boblight add-on or the OpenElec version? I’m not even sure if there are differences between the 2 – but it might be worthwhile asking your question in the OpenElec or XBMC/Lodi forums …? (I’d start at the XBMC/Kodi link)

      It seems to me that making the distinction between series and movies appears problematic for the plugin – either because video/plugins are not assigned the correct “type” or because the plugin can’t see where it comes from in some way …? I unfortunately do not have access to my hardware at the moment (traveling) to test any of this – maybe other users have similar experiences?

      Reply

      hans

  • Apr 4, 2015 - 5:52 AM - leo06 Comment Link

    hi,my pixels wired are GBR,how can i change that?i try to change this line Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDCOUNT, DATAPIN, NEO_BGR + NEO_KHZ800);  in t4a_boblight but i get error compilling (error NEO_BGR was not declared in this scope)

    Reply

    leo06

    • Apr 4, 2015 - 10:54 AM - hans - Author: Comment Link

      Hi Leo06 …

      If I see things right in the NeoPixel code, then NEO_RGB, NEO_GRB and NEO_BRG should be supported. The .h include confirms this in line 32 of the code. Maybe your NeoPixel library is incomplete, corrupt or outdated? (check the Adafruit_NeoPixel.h file)

      Oh and the value for NEO_BRG seems to be “4”, maybe if you type that instead of NEO_BRG?

      Or did you mean GBR (which I didn’t find)?

      Reply

      hans

      • Apr 4, 2015 - 11:03 AM - leo06 Comment Link
      • Apr 4, 2015 - 11:26 AM - hans - Author: Comment Link

        OK, then this would not be supported by the color calculation function. 

        Assuming the schematics in the ad are the correct way of reading then you’d indeed be working with BGR, which seems a little odd to me, but that could be because I simply never saw these before. 

        You could try changing the bytes in line 97:

        strip.setPixelColor( currentLED++, buffer[0], buffer[1], buffer[2]);  // and assign to LEDs

        to

        strip.setPixelColor( currentLED++, buffer[2], buffer[1], buffer[0]);  // and assign to LEDs

        I did not test this … just something I’d try without too much thinking … and use NEO_RGB.

        Reply

        hans

        • Apr 4, 2015 - 12:08 PM - leo06 Comment Link

          thanks,i use 2 0 1 instead of 2 1 0 and works

          Reply

          leo06

        • Apr 4, 2015 - 12:10 PM - hans - Author: Comment Link

          Awesome! 

          Reply

          hans

          • Apr 5, 2015 - 9:01 AM - leo06 Comment Link

            i have another problem  https://www.dropbox.com/s/yf7og3l8pq1vok1/20150405_164539.jpg?dl=0  do you know where is the problem?i use boblight config maker

            Image of the DropBox link:
            Coloring Error Boblight

            leo06

          • Apr 5, 2015 - 9:17 AM - Marini Comment Link

            Leo, it looks like your grabber is not working (if you are using hyperion) or that for boblight you have not enabled boblight xbc plugin or have not activated boblight for that type (e.g. video)…

            Marini

          • Apr 5, 2015 - 9:36 AM - leo06 Comment Link

            i use boblight,boblightd and xbmc boblight is enabled,in xbmc boblight is all enabled video,movies,tv shows,live tv

            leo06

          • Apr 5, 2015 - 2:32 PM - hans - Author: Comment Link

            Leo06, Do I see this right:
            with the 4 blocks of the video demo, every LED is blue, except behind the yellow block where it’s green?
            Is that what you mean?

            hans

          • Apr 5, 2015 - 4:07 PM - leo06 Comment Link

            yes

            leo06

          • Apr 6, 2015 - 6:06 AM - Marini Comment Link

            Have you tried setting 500.000 bps in config and in sketch like I discovered and suggested on my Hyperion tutorial http://ai.rs/reviews/rgb-delight-raspberry-pi2-arduino-nano-ws2812b-using-hyperion-on-openelec/

            erratic blinking could be a simptom of bad serial connection (e.g. dropping data)

            Marini

          • Apr 6, 2015 - 6:30 AM - leo06 Comment Link

            i try and 500.000 with same result

            leo06

        • Apr 5, 2015 - 4:10 PM - hans - Author: Comment Link

          How did you test if

          strip.setPixelColor( currentLED++, buffer[2], buffer[0], buffer[1]);  // and assign to LEDs

          was the correct way to do it? (just making sure this trick didn’t screw up things – I have no means to test)

          Reply

          hans

          • Apr 5, 2015 - 4:14 PM - leo06 Comment Link

            I test it with the video,the first 3 pictures red,green,blue and it was correct

            leo06

          • Apr 5, 2015 - 4:24 PM - hans - Author: Comment Link

            Excellent – that sounds like a good test to me – so I assume our little trick didn’t cause this.
            (I hope you don’t mind I’ve added your picture to your post for future reference)

            Maybe there is an issue with your config file – could you sent it to me?
            (I prefer to keep the discussion here, but feel free to reply to the notification email with the config attached)

            hans

          • Apr 5, 2015 - 4:33 PM - leo06 Comment Link
          • Apr 5, 2015 - 4:43 PM - hans - Author: Comment Link

            Thanks  ….

            Well, I’ve looked through the config and can’t find any reason why you’d see this effect. Bummer. I really hoped to see something odd there … 

            One thing I would start with is lowing the baudrate to say 115200 (in the config and the sketch), just to eliminate this could contribute to this effect. I have seen systems work great at this speed, but some (mostly Windows machines) fail miserably at speeds above 115200.

            hans

          • Apr 5, 2015 - 4:45 PM - leo06 Comment Link

            i use openelec,i will try and 115200 tomorow,thanks for reply

            leo06

          • Apr 6, 2015 - 4:48 AM - leo06 Comment Link

            I try 115200 and nothing

            leo06

          • Apr 6, 2015 - 5:22 AM - hans - Author: Comment Link

            Bummer  … 

            It’s really weird that the initial colors work well, but with the blocks it seems to go nuts.
            I honestly have no idea why this would happen.

            Led strands seem OK (colors worked), baudrate isn’t the issue, power supply seems OK (initial colors), config seems OK,… and you’re sure those are WS2811 or WS2812’s right, not some exotic model.

            Did you do the strand tests? (see the “Arduino – Controlling a WS2812 LED strand with NeoPixel or FastLED article“)

            hans

          • Apr 6, 2015 - 5:26 AM - leo06 Comment Link

            yes it is WS2811,i will try and strand test

            leo06

          • Apr 6, 2015 - 5:27 AM - Marini Comment Link

            Are you sure that communication with arudino is ok? Check boblight logs? Try to change baud rate?

            Marini

          • Apr 6, 2015 - 5:55 AM - leo06 Comment Link

            I change baud rate,where boblight logs is stored?

            leo06

          • Apr 6, 2015 - 6:03 AM - leo06 Comment Link
          • Apr 6, 2015 - 12:34 PM - hans - Author: Comment Link

            That’s pretty erratic flickering of the LEDs. 

            Since the strandtest is causing issues as well, I doubt you’ll have to look at Boblight very much. I’d have to guess that this indeed is a communication issue of some sorts.

            Can you try (I know it sounds “stupid”) a very low baudrate, for example 9600. My strand actually works pretty good at 9600.

            Can you see (when looking directly at the LEDs on the back) if this behavior starts at a particular LED – maybe you’re dealing with a malfunctioning LED that is not passing the data correctly.

            When I had issues with a strand, I simply shorted Din and Dout of a LED that I suspected that could be causing the problem.

            If you have several “pieces” of LED strands, test them individually and/or try changing the order of strands, in a test setup, to make sure it’s not the first LED or strand.

            I would do these test with the strand tests, to keep things simply while testing. Can you record a video when seeing the LEDs directly (ie from the back of your TV)?

            hans

          • Apr 6, 2015 - 2:05 PM - leo06 Comment Link

            i try 9600 to but same result,i think is hardware problem to,the led strip or even the arduino (is not original arduino uno)the led strip is one 3m 90 leds piece

            leo06

          • Apr 7, 2015 - 3:52 AM - hans - Author: Comment Link

            Bummer that it’s one piece … (nicer for building though) 

            Can you access the pins of the individual LEDs? (the soldering pads between LEDs)
            Some strips are casted into silicone, or are in a plastic housing, making it harder to reach those pads.

            If you can reach the pads without destroying the strand, then try connecting the wire that comes from the Arduino to the Din pin of a different LED. For example, the 2nd one, test the strand, and if it fails, go to the next strand.

            Or … and this is harder I guess: see if you can get your hands on a different strand of LEDs or a different Arduino.
            Clone Arduino’s typically function just fine. So I’d suspect issues with the strand.

            hans

          • Apr 7, 2015 - 4:11 AM - leo06 Comment Link

            it is waterproof,so i can’t access but i order another 1m 60 leds ws2812b just for testing

            leo06

          • Apr 7, 2015 - 4:59 AM - hans - Author: Comment Link

            Sorry to hear that you’ll have to spend more money on parts … 
            Are you getting the strand from another supplier? Just to make sure you get a “real” WS2811/WS2812?
            Or how about returning the strand?

            hans

          • Apr 7, 2015 - 5:05 AM - leo06 Comment Link

            yes this one http://www.ebay.com/itm/181684019869?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

            with what excuse to return?the  strand is working,not like i want but is working

            leo06

          • Apr 7, 2015 - 5:14 AM - hans - Author: Comment Link

            Good point … and even if it was broken, you’ll always have to hope that the seller is co-operative. 

            I can’t find the ones I bought, but the seller is noolec, and I think this listing is the same as the one I have:
            5m 60 LED/m RGB LED Light Strip 5V WS2811 (WS2801) Waterproof Addressable Color

            I had 2 LEDs that failed.

            hans

          • Apr 7, 2015 - 10:19 AM - leo06 Comment Link

            update,i send a message to seller and he told me that 1 ws2811 controller is for 3 leds,so it can’t control each led individual

            leo06

    • Apr 7, 2015 - 10:34 AM - hans - Author: Comment Link

      I’m just starting a new block here, the other list of comments is getting a bit long 

      I’m not sure what the seller is talking about …

      A “LED” on a WS2811 or WS2812 strand is in reality a “module” with a tiny controller chip and individual 3 LEDs (one for each color – red, green and blue). There for each “module” controls only 3 LEDs, if they mean to mention each individual LED in the module.

      Each module has +5V and GND and a Din (Data IN) and a Dout (Data OUT which goes to the next “module”).

      I think that’s what he means. Which means that the strand should function just like any other strand.

      Data is sent to Din of the first LED, which reads the first data chunk and then passes the remaining data on (over Dout) to the next module which repeats this step and passes the remaining data on to the next module, etc etc.

      I know … confusing because of the word LED that’s being used to indicate the individual LEDs in the module, and commonly also used to indicate the entire module (the white blocks on the strand). Maybe reading the beginning of this article explains it a little better. 

      Reply

      hans

      • Apr 7, 2015 - 10:42 AM - leo06 Comment Link

        no,its 1 chip for 3 leds (ws2811 not 2812) https://www.dropbox.com/s/mt6oeuy9azc53ju/20150407_182656.jpg?dl=0

        Reply

        leo06

      • Apr 7, 2015 - 11:00 AM - hans - Author: Comment Link

        You’re right! 

        The WS2811 has a separate chip per 3 LEDs – so chip + 3 LEDs in a module.
        The WS2812 has the chip integrated in the module, but in the end works the same – just a module with all in it.

        But what was the point the seller was trying to make?

        Reply

        hans

        • Apr 7, 2015 - 11:09 AM - leo06 Comment Link

          can control 1 chip 3 leds individual?i mean led1 green,led2 red,led3 blue.another thing can i power them up from a molex conector?red +5v and black ground?

          Reply

          leo06

        • Apr 7, 2015 - 11:22 AM - hans - Author: Comment Link

          Yes you can “control” them individually, but only by sending the right data to the chip for those LEDs. I guess you technically could skip the chip and connect directly to the LED module. It most likely has one common pin and 3 pins (one for each LED). To control one LED in the module, you’d use the common one and the additional one. But you’d have to be careful how you connect and not blow up the LED.

          Trying to control them like that is kind-a cumbersome and I’m not sure why one would want to do that.

          I found that when I connect +5V and GND only (to the strand) that the LEDs might light up. Even if it’s just briefly. But I’m not sure it’s a good test for anything.

          Since your stands are casted in silicone, maybe you can try pushing a pin through the silicon.
          The idea being: connect everything as usual. With the exception of the Din wire (that comes from the Arduino Pin 13). Now push the metal pin through the silicon so it touches the “Din” pin of the pads. This way you can bypass the first LED, then the 2nd and so on. See what happens. Or better said: when the strand starts acting normal.

          You could also bypass one LED at a time this way. If you manage to short Din and Dout of a given LED and see when things work normal. I guess the key is to get through the silicon.

          Reply

          hans

          • Apr 7, 2015 - 11:37 AM - leo06 Comment Link

            IS WORKING,the led strand has 90 leds but only 30 chips,so in the sketch i put 30 leds not 90 and it works

            leo06

          • Apr 7, 2015 - 11:42 AM - hans - Author: Comment Link

            Oh man!! That’s Awesome!!! 

            hans

          • Apr 7, 2015 - 11:46 AM - leo06 Comment Link

            and it makes sense,each 1 chip (3leds) is acting like one 

            leo06

          • Apr 7, 2015 - 12:05 PM - hans - Author: Comment Link

            Indeed – that’s why the config files talks about channels rather than LEDs. Number of Channels = 3 x number of “LEDs” (modules) ….

            I’m happy to hear that you’ve finally got it to work! 

            hans

          • Apr 7, 2015 - 5:24 PM - leo06 Comment Link

            is there any setting for the black bars?all my movies is 1920×1080 and most of them have black bars top and bottom

            leo06

          • Apr 7, 2015 - 5:28 PM - Marini Comment Link

            Just go in Boblight Config (great app! ) for LED Block Depth (size) Rows 10% instead of 5%. Similar setting is available in Hyperion

            Marini

          • Apr 7, 2015 - 5:38 PM - leo06 Comment Link

            thanks,it worked with 15%

            leo06

          • Apr 7, 2015 - 5:55 PM - Marini Comment Link

            good to hear that 

            Marini

          • Apr 8, 2015 - 3:09 AM - hans - Author: Comment Link

             Good to hear it works! Thanks Marini for the helping hand! 

            hans

  • Apr 15, 2015 - 5:16 AM - Ivn Comment Link

    Hi Hans,

    It works perfectly!! But I have small problem, the first led is always flashing in green, even when the others led are off. What would be the problem?

    Thanks!!

    Reply

    Ivn

    • Apr 15, 2015 - 8:12 AM - hans - Author: Comment Link

      Hi Ivn!

      It could be that the first LED is faulty (since red and blue do not seem to light up). It’s just a guess of course.
      You could try to by-pass the first LED and see if the 2nd LED shows the same issue. If it does then the 1st LED was not faulty. If it doesn’t then the first LED was faulty.

      Bypassing can be done relatively easy which depends a little on the type of strand you have of course. In essence you’d like to connect the Din wire (disconnect it from LED1) to the Din of LED2. If you have one of those very nice strands, casted in silicone, then this might be a bit tricky, maybe you can poke a pin through the silicon and hold it there for test purposes.

      Hope this helps …

      Reply

      hans

    • Apr 16, 2015 - 1:00 PM - Martin Comment Link

      do a colorswirl or use the smartphone app to set all leds to specific colors.

      i had one only flashing blue, and it would not show any other color than that =broken ^^

      Reply

      Martin

  • Apr 15, 2015 - 11:38 PM - tzahi Comment Link

    Hey

    I still can’t disable the leds on diffrent addons.

    I thought since I only want to use the led for movies from time to time maybe I turn it off till I want to use it.

    what is the simle way to turn off the boblight without need to upload a new sketch evreytime, and without changing any config I made.

    should I add an on/off button somewhere ?

    or should I disable it from the kodi ?

    Reply

    tzahi

    • Apr 16, 2015 - 3:32 AM - hans - Author: Comment Link

      I’m sorry to hear that you’re still stuck with the same problem … 

      Option 1 (probably only Linux)

      I found this forum post at KodiNerds.net: Boblight Addon per keymap aktivieren deaktivieren (it’s in German for “Boblight Addon Activate and Deactivate by keymap). It says it starts/stops Boblight with your remote by doing a keymap.

      First they assign a script to a button on your remote by adapting the keymap (see also Kodi Wiki):

      <key id="250">XBMC.RunScript(/storage/.kodi/userdata/addon_data/service.multimedia.boblightd/boblight.toggle.py)</key>

      Next they create a little Python script that starts/stops Boblight.

      import subprocess
      import xbmcgui
       
      pid = subprocess.Popen('pidof boblightd', shell=True, close_fds=True, stdout=subprocess.PIPE)
      dialog = xbmcgui.Dialog()
      try:
          if pid.stdout.readlines():
              subprocess.Popen('systemctl stop service.multimedia.boblightd.service', shell=True)
              dialog.notification('Boblightd', 'Boblight Disabled (OFF)', xbmcgui.NOTIFICATION_INFO, 5000)
          else:
              subprocess.Popen('systemctl start service.multimedia.boblightd.service', shell=True)
              dialog.notification('Boblightd', 'Boblight Enabled (ON)', xbmcgui.NOTIFICATION_INFO, 5000)
      except Exception, e:
          pass

      That last file is saved (in this example) as boblight.toggle.py in the directory /storage/.kodi/userdata/addon_data/service.multimedia.boblightd/.

      It is said to be cross platform but I kind-a doubt that (seeing that “systemctl” does not exist in either MacOS X or Windows).

      Option 2 (Probably only Linux and MacOS X)

      For other platforms you could create a script to start and to stop Boblight and assign each function to an individual remote button. I have to admit that I do not know how that would work under Windows.

      One script could do something like this (this would work under Linux and MacOS X – no idea how to do that under Windows):

      killall boblight

      And the other one could be something like this:

      <path to boblight>/boblight -c <tour config file>

      Here you’d have to enter the correct Boblight path and path to the config file of course.

      Option 3 (Only when you have an Android phone)

      Use Bobdroid on your phone to enable/disable Boblight. See Android – Bobdroid in the Kodi forum.

      Option 4 (OpenElec)

      You could use the script presented in the OpenElec forum to enable/disable Boblight with your remote.

      Option 5 (Based on KarateLight but works with Boblight)

      You could look at the scripts this post on the Kodi forum mentions: KARATELIGHT with boblight and XBMC.
      (don’t get confused with the KarateLight phrase, read the last part of the first post)

      You could also snoop the Official Boblight Thread at the Kodi forum, I noticed that some guys are discussing this option there as well.

      Hope this proves helpful – please let us know if you find something that worked for you … 

      Reply

      hans

    • Apr 16, 2015 - 3:36 AM - hans - Author: Comment Link

      I did find an App for iOS as well, but I’m not sure if it allows enable/disable Boblight:

      https://itunes.apple.com/app/boblight/id709737895?mt=8&ign-mpt=uo%3D4

      Reply

      hans

  • Apr 20, 2015 - 3:56 PM - tzahi Comment Link

    thanks for the detailed answare.

    to disable the leds from kodi do I need to disable “XBMC Boblight” or “boblightd” or both ?

    Reply

    tzahi

    • Apr 20, 2015 - 4:12 PM - hans - Author: Comment Link

      Disabling boblightd would be the way I’d try first.

      It seems that other kill the deamon as well.

      Let us know how you’ve done it … 

      Reply

      hans

      • Apr 20, 2015 - 5:02 PM - tzahi Comment Link

        what you mean “kill the deamons” ?

        by disable boblightd I won’t need to upload the sketch again, right ?

        Reply

        tzahi

      • Apr 21, 2015 - 2:43 AM - hans - Author: Comment Link

        Hi Tzahi!

        Correct! Stopping or killing the boblight process does not require to reload the sketch.

        Reply

        hans

  • Apr 27, 2015 - 8:10 PM - RStephen Comment Link

    Greetings…I am running an RPi2/OpenElec Kodi system and am looking for the latest April 2015 tutorial for adding Ambi Lights/RGB’s/LightBerry or what ever the current name is. I am looking for something that uses RGB strips as I have worked with them before and my 72 nova dash and interior lights are all RGB’s on a remote control. I have seen lots of tutorials out there but with some of the rapidly changing technology, I am sure some are better/simpler than others Any advise would be greatly appreciated…Regards.

    Reply

    RStephen

  • Apr 28, 2015 - 4:06 AM - pekindi Comment Link

    Good morning,

    First
    I want to apologize for my English, because I am using a translator to not
    master the language.

    I
    often want to thank you for the guide, is the only one I’ve found across the
    network to operate this type of leeds, as all others rely on the strips 2801.
    Although I can not get me work.

    You see, my OS is
    Windows 7 64 bit.
    The
    strips are of 2812 (96 leeds, 16 vertical and 31 horizontal), my Arduino is
    mega (connected to com 8) and want to use with Kodi.
    To
    find your guide not even getting the Arduino board lit than the first led the
    entire strip.


    Once
    your sketch loaded, I get that all the LEDs illuminate me strip.
    Even
    changing the color start putting sketch, the LEDs are lit with the color you
    get.
    Therefore,
    I understand that there is communication between the Arduino board and the
    strip of LEDs.
    A stride I got
    to thank you.

    And here come the problems. Then
    install the boblight in C and XBMC addon Boblight in Kodi.
    I
    think the boblight configuration file and place it in its appropriate folder.
    But
    once executed Kodi, leeds turn solid color home and change.
    Neither
    the menus Kodi, or playing a movie.

    Both
    the sketch, as in the config boblight, change the values ​​you had for which I
    have as number of LEDs, clockwise;
    I put on output device / dev /
    arduino;
    in type I put momo; the
    baudrate left it on the same principle but then I’ve been changing it and has
    not worked for me;
    the
    prefix’ve left that came in your sketch (41 64 61 00 18 4D) ….

    You
    see that’s guide to OpenELEC, there is a problem because I’m running under
    Windows?
    You
    could try instead Ambibox boolight?
    Would
    be very grateful if you could lend me the slightest help, for I am totally
    blocked.

    Thank you. A greeting !!!!

    Reply

    pekindi

    • Apr 28, 2015 - 8:48 AM - hans - Author: Comment Link

      Hi Pekini!

      Thank you for your kind words – you’re right; the translator makes a little bit of a mess of it , but I think I understand what you’re saying.

      Maybe your Boblight is not communicating with the Arduino.
      The baudrate should be the same in sketch and the Boblight config file (which wasn’t clear from your comment).
      I understand that the prefix already are identical in both files.

      Next step is to check the xbmc.log – if you found yours, then please post it through http://pastebin.com/.

      I do not use Boblight under Windows, but it seems the log file can be found here:

      C:\Users\<your username>\AppData\Roaming\XBMC

      or here:

      C:\Users\<your username>\AppData\Roaming\Kodi

      (Windows users that read this: can anyone confirm this?)

      With one user I have noticed that the config files used a comma as a decimal separator – and Boblight didn’t like that. It should be a period in certain cases. But the log file would tell us.

      Hope this helps you get started debugging .

      Reply

      hans

      • Apr 28, 2015 - 6:25 PM - Pekindi Comment Link

        Hans thank you very much, for so prompt reply and for
        your cooperation
        .

        Indeed the baudrate
        is the same in both the sketch and in the configuration
        file
        boblight, and port properties (115200).

        Likewise, the prefix is identical in both (0x41, 0x64, 0x61, 0x00,
        0x18, 0x4D).

        As for what he says of the decimal point … If I put the config
        Boblight comma as decimal separator, to
        jump start me
        error Kodi failure
        in connection
        with Boblight.
        If I put the point as decimal separator,
        to start Kodi
        says “connected to boblight“.

        I step kodi.log,
        as you asked me: http://pastebin.com/NbipNati

        Thank you very much again. Greetings !!!!

        Reply

        Pekindi

      • Apr 29, 2015 - 2:43 AM - hans - Author: Comment Link

        Hi Pekindi,

        I do not consider myself an expert on the log files, but I do not seen anything exceptional – that’s a pitty 

        Seems you should use the decimal point .. so that’s OK too.

        The guide was written with OpenElec on a x86, and the plugin for XBMC/Kodi will of course not be the one for OpenElec, rather the “original” one. But it seems that’s what you have done.

        Did you check the plugin settings (in Kodi)? Just to make sure boblight is ON for movies and TV shows?

        (I’m guessing now as well, since everything seems fine)

        Reply

        hans

        • Apr 29, 2015 - 4:54 AM - pekindi Comment Link

          Hello Hans!

          Yes, the Boblight Kodi configuration is correct, with the parameters indicabas you in this guide, and indeed is ON for both movies and series. The fact is that the LEDs are in the same color they had before opening Kodi, and so still, and I move through menus, and put movies or series.

          Thank you very much again.

          Greetings!

          Reply

          pekindi

        • Apr 29, 2015 - 1:58 PM - hans - Author: Comment Link

          Hi Pekindi,

          Could you post you boblight.config and arduino sketch in PasteBin as well please?
          I might have to take a look at that.

          Reply

          hans

          • Apr 29, 2015 - 4:44 PM - Pekindi Comment Link

            Hi Hans,

            thank you very
            much for continuing there and try to find the solution.

            You step what you
            ask me. Arduino sketch first. It’s like yours but modifying what I said in my
            first post.

            http://pastebin.com/f9b2pwzk

            And now the config
            file Boblight.

            http://pastebin.com/inwpbCHA

            I hope to find the
            solution ….

            Greetings!

            Pekindi

        • Apr 30, 2015 - 3:56 AM - hans - Author: Comment Link

          Well, I’ve look at the Sketch and your config.
          They both look correct.

          The log does say that the Boblight plugin is started, but I do not see any other confirmation that it get’s connected.

          You could try (I’ve never done this – just found it somewhere online):

          cd c:/boblight
          boblightd

          Which should show something like this (or in the log file in the boblight directory? – Sorry I have never used Boblight under Windows):

          (InitLog) start of log /home/xbmc/.boblight/boblightd.log
          (PrintFlags) starting boblightd
          (CConfig::LoadConfigFromFile) opening /etc/boblight.conf
          (CConfig::CheckConfig) checking config lines
          (CConfig::CheckConfig) config lines valid
          (CConfig::BuildConfig) building config
          (CConfig::BuildConfig) built config successfully
          (main) starting devices
          (CClientsHandler::Process) opening listening socket on 127.0.0.1:19333
          (CDevice::Process) ambilight: starting with output "/dev/ttyACM0"
          (CDevice::Process) ambilight: setting up
          (CDevice::Process) ambilight: setup succeeded

          In the XBMC/Kodi log I’d expect to see something like this as well …
          I apologize for not being able to verify this myself – I’m traveling so I do not have my gear nearby.

          This make me suspect that either the connection from CBMV/Kodi -> Boblight is not working properly, or that Boblight can’t connect to the Arduino.

          If you’re not using an Arduino Uno, please verify that you’re using the right pins. 

          Reply

          hans

          • Apr 30, 2015 - 5:37 AM - pekindi Comment Link

            Hi Hans,

            I do not quite understand what you say you try to cd c: \ boblight, boblighthd … try to find when I get home and can tinker with the team.

            I guess with you indicate that I might know if boblight are connecting with Arduino …

            The lines you sent me, there are two, which I think should change, not out of where you are these:

            (CClientsHandler :: Process) opening listening socket on 127.0.0.1:19333
            (CDevice :: Process) ambilight: starting with output “/ dev / ttyACM0”

            The first of these lines do not have to change it if, as it seems that refers to an IP address or port, and if I have to, do not really know where to get the correct information from my computer.

            In the second case if you have to change it, because in my Boblight config is set as device / dev / Arduino.

            As for what he says to me the type of plate … I am using an Arduino Mega, but I connected the pins as you say in your guide, on pin 13 and GND.

            Thank you very much, again.

            A greeting!

            pekindi

          • Apr 30, 2015 - 6:21 AM - hans - Author: Comment Link

            Hi Pedinki,

            the “/ dev / ttyACM0” was just an example output.
            I think under windows it’s common to use “/dev/com1” or which ever com port you’re using of course.

            I have no experience with the MEGA, but I recall reading somewhere that the for one or the other Arduino model might be different.

            hans

  • Apr 30, 2015 - 6:40 AM - pekindi Comment Link

    Hi Hans,

    about the line

    (CClientsHandler :: Process) opening listening socket on 127.0.0.1:19333

    That address or port also have to change it? Where would you get that information?

    Greetings!

    Reply

    pekindi

    • Apr 30, 2015 - 9:39 AM - hans - Author: Comment Link

      Hi Pekindi,

      this information should be in the Boblight log file.
      I suspect it’s located in the C:\boblight directory (where you have Boblight installed).

      It could also be in the XBMC/Kodi log. See for example this comment.
      The IP address and IP Port number are  only examples, but typically it would say 127.0.0.1 (localhost a.k.a. you computer that’s running Bobolight and Kodi/XBMC).

      Reply

      hans

  • May 8, 2015 - 6:23 PM - Pekindi Comment Link

    Hi Hans,

    I keep
    tinkering to see if I can make this work before it gains me discouragement.

    You see,
    I’ve tried to change the output port, switch between comma and decimal point
    … Nothing works, still not changing the LEDs with no film.

    The last
    thing I tried was to run the daemon boblight directly from the MS-DOS screen
    …. So I could see that there were times that the daemon is not running
    because it gave errors.

    At the end
    I saw that the only way to run boblight is putting comma as decimal separator
    and to discard the device output options.

    Anyway, I
    have not gotten it to work with Kodi. When I run Kodi I see on the screen of
    MS-DOS that indeed the boblight is exchanging data with it. But LEDs do not
    move. I see that if in the first line, after running MS-DOS boblight me an
    error message, that while the program appears not stop, I wonder if there will
    be the problem with Kodi. The line reads:

    ERROR:
    unable to make directory /home/Pekindi/.boblight/:

    No such
    file or directory

    Another
    thing to note is that, although the direction the config boblight and put in
    s