Tag Archive | NeoPixel

DIY Ambilight + WS2812B + Arduino + Boblight for Windows

Hello everyone,
I write this post not only to show you my new Ambilight clone but especially hoping to save you the four days of madness that I spent working on this project, including failed attempts and various problems I had to solve.

Yes, Because Those Who decides to engage in this project will come across many headaches, as I myself have Dealt with, and Inevitably will pour on the forums into the sea of ​​questions that are repeated.

I promise you that Following this guide and my resolutions to known problems, you will have an Ambilight clone running in less than 40 minutes. Do not believe me? Follow me and you will see. Let’s start!


List of components:

Hardware

  • Led strip type WS2812B
  • Arduino Mega
  • Power supply stabilized 5V – 45A

Software


Arduino Side:

I assume That You Already have Followed this excellent guide to recognize the various types of LED strips, installed the hardware and successfully run the tests.

  • “strandtest” from the library Adafruit Neo Pixel
  • “Fire2012” and “ColorTemperature” from the library Fast_LED.

Tip: Do not bother with libraries LEDStream or Adalight as they are dedicated to chip WS2801 (4 pins) and use a communication protocol different from the WS2812 (3 Pins).
Make sure you have the library Adafruit_Neo_Pixel-master installed, load this sketch to your Arduino after making sure to change the following fields according to your needs:

DATAPIN: The pin number connected to your data_in of the LED strip.

LEDCOUNT: The number of LEDs used in your system, it’s the number of discrete LEDs present, not the number of RGB channels. Es: If you have 120 LEDs, it is 120.

BAUDRATE: Must be the same value specified in the file boblight.conf of boblightd daemon. If you do not have communications issues whatsoever leave the default value.

PREFIX: This sketch uses a series of 6 HEX numbers to recognize the beginning of each color frame.

Tip: Prefix is an arbitrary code, only make sure that you use the same code in both the Arduino sketch and the boblight.conf file. This means that this number does not depend neither on the type of the strip in use nor the number of LEDs, and must not be recalculated using any scripts in processing.

NEO_GRB, NEO_RGB, NEO_KHZ800, NEO_KHZ400: Depending on the chip of LED strip, read the comments in the Arduino sketch to know which one to use.


PC Side

So far you should not have had problems, but from this point on, due to different versions of boblight around, could begin the real headache.
Boblight is only available for Linux systems and you will need a version compiled to run on windows. Also numerous versions are incomplete, bugged and not working.
The version linked below is fully functional and modified by me to avoid some known issues.

Boblightd (daemon) + Boblight (XBMC client)
BOBLIGHTD

Extract the .rar archive to C:\
You will need your own boblight.conf file following your LEDs configuration.
In C:\boblightd\ you can find my version of the file, feel free to modify that file or just create a new one with this online tool.

First part of the config file is:

#[global]
interface 127.0.0.1
port 19333

[device]
name ambilight
type momo
output /dev/com3
channels 360
interval 5000
prefix 41 64 61 00 31 64
rate 460800
debug on
delayafteropen 1000000

Notes:
NAME: whichever you want.

TYPE: momo is right for WS2812B chipset.

OUTPUT: /dev/comx where x is the number of the port where Arduino is connected, look at control panel / devices management / ports (COM and LPT) to find out which one.

CHANNELS: number of total R+G+B channels, 3 * # LEDs. Es: with 120 LEDs, it is 360.

INTERVAL: capture refresh rate, 20000 is for one image captured every 50ms which is right for video application.

PREFIX: some arbitrary HEX numbers to make Arduino be able to find the start of each frame, It can be wichever combination you want, just change them in the Arduino sketch too accordingly.

RATE: baud rate, speed of serial communication. It must be the same specified in boblight.conf

DEBUG: on / off to activate verbose mode in cmd shell.

DELAYAFTEROPEN: Some delay after port opening.

Second part of the config file is pasted from the online tool:

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

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

[color]
name blue
rgb 0000FF
gamma 0.95
adjust 0.8
blacklevel 0.0

[light]
name 001
color red ambilight 1
color green ambilight 2
color blue ambilight 3
hscan 0 10
vscan 0 20

[light]
name 002
color red ambilight 4
color green ambilight 5
color blue ambilight 6
hscan 0 10
vscan 4 20

etc…

BOBLIGHT

This is the client node for xbmc. Install this add-on from xbmc official repository called service “XBMC boblight”.
Ok, now we are ready to start the daemon with start.bat. You should see something like this:

boblightd

Followed by this:

boblightd2

Known issues:

If you get any “Not a Valid Win32 Application” error message => It’s a bugged version => Download this one.

If you get “boblightd outputs ERROR:abmiligt: dev/com3: tcgetattr() invalid argument” and then: “ambilight dev/com3 had a non fatal error, it might still work” => This is due to how windows manage the COM ports, preventing ambilightd to successfully open the port in some situations, including new boot or reboot. I manage this by simply write a character to the serial port with the echo command, this seems to awake the port and make the deamon start as normal => Again download my modded version of the daemon to get rid of this issue.

Minimize the dos shell and run XBMC which It should says “connected to boblightd” at startup.
Play a movie and enjoy the show! Here is my results, sorry for the flickering but it’s a plasma TV.

IMG_1031

IMG_1035IMG_1033IMG_1034
IMG_1037IMG_1019
IMG_1022IMG_1024IMG_1028IMG_1027

Now, as promised, should be passed at the most 40 minutes and I’m sure I was able to solve at least one problem whose solution you’ll be panting to find on various forums.

If so leave a comment about your experience and maybe with a picture of your Ambilight system.

Have fun with your new multimedia system and goodbye to the next!