Introduction: Ambilight System for Every Input Connected to Your TV. WS2812B Arduino UNO Raspberry Pi

I have always wanted to add ambilight to my TV. It looks so cool! I finally did and I was not disappointed!

I have seen many videos and many tutorials on creating an Ambilight system for your TV but I have never found a full tutorial for my exact needs.

It is whether the system is only made for 1 single source (PS4 or Xbox or TV etc..) or it is not using the same LED's as I wanted to use, so I decided to create an instructable and put together all the information and experience I gathered in one spot while making this project.

The system I have made can be connected to up to 5 different sources. I have it setup here to run with my PS4 system or my home theater/blu-ray player or my Foxtel (Australian cable tv box) or my computer and have a spare input left for something else. All of these simply with the press of a button.

I have added a LCD screen to display the current source being connected to the ambilight and an ON/OFF button for the system.

If you are looking to have ambilight available for every different inputs connected to your TV, want to use the WS2812 type led strips, then look no further, this tutorial is for you.

I have entered this instructable into the Raspberry PI 2016 contest so if you like it please drop me a quick vote! Much appreciated in advance.

Step 1: Material Needed to Build This System

Not all of the sources have an HDMI output, like my computer is still connected through the old VGA connector and my Foxtel unit is still connected via AV cables. I had to purchase quite a few different adapters to get it all working, but in the end the result is awesome and well worth it!!

Not everything here will be needed depending on your own system and if you would like a LCD or not. I will separate the optional items.


  1. 1x 4meter strip of WS2812B 60leds/m. (this was enough for my 55inch tv) I have bought mine from Aliexpress. LED strip
  2. 1xArduino UNO board.
  3. 1x Raspberry Pi model B+.
  4. 1x SD card. (8Gb is good)
  5. 1x Video grabber type STK1160. (be carefull when chosing the grabber, some models will not work!!) This is the one I got and it works correctly. Video grabber
  6. 1x 5V 10amps power supply. I got mine from Aliexpress again and it works fine. Power supply
  7. 1x HDMI splitter 1 x 2. splitter
  8. 1x HDMI switcher 5 in 1. switcher
  9. 1x HDMI to AV converter. converter


cables and hardware:

  1. 4x 25cm HDMI cable. cable
  2. 2x HDMI female to female enclosure connectors. connector
  3. 1x 220V input connector (fused).
  4. 1x project enclosure (can be different, it is up to you, mine is 424mm x 203mm x 86mm) box
  5. Single core wire to connect the 5V to the different converters etc.
  6. Ribbon cablesor extensions to wire inputs to the Arduino exemple


optional extras:

  1. 1x AV to HDMI converter. converter
  2. 1x VGA to HDMI converter. converter
  3. 2x 25cm HDMI cable. cable
  4. 1x LCD display 16characters x 2lines. LCD
  5. 1x I2C interface for the LCD. interface
  6. 1x cooling fan for the case.

Step 2: What Computer Programs Will Be Required

There will be a few different programs required for this project.

You need to download and install them (if you don't already have it)

  • WinSCP can be downloaded here
  • Putty can be downloaded here (click on the putty.exe link in the list)
  • SDFormatter can be downloaded here
  • Win32DiskImager can be downloaded here
  • Arduino IDE can be downloaded here (I used version 1.6.5 at the time)
  • HyperCon can be downloaded here (click on the clone or download link)
  • Notepad++ (optional) can be downloaded here

You will need to download the Raspberry Pi disk image too. Chose the file named "OpenELEC 5.0 with STK1160/UTV007 compatible kernel RPI 1"that you can download from the bottom of the page here

Step 3: Getting the Raspberry Pi Up and Running

We are going to start by getting the Raspberry Pi up and running.

1) We are going to write openELEC to the SD card.

  1. Unzip the Raspberry Pi disk image.
  2. Plug the SD card into your computer.
  3. Run the SDFormatter program.
  4. Select the SD card drive letter.
  5. Click on option and select "size adjustment" to ON.
  6. Click OK.
  7. Click Format.
  8. Run the Win32DiskImager program.
  9. Select the Raspberry Pi image and the drive letter of your SD card.
  10. Select Write.

2) Eject the SD card from your computer and plug it in your Raspberry Pi.

Connections to be made on the Pi:

  • Connect an Ethernet cable to your Pi from your network.
  • Connect the HDMI port of your Pi to your TV or screen.
  • Plug in a keyboard and a mouse on the USB ports. (I use a wireless mouse and keyboard combo and I have left the dongle connected to the Pi, this way, now that the Pi is boxed up, I don't have to open it all up if I want to access my Pi.)
  • Plug in the usb end of the video grabber to your Pi.

3) Connect a 5V power supply to your Pi and follow the onscreen information until it boots up. You should be presented with a screen as per my photo.

We now need to check your internet connection. Follow the path SYSTEM - openELEC - system info and write down your IP address, it will be needed in the future.

While in the menu, follow the path SYSTEM - openELEC - services and scroll down until you find the tab called SSH. Put a tick into the Enable SSH.

Now we are going to install Hyperion and check our video grabber connection to the Pi.

For this we are going to use Putty. Your Pi has to be powered ON and connected to your network for this to work.

  • Type in the IP address you wrote down just before for your Pi. as per picture attached and click Open.
  • You should then be prompted with a window asking you for a username as per picture attached. type in root and press enter.
  • you will then be asked for a password. (note that the characters wont appear while typing the password, this is normal). Type in openelec and press enter.
  • To check all the usb ports, type in lsusb and press enter. You should find your video grabber in the list as per the picture attached.

While Putty is open, we are going to install Hyperion, this is the software running on the Raspberry Pi that is going to take care of transforming our video signal into the correct sequence to be sent to our led strip.

  • copy the following link and use the right click of your computer mouse onto the putty window to paste the link and start the process. curl -L --output install_hyperion.sh --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/bin/install_hyperion.sh sh ./install_hyperion.sh

This complete the Raspberry PI setup. We will get back to it later on to upload our LED's configuration file.

Step 4: Hyperion and the Configuration File

!!!UPDATE!!! If your version of HyperCon contains 5 tabs, please refer to step 13 for programmation.

  • Start by opening the program HyperCon.jar.

You can simply copy the first 4 lines in the Hardware tab.

  • The direction is which direction the strip is running when you are looking at it from the screen side of your TV.
  • If like me, you have put LED's in the top and bottom corners, you have to select true for the next 2 lines.

If you select true to both of them, you have to take 1 away from your total number of LED's on the vertical axis.

(i have 47 LED's on each side vertically, with 2x true = 45 LED's for the count)

  • You can then fill up the next 3 rows according to your setup and paying attention to the comment above.
  • The bottom gap is simply the results of "horizontal number of LED" - how may LED's you have at the bottom of your TV. In my case 78 at the top, 30 each side at the bottom = 18 gap
  • Increase or decrease the offset number until the LED 0 on the right part of the screen matches the start LED of your own setup.
  • You can as well copy all the fields under Image Process according to my picture, it works well and can always be modified later if needed.
  • Once you are done, the number of LED's indicated on the right of the screen should be the same as the number of LED's physically stuck to your TV.

Now moving to the Process tab.

  • Make sure the frame grabber is ticked. set the height and width to a value of 3x your actual number of LED's. It works well. Again, this can be later modified if needed but is a good start. Copy the 25Hz as well
  • Enable the smoothing and copy the values from my setup.
  • Copy as well the Color values I have on my picture, they are a good starting point and work quite well.

To finish, move onto the External tab.

  • Everything in this tab can stay untouched except the highlighted field that you need to copy according to mine.

You can nowclick on the "create hyperion configuration" button and save the file somewhere easy.


I use Notepad++ to open the configuration file as this program works well for me.

We are now going to open the configuration file and add a few lines in it for hyperion to work with our frame grabber.

You can refer to the picture above for visual help.

  • Scroll all the way down the file.
  • Delete the last 2 lines as per the highlighted part on the picture.
  • Now copy the following lines from here under and paste them in your file at the end

/// Configuration for the embedded V4L2 grabber
/// * device : V4L2 Device to use [default="/dev/video0"]

/// * input : V4L2 input to use [default=0]

/// * standard : Video standard (no-change/PAL/NTSC) [default="no-change"]

/// * width : V4L2 width to set [default=-1]

/// * height : V4L2 height to set [default=-1]

/// * frameDecimation : Frame decimation factor [default=2]

/// * sizeDecimation : Size decimation factor [default=8]

/// * priority : Hyperion priority channel [default=800]

/// * mode : 3D mode to use 2D/3DSBS/3DTAB (note: no autodetection) [default="2D"]

/// * cropLeft : Cropping from the left [default=0]

/// * cropRight : Cropping from the right [default=0]

/// * cropTop : Cropping from the top [default=0]

/// * cropBottom : Cropping from the bottom [default=0]

/// * redSignalThreshold : Signal threshold for the red channel between 0.0 and 1.0 [default=0.0]

/// * greenSignalThreshold : Signal threshold for the green channel between 0.0 and 1.0 [default=0.0]

/// * blueSignalThreshold : Signal threshold for the blue channel between 0.0 and 1.0 [default=0.0]

"grabber-v4l2" :

{

"device" : "/dev/video0",

"input" : 0,

"standard" : "no-change",

"width" : 1,

"height" : 1,

"frameDecimation" : 2,

"sizeDecimation" : 4,

"priority" : 1100,

"mode" : "2D",

"cropLeft" : 0,

"cropRight" : 3,

"cropTop" : 6,

"cropBottom" : 17,

"redSignalThreshold" : 0.0,

"greenSignalThreshold" : 0.0,

"blueSignalThreshold" : 0.0

},

"endOfJson" : "endOfJson"

}


One word now on this video grabber's setup we have just added to our configuration file. This step will need to be done when everything is working and finished.

The 4 lines: Crop Left , Crop Right, Crop Top, Crop Bottom. These values need to be changed according to your setup. Start with all these four numbers with a value of 0 and load the config file back into your Pi. Reboot your system and watch some TV. If on the left side of your TV the LED's are not lit up you need to increase the value under "Crop Left" and try again until the LED's light up.

You can then repeat the process with the 3 other sides.

Success!!! I know it is a bit time consuming but it insures you are not cropping too much of the image off on one side or the other but just what is necessary.

Step 5: Getting the LED's on the Back of the TV

This step speaks for itself, it is time to put the LED strip at the back of the TV.

I personally just used the double sided tape of the LED strip and glued the strip on the edge of my TV. Some people prefer and build a frame for the LED's. This is all up to you and your TV as they will most likely always be different.

My setup has 78 LED's at the top, 47 on either sides and 30 on either sides at the bottom of the TV for a total of 232 LED's.

When I face my TV, the LED strip is running clockwise, this is looking at where the signal is getting to the first LED and travelling through until it reaches the last one.

Remember that there will potentially be a fair bit of current running through the strip, depending on its size, this is why I ran the power on both ends of the strip. The connecting wires on the edges of the TV will have to be big enough as well to pass this current through.

I used the connectors supplied with the LED strip. One connector (where the strip begins) has 3 wires, +5V and GND and as well the Data IN. The other side of the strip only has 2 wires. +5V and GND.

Step 6: Uploading the Hyperion Config to the Raspberry Pi

For this step, your Raspberry Pi needs to be powered ON and connected to your network. We will use WinSCP to load up the file into the Pi.

  • Start by opening the program and entering the IP address under Host name, user name root and password openelec into the field as per the picture attached. Click login.
  • You should then see a window with a few lines as per the second picture while it is logging in.
  • You will then be presented with a window as per the picture above. The left side is your personal computer and the right side is the Raspberry Pi.
  • On the left side, navigate through until you have the configuration file located.
  • On the right side, double click on the return arrow couple of time until you are in the root menu ( only a / in the address bar above) the double click onto storage to get into this menu.
  • Select the config file on the left and click F5 or click onto the Upload button above it.
  • You will then have an upload window as per the picture. You need to copy the path storage/.config/ and the press ok.

Your hyperion config file is now loaded into your Pi. You can reboot it and it will now use this new config file when it restarts.

Step 7: How It All Works

You can refer to the organization chart I have drawn, a picture is worth a thousand words.

Brief explanation:

The HDMI switcher will pass through to its output 1 out of the 5 input signal it receives, as selected by you. (Playstation, Xbox, tv, etc...)

This signal is then fed into the splitter, which will duplicate the signal.

The first output of the splitter is going straight to your TV, to display the image as per usual.

The second output of the splitter is fed into the HDMI to AV converter.

The signal is converted and passed through to the video grabber. (via the yellow connector. Red and white are not needed, they carry the sound).

The raspberry Pi will in turn take the data from the video grabber, process it and send through to the Arduino the color that each LED will have to take.

The Arduino will then output the data to the LED's.

The Arduino is as well monitoring the HDMI switcher and according to the channel selected on the switcher, it will update the LCD screen to display the correct source. It monitors the ON/OFF button too which allows the led strip to be turned OFF if not needed.

Step 8: Boxing Up the Project and Connecting the Different Parts.

The boxing up of your project will be up to you. I have tried to put as many comments as possible on the pictures to give you and idea of how my setup is put together.

One very important thing is to make sure the video grabber input to the Pi is not connected with anything else, I had frame size errors and a lot of other weird things happening when I had anything else connected to the other USB port. It must reach a bandwidth limit or something but it would not work when I tried plugging in a WiFi dongle in this USB or even the output cable going to the Arduino.


I recommend placing all the converters etc and starting by bringing power to all of them first. Most of these converters came with a wall plug power pack. I cut off the cable and only used the connector on the converter's side and decided to build a little board with a lot of +5V and GND connections to power them all from. It saved a lot of room.

I stuck the different converters down with 2 component glue and used plastic stand offs to bolt the Arduino down. I added some glue to the back of the IEC connector as well for a bit of added rigidity. My IEC connector has an inbuilt ON/OFF switch that I can use to power off the whole unit. It has as well a fuse draw where I have put a 1.6A /250V fuse for protection if anything had to go bad with my cheap power supply.

I used my dremel tool and some files to make the openings into the enclosure and make it look nice. I have as well carved an opening for the IR sensor at the front of the enclosure above the LCD.

I have not drawn a proper schematic drawing for the wiring to the Arduino, let me know if someone would prefer to have one instead of using the picture one I have made up.

Don't hesitate to comment if needed and I will happily answer questions and update this instructable to make it more complete or easy to understand.

Step 9: Hacking Into the HDMI Switcher (optional)

For our Arduino to tell which source the HDMI switcher is actually displaying, we need a way to send this information from the switcher to the Arduino. Luckily, the switcher the switcher has 5 LED's to display source 1 through to 5 when selected and we are going to use these signals for the Arduino.

I have taken a signal from the 5 LED's but later when I wrote the Arduino code, I realized that I did not need a signal from the LED number 1, if you look closely at the ribbon cable connection to the Arduino, you can see that the brown wire on the right hand side is actually not connected. We only have LED2 connected to A0, LED3 to A1, LED4 to A2 and LED5 to A3.

I connected them to the Analog inputs for no other reasons that convenience of the wiring into my project box.

If you decide to build this project and do not want to have an LCD display on the front panel, this step is not needed and can be skipped. It will be hard to know which source is selected on the HDMI switcher if the LED's on it are out of view like in my project design where the switcher is housed inside the enclosure.

Step 10: The Arduino and Arduino Code

For the Arduino sketch to compile properly you will need 2 libraries:

Adafruit_NeoPixel.h that you can download here

LiquidCrystal_I2C.h that you can download here (version 2.0)

I have tried to add as many comments as possible through the code. If anything is unclear, don't hesitate to post a comment and ask questions. They can help a lot of people.

Having a look through the code that I have attached to this step.

Here you can select a start color for the LED strip to light up at startup

#define STARTCOLOR 0xff8000

Datapin is the pin selected where the Din of our LED strip will be connected

#define DATAPIN 5

Led count is the actual number of LED's in your system

#define LEDCOUNT 232

The baudrate must not be changed, or it will need to be changed in the Hyperion config file too

#define BAUDRATE 500000

This is the brightness level you want your LED strip to operate at. Testing required in your environment. 0 to 100 selection

#define BRIGHTNESS 90


This line below is probably the hardest thing to understand and has to be modified to work in your setup.

const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x??, 0x??};


Start by taking the first 4 bytes, it never changes. So you can already write const char prefix[] = {0x41, 0x64, 0x61, 0x00, and it will be correct.

This is not that bad in the end. For the 5th byte. In my system I have 232LED's. The 5th byte calculation is to substract 1 from my LED number and transform the result in HEXADECIMAL value. 232 - 1 = 231. 231 in HEX = E7

Now we have to deal with our 6th byte. It is an "exclusive OR" function or XOR function between to numbers. The first number will be 55 and this never changes. The 2nd number is your calculated 5th byte. In my case it is E7.

Use the following 5th and 6th bytes in the line of code, replacing the ?? and you are done.

At the end of the code, in the check_source() routine, this is where you can change for each source the information that is going to be displayed on the LCD when the source is selected like TV or PS4 or computer etc etc...

You can set the LCD cursor as well to have the printed name printed in the center of the LCD.

Once you are happy with your code you can upload it to your Arduino and check that it works correctly with at least the LCD for now.

Note that it will take a good 20 seconds to start as I added long delays at the beginning of the code to avoid having strange reboots of the Arduino while the Raspberry Pi was booting up. So don't be afraid if nothing shows up on the screen straight away. One way to tell the code is running is the LED of the ON/OFF button should light up at startup.

Step 11: Bringing It All Together and Testing

Raspberry Pi and Arduino can now be linked with the USB cable.

LED strip has been connected to the enclosure and to the Arduino.

Arduino and Raspberry are programmed.

5V supply from the power supply is going to all the different converters Arduino and Raspberry.

When power is applied to the project box, the HDMI switcher LED source is light up, Source channel can be change by the mean of the remote control or button on the switcher.

Select the source on your TV where you connected the main cable from the project box output and see if you are getting an image on the screen from whatever source you have selected on your switcher.

After a few seconds, the LED strip should progressively light up and the switch off. This mean the Arduino has started and the connection with the LED strip is good.

Soon after, the LED strip should start displaying colors as per the information passed on by the Raspberry.

Succes!! You have now finished your project and can start enjoying some entertaining TV light show!

Step 12: Control Your LED Strip From Your Phone

To add a bit of fun to this, you can download an App on Iphone, I am sure it must be available for other devices as well.

Very easy to use, just make sure your Pi and LED strip are ON and press the Detect button on the top left. It should detect the Server, that you can name as you wish to.

Select it and you are all set, you can pick colors from the color wheel and your strip will light up accordingly or chose from different effects to be displayed.

Step 13: Update for the New HyperCon Program

As some of you have stated in the comment section, Hyperion have come out with a new version of HyperCon which contains more settings to create your hyperion config file.

If you are using this new program you will need to skip Step 4 and do this one instead.

Start by opening the program HyperCon.jar.

I have added as much info as possible on the pictures, you can refer to them to help you through the setup.

Under construction, if you select LEDs in the corners of your TV, like me, you will have to substract 2 to your actual numbers of LEDs on the Left and 2 on the right side of your TV.

On my TV, I have 47 LEDs on each sides but I had to write 45 in the boxes to account for the corner LEDs added.

As a control, on the bottom right corner of the HyperCon window, the numbers of LEDs shown should match up to your physical number on your TV.

At the bottom of the HyperCon page, you have a help/wiki button. It will bring you to a nice page with all relevant infos and explanations on the different possible settings if needed.

Once your configuration is complete, you can click the "Create Hyperion Configuration" button and save the file somewhere handy.

Comments

author
RamiG5 (author)2017-08-12

how to connect the led strip to Arduino ?

Where is this guide, I do not see :-(

author
JN188 made it! (author)2017-02-04

Hi,

i have a little problem with the HyperCon. Please guide.

Snap is attached. Thanks :-)

Capture.PNG
author
RamiG5 (author)JN1882017-08-12

same problem for me :-(

There is another way to do it ??

author
RamiG5 (author)RamiG52017-08-12

it's work with this:

curl-L--output install_hyperion.sh--gethttps://raw.githubusercontent.com/tvdzwan/hyperion/master/bin/install_hyperion.sh

sh./install_hyperion.sh

author
RedGriffin (author)2017-08-06

Hi. I've been looking at getting the parts together to do this but my sources would primarily be 4K (some HDR, too). I'm assuming all I would need to do it split the signal from my AV receiver and downscale to 1080p the side that is passed to the HDMI2AV. Is that correct?

Also, if I were to use 144 LED/m strips it would just be a case of a large PSU and correct config?

author
DenisK62 (author)2017-06-12

Ok there is another problem. When i connect hdmi splitter, tv resolution goes down from 1080p to 576p and there is no option to change this. Ambilight is very nice but this resolution problem makes it totally useless. Does anyone has this problem, is there any fix available?

author
DenisK62 (author)DenisK622017-07-20

If someone has this exact problem...the solution is a better hdmi2av converter. I have bought Speaka Hdmi2Av converter (bought in Conrad online shop, 61,99€) and now i have a full 1080p picture on my tv.

author
AxelP6 (author)2017-07-13

What a wonderful instructable ! thanks a lot !

The parts are now all here, i'll start to made it this week-end.

I read about issues in the comments, all should know that Chinese power supply have a very poor quality. To solve it, a little PCB on the 5v with 2200µF electrolytic capacitor and ceramic 100nF capacitor to clear the noise and to have a very good 5v stability.

I'll post pictures when finished ;-)

author
DenisK62 (author)2017-06-08

Hey guys, can anyone please help me with installation? Here is the situation: I connected ws2812b led strip with arduino uno, arduino uno with raspberry pi b+ via usb, video grabber(UTV007) to raspberry and on video grabber hdmi2av adapter. I made config files by the instructions and when i turn everything on, leds only turns on for about 10sec (orange colour) and then they turn off...what could be wrong? I have tried several openelecs, different arduino sketches and nothing worked. It seems like arduino is getting some information from raspberry, because when I connect video grabber to rspb, on arduino red light starts flashing as it would be processing something. Any suggestions?

author
bhsRaman321 (author)DenisK622017-06-09

Hey, I'm getting this same problem too! :(

author
DenisK62 (author)bhsRaman3212017-06-11

Hey, did you manage to get ambilight to work? I have installed different sketch on arduino form this site :

https://hyperion-project.org/threads/diy-amblight-...

and it works now. Than you need to increase some values for the led strip to work flawlessly and I had to change led type from RGB to GRB in hyperion file. Give it a try and let me know. I hope it Works:)

author
Adrienn2 made it! (author)2017-04-21

After several unsuccessful attempts, everything works perfectly. I used a pi zero W and Librelec for the wifi to work. I would post photos and my configuration files as soon as I would have made a box.

temp_286761732.jpg
author
NikhilS89 (author)2017-03-10

I'm near the end of this project, but having issues with the external grabber. I'm still trying to get my hands on a UTV007, but in the meantime have found a STK113. When using this one, HyperCon locks up everytime I try to "Take Grabber Screenshot".

What could he going on here? Is it the chipset that's causing the issue? My grabber is currently the only thing connected to an active USB hub, so it's definitely not a power issue.

author
BobbyN13 (author)2017-03-02

Does your version support 24p from an HDMI source eg a bluray player? Most of the others don't which unfortunately make them useless for me.

author
acolombo25 (author)2017-02-19

I would like to replicate this project, using a raspberry pi 3 shouldn't it be easier due to the HDMI port? What other hardware should be needed other than that, the Arduino and the led strip?

author
NicaG2 made it! (author)2016-08-10

Thanks for this wonderful tutorial!

Now i need to make a box to put everything in it.

Used openelec 7 beta 3.

I had problems with hdmi grabber not working, check step 13 hypercon, tab "grabber" , i need to have a lower number on priority channel for grabberv4l2 than the number in the priority channel for "internal grabber".

IMG_0185.JPG
author
jack.palance.182 (author)NicaG22017-02-08

Hi NicaG2,

How did you power your led strip ?

author
NicaG2 (author)jack.palance.1822017-02-08

i've used a power supply : https://www.aliexpress.com/item/DC5V-10A-50W-LED-a... , and i hooked up everything to it ( including raspberry/arduino/splitter/av converter)

You still get the blue light from Kodi ( installed on your raspberry... go to hypercon and "I THINK you need to disable "enable internal grabber" " so that when you power off your hdmi output the rasberry will not switch to Kodi ( witch has a blue theme)

author
jack.palance.182 made it! (author)2017-02-06

I had problems with a bad grabber I bought from Eb@y... My new one is ok now : https://www.amazon.fr/gp/product/B0013BXFLG

Configuration of the Hyperion was not so easy, don't forget to delete first your old file, transfer the new one, and reboot the PI...

My configuration : FREEBOX (the only source I have) --> HDMI splitter (one goes to the TV and the other one to the HDMI to AV) --> HDMI to AV --> PI3 --> Arduino UNO --> led strip

I didn't buy any power supply like the 5V10Amp pfoglietta recommends . The HDMI splitter and the HDMI to AV are powered with a powered usb switch. My arduino UNO and the LED Strip have no power supply, everything goes throught the USB from the PI3.

Everything works great BUT :

- when I shut off my FREEBOX, all the leds remain blue...

- Hyperion process sometimes crashes with a buffer overflow. I think I will have to power the Strip LED but I don't want to by a 5V10A power supply. Can I power the Stip another way ?

ambi.png
author
Sancho1985 (author)2017-01-19

Great work, thanks! I have some questions. I am watching TV only from my TV box - iconbit xds73d mk2. My tv box has component video out and if I'm right, then I do not need to use an HDMI converter??

In my mind: iconbit xds73d mk -> Easy Cap -> Raspberry Pi -> Arduino -> LED Strips. All of it connect to 5v20a power supply.

author
i-blaze (author)2017-01-16

Hey guys i wanting to make this for my PC dual monitor setup.

just wanted to know that do i need exactly this same components since it will be connected to my PC not TV?

i mean do i will the ARDUINO UNO only will do and or will need the

RASPBERRY PI and the video grabber and the spliters?

Do i need all of this items since i am going to use for my PC monitor setup?

HELP NEEDED first time going to use ARDUINO & RASPBERRY

author
gjansen (author)2017-01-13

Hello Pfoglietta, i cannot get the hypercon-install to my raspberry. The link doesn't work, can you help me?

author
Dieghigno (author)2017-01-13

Hello, in my Philips SmartTV I still have a SCART connection, can I connect it directly to the video grabber to have the video signal? So I can skyp all the HDMI switchin/splitting/converting part and still have ambilight for all sources.

author
Jimsicle (author)2017-01-10

I tried to make the PCB that powers all the devices at once but sometimes it keeps flickering off. Can I ask you for the circuit diagram just in case I got it wrong? Many thanks.

author
Screwdriver76 (author)2016-07-10

Hello,

I mounted my Ambilight following this excellent tutorial, but the result is a little bit poor: Often the System choose the wrong colors and it already reacts too slow.

My setup is:

Raspberry Pi 2

OpenElec with Kodi 6.0

Hyperion

Arduino Uno

188 WS 2812b Leds

Has anybody an idea what could be an option to make the system running as planned?

Another point: How can I shorten up the Arduino sketch, because I only want to use 1 Input, so the part for monitoring the input device and singalize it on LCD is already unnecessary for me.

Thanks a lot

Screwdriver

author
pfoglietta made it! (author)Screwdriver762016-07-12

Hello,

Starting by the arduino code, this will not really make the system any faster as it is designed to update the LCD only when it is not receiving active data from the Pi. The LED data received has priority over updating the LCD.

If you want to get rid of it your can remove the lines as per the attached photo.

Have you tried getting a screenshot of your system to see what the grabbed image looks like? I had a problem where sometimes my grabber would get images that are complete garbage with completely wrong colors. This could explain the problem. Slow reaction might be due to too many "frame too small" received by the grabber. As per JwJolly88 's picture below.

Let us know.

arduino.PNG
author
JwJolly88 made it! (author)pfoglietta2016-07-13

so, got the new power supply in (much less noise), and fired it up today. when looking for the file I found one by the name, though it doesn't have the .sh file extension.

v4l2.shimage.jpg
author
PeterM391 (author)JwJolly882016-12-29

I wouldn't think that would matter...... the sh extension just means it's a shell script....looking at the permissions.....it has "x" for execute....so it should work.

author
pfoglietta (author)JwJolly882016-07-13

It should have one with .sh as well. For some reason i can't upload .sh files on here. Can you send me your email address and i will send you a copy of my file.

author
JwJolly88 (author)pfoglietta2016-07-14

Sure, email sent to you in private message

author
pfoglietta (author)JwJolly882016-07-15

File sent to your email. Let us know how it goes.

author
JwJolly88 (author)pfoglietta2016-07-24

any ideas?

author
JwJolly88 (author)pfoglietta2016-07-18

Ok..so got the .sh file copied over and when trying to take screencap through hypercon, this is the output log

ssh out: /storage/hyperion/bin/hyperion-remote.sh -c e5fffa
ssh in: Connected to localhost:19444
ssh in: Set color to 229 255 250
ssh out: /storage/hyperion/bin/hyperion-remote.sh -c ff699d
ssh in: Connected to localhost:19444
ssh in: Set color to 255 105 157
ssh out: /storage/hyperion/bin/hyperion-remote.sh -c ff669a
ssh in: Connected to localhost:19444
ssh in: Set color to 255 102 154
ssh out: killall hyperiond 2>/dev/null ; /storage/hyperion/bin/hyperion-v4l2.sh --device /dev/video0 --video-standard PAL --input 0 --width 240 --height 192 --crop-left 0 --crop-right 0 --crop-top 0 --crop-bottom 0 --size-decimator 1 --frame-decimator 2 --red-threshold 0.0 --green-threshold 0.0 --blue-threshold 0.0 --screenshot
ssh out: sh: /storage/hyperion/bin/hyperion-v4l2.sh: Permission denied
sftp getFile(./screenshot.png, java.awt.Image)
ssh out: /storage/hyperion/bin/hyperion-remote.sh -c ff6ea2
ssh in: Connected to localhost:19444
ssh in: Set color to 255 110 162
ssh out: /storage/hyperion/bin/hyperion-remote.sh -c bcecff
ssh in: Connected to localhost:19444
ssh in: Set color to 188 236 255
ssh out: /storage/hyperion/bin/hyperion-remote.sh -c 39ff4e
ssh in: Connected to localhost:19444
ssh in: Set color to 57 255 78

As you see I did a manual change to LED color through hypercon, which worked just fine. For some reason, it is not allowing access to the .sh file from what I can see.

author
fastm3driver (author)2016-12-29

Cool project. I've been looking to do something like this but I want it to work on a retractable projection screen. Maybe with side firing leds that drop down with the screen? Not sure.

My idea that I'd like people to chime in on though is this: Take a pi with a camera attached and a small touch screen or app to set up with. Mount it anywhere that can see the screen. Send the data wired or wirelessly to a light controller. It could set itself up be looking at the lights with the camera. You just need the screen to position the viewable image, although I can see that being automated as well. The benefit would be it's easy to set up, can be easily moved, and is not dependent on the source at all. The negative would be mounting the little pi/camera box somewhere.

author
Cramery (author)2016-12-20

I really need help...

I want to use Arduino Uno, LED Stripes with WS2812B and Ambibox to make the ambilight. I tried like 10 tutorials and always get problems with uploading the program to my arduino. There's no error in the program but nothing happens on the LED-Strip, beside the running project stops working. But every tutorial seem to work for everyone just me.

It can't be a problem with wiring bc other programs are working.

Did anyone also had this problem or knows where the problem could be?

author
billybouy1 (author)Cramery2016-12-29

you have to make sure your XOR values are correct also the type has to be adalight and your output must be dev/ttyAMCO. I had the same problem till I changed it. hope this helps.

author
dzebrys (author)2016-12-29

why is arduino necessary for this? can not we use raspi gpio instead to control led strip?

author
icu___ (author)2016-12-13

​Great write-up, thanks!

So I decided to take it slow and first of all build a very basic setup which I would expand afterwards. I currently have just the Raspberry, the Arduino and the WS2812B LEDs connected and the Ambilight works perfectly for any media played on Kodi.

However the LEDs lag behind. There is about 0,5s delay. i.e. the LEDs change about 0,5s after the picture changes.. Any way to fix this? There seems to be a parameter which can delay the LEDs in case they are faster than the picture but in my case it is the other way around. Any ideas?

author
ndopwell1 made it! (author)2016-12-01

Awesome< build, I used osmc and you tube info to make but all inspired by this great project. Few problems with dev/tty (mine was ACMO) Hyperion doesn't load your saved config. file and the arduino sketch throws up a warning when you change char prefix but all good now. Thanks again

temp_-1966464086.jpg
author
DarkCyren made it! (author)2016-11-24

Thanks for the great instruction. I recommend the Fushicai usbtv007 video grabber instead of the Syntek STK1160 grabber. No frame to small errors.

rgb.jpg
author
bumhee34 (author)2016-10-28

Hi pfoglietta.

This is a nice instructable.

I have a question. I made ambilight using teensy board, and I am curious whether Teensy/Rashpberry Pi combination will work or not.

I've chosen Teensy due to its high feedback speed between data source and LEDs. (I used Adalight)

I want to keep the feedback speed that I have now, but want to get various inputs like you did. (If your setup has no speed issue, then it would be best!)

Second question is that; will it work well in the case of HDMI 2.0 sources (4k)? Not sure whether the grabber will convert the hdmi source into RGB properly.

I will wait for your reply, thx!

author
TR3N-RUSO (author)2016-10-02

Hello guys! I would like to know if the CROP values are defined in therms of another thing? Because I try like 20 values for 1 CROP and I couldn't make it work and if I have to try I don't know were the limit is! Thank you very much for your time!

author
stevenb185 (author)2016-07-17

Hello
First let me thank you for your big project and the answer of every problem!
I have made this one week ago I think and it is awesome I just use the internal grabber because I don't have all the things to do the entire project
But two days ago I have received the part who's missing
And it is running when I'm on the raspberry but when I change the input of my TV to the chromecast or the ps4 every led is black I suppose it is the grabber but I'm not sure

author
JwJolly88 made it! (author)2016-07-08

First, thank you again for all of your help thus far pfoglietta! So, because my brain just refuses to let me take a break from this until I get it working, I have done a bit more troubleshooting this morning. After changing the resolution down to 320;280 and still having frame size errors, I wanted to look further into the cause. I went ahead and checked my json file, just to be sure I had A. made the correction and B. loaded the correct file. Values match what they should be, however after trying again to run the screenshot command, it returns entirely different values for what the sizes are set to. Is this normal?

jsonerrorprompt.jpgjsontext.jpg
author
JwJolly88 (author)JwJolly882016-07-08

I suppose it is also worth noting, I am powering my Ard. Uno directly through the USB from the RasPi. Could this be causing a power drop on the Pi that would make the vidgrabber lull? If so, how did you power your Arduino? directly to the +5/GND pins from the power supply?

author
pfoglietta (author)JwJolly882016-07-08

Yes it is normal it returns different values as this is a screenshot that doesnt use the actual hyperion config.
Maybe you can try to connect to your Pi using the 5th tab on hyperCon and see how it performs.

Powering the arduino via the usb is a definate no go. Power it via the +5V and GND header pins instead.

Let me know how this works.

author
JwJolly88 (author)pfoglietta2016-07-09

Ok, this morning I went ahead and hard wired my power for the arduino. Sadly no luck though. I am starting to wonder if I have compatability issues. I checked via putty to ensure that my vid grabber was recognized, but from Hyperion if I right click the image the "take screenshot" option is entirely grayed out. Granted, I wouldn't expect it to work since doing it via CLI doesn't work. However, it does seem strange that it doesn't even recognize that a grabber is available, especially since hyperion itself has an internal one.

author
pfoglietta (author)JwJolly882016-07-09

That is strange, have you connected to your Pi before trying to take a screenshot with HyperCon? Maybe you can post up the log file that appears when you connect with HyperCon to see what is happening

author
JwJolly88 (author)pfoglietta2016-07-09

Wel outside of this project I have never touched a pi or Hyperion. As soon as I get home I will post the log file from connecting with pi. Is there a particular CLI prompt that you would like, or just the traffic log from within Hypercon?

author
pfoglietta (author)JwJolly882016-07-09

Get the whole log when you connect to your Pi and the screenshot process