Archive | Microcontrollers RSS for this section

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:


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


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)

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:

port 19333

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

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:

name red
rgb FF0000
gamma 0.91
adjust 1.0
blacklevel 0.0

name green
rgb 00FF00
gamma 0.86
adjust 0.96
blacklevel 0.0

name blue
rgb 0000FF
gamma 0.95
adjust 0.8
blacklevel 0.0

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

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



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:


Followed by this:


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.



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!

Electric door locking system with touchscreen

Hi, today i want to show you my last summer project…yeah i said summer, cause when the sun burns everything out there on 15th august, what’s better than an arduino mega with 3.2″ TFT touchscreen module to play with? Yes, i’m absolutely fool, but if you want to mess with this, here is my code to start!

For now it supports navigation between menus and the ability to change password, in a photo you can see a flowchart of a menu navigation and change password routine.

In the .rar you can find a link to the exact model of arduino i used, some manuals and useful LCD and SD libs and two different version of code:

  • securecode: Bitmap version, it needs a copy of the content of “raw” directory on 2Gb SD card formatted in FAT32. The coolest but little slower.
    I have hand-drawn bitmap icons inspired from iOS 6 color theme 🙂 then converted in raw format.

    Check supplier site for SD compatibility list, i used one from an old satNav.

  • securecode old style: Line graphics without SD support, faster and lightweight. Don’t need an SD card with bitmaps to be inserted.

Just out of the box the right passcode is “11111111” and type “00000000” to enter setup, enjoy!

I’m looking to add voice control capabilities in the future…

Feel free to hack my code and extend cool functionality, i’m waiting for your pimped versions or comments with new ideas!


2013-12-30 19.54.34 2013-12-30 19.55.13


%d bloggers like this: