DIY Ambilight With Raspberry Pi and NO Arduino! Works on Any HDMI Source.

6,450

119

11

About: Electrician in training, electronics hobbyist

I have a rather basic understanding of electronics, which is why I’m super proud of my DIY Ambilight setup in a basic wooden enclosure with the ability to turn the lights on and off as and when I please.

For those who don't know what an Ambilight is; its a set of LED strips that are attached to the back of your TV to light up the wall behind it and the LEDs react by changing colour to match what's being shown on the screen.

Philips came up with this a while back but people online have found ways to replicate it.

I discovered this on YouTube and desperately wanted to make one of these as it's just absolutely awesome and adds a lovely vibe to when you're watching movies, playing games or having a light show on your TV at a party.

I’ve mostly cobbled this through various other guides, but I found they lacked an ability to turn the LEDs off if I didn’t feel like having them on and still have full connectivity to the HDMI port on the TV (this will become clearer later on in the ‘ible)

This cost me a pretty penny to build as the project had to go through several revisions and some new stuff had to be bought so bear in mind that you can cut a few corners on this guide on everything with the exception of the components and the wiring.

The custom enclosure is something I chose to make so that my TV rests on top of it and had plenty of room but if you're able to fit everything in another enclosure of your choice or stick all the connectors on the back of the TV as well then so be it!

One thing I can absolutely assure you of is that the amount I learnt throughout this project is absolutely priceless not to mention the absolute satisfaction when you get to tell your mates in a poncy voice "Oh yes, I built that all by myself you know"

Though those same mates are sick to death of hearing me boast about this so your mileage may vary.

Step 1: Parts, Tools, Materials and Software

You will need the following (all of these are pictured just in case)

  • A Raspberry Pi (you can use any R-Pi. Pi 1 Model B+, Pi Zero/Zero W, Pi 2 Model B and of course Pi 3 as well)
  • 5m WS2801 Addressable LED strip (link) - pricier than regular LEDs but these have chips next to each LED that can receive instructions. I used a 5m strip but you can get a longer reel if needbe.
  • 8GB Micro SD card
  • HDMI to AV Converter (link)
  • Active HDMI Splitter (Link)
  • HDMI patch cables
  • 1 x male to male RCA coupler
  • Female jumper wires/ribbon cable (the ones with dupont connectors)
  • Red and black equipment wire (get a 5-10m spool) (22AWG is the common standard with these types of projects, but you can go thicker if needbe)
  • Sacrificial IEC Mains cable (or kettle plug in the UK. These are the regulations I am following)
  • Male DC 2.1mm screw Terminal Connector(s)
  • Large project box: to keep it all together (I built one, but if you can find one that can fit all this in, go for it!)
  • HDMI Panel mount sockets x 2
  • Fused IEC Socket (Again I'm basing this on UK regs so if you're overseas, check the regs in your area)
  • Pack of Female spade crimp connectors (make sure they have 2.8mm, 4.8mm and 6.3mm)
  • Fork crimp connectors
  • Latching power button (I would recommend this 22mm 12v car dashboard switch)
  • Cable ties (to tidy up wiring and to secure 80mm fan to PSU)
  • 5V10A Switching Power Supply (Link) (10A may seem a bit excessive but it will reliably power all the connectors as well as the Pi and the LED strips) Hell you could even use an old ATX power supply as it has more than enough 5V points and can even use the 12v points for PC fans.
  • Heat shrink tubing
  • 4 pole speaker spring terminal socket (you can use other 4 pin sockets and cabling but I found these didn’t have that much of a solid connection due to the pins warping when I soldered the wires onto them)
  • USB Video Grabber (ensure you have one with chipset Fushicai UTV007)
  • 4 core 22 AWG cable (for connecting the LEDs to the box; ensure that this has a black and a red wire in the cable)
  • 2 x 120mm 12v PC fans (I know the PSU is rated for 5V but a 12v fan can still provide airflow and you won’t be able to hear it spinning)
  • 1 x 80mm 12v PC fan (to attach to the power supply, again not needed if you’re using an ATX power supply)
  • 1/2" Plywood cut to the following sizes
    2 x Front and back panels: 33" x 4"
    2 x side panels: 12" x 4"
    1 x bottom panel: 11" x 32"
    1 x top panel: 12" x 33"

Tools

  • Drill
  • 22mm Forstner bit
  • 35mm Forstner bit
  • Hammer & chisel (This is what I used to fit the IEC socket but I’d like to save you a headache and recommend you use a jigsaw instead)
  • Pocket hole jig & Kreg screws (optional, but it does make the box/enclosure construction process infinitely easier)
  • Wood Screws (if not using pocket holes)
  • Handsaw (but if you have a table/mitre saw handy then this will make everything a billion times easier)
  • Coping Saw (again, if you have a jigsaw you won't need this)
  • Soldering iron (or use corner connectors for LED strips if you don’t fancy soldering these.)
  • Solder
  • Crimp tool
  • Wire cutters
  • Screwdriver set
  • Electric screwdriver (this will help with assembling the enclosure)
  • Multimeter (to test solder joints and other things)

Software

Step 2: Attach and Connect LED Strips to TV

Measure and attach the LED strips to the back of your television.

You can do this by measuring the strip to fit the frame of your TV and cutting it down to fit. Make sure you only cut at where the copper pads meet (see picture)

These strips have an adhesive backing, just peel off the label on the back and stick the strip to the back of your TV.

Observe the arrow on the strip, make sure the strips go clockwise as you’re facing the back of your TV (this can be done in any direction you want as long as the arrows follow, but for simplicity’s sake I suggest doing it clockwise)

I soldered my strips together using wire and a soldering iron but if you don’t want to solder these you can use corner connectors. If you are soldering these, ensure the strips are connected correctly (+5v goes to +5v, Clock In goes to Clock Out etc etc) Be sure to count how many LEDs are on each side.

My TV is on a bench, so I didn't see the point of adding a strip on the bottom of the TV. You can adjust this in the Hyperion settings, which will come later on the in the guide.

Before moving on from here, make sure you test the solder points for any short circuits. This can be done by using the continuity function on your multimeter and by putting each probe on every combination of the solder points. This might seem a hassle, but having to replace blown LED strips is a bigger one.

Step 3: Connecting the Raspberry Pi to the LED Strips

This is a set of diagrams showing what pins the strip connect to on the Pi and the power supply. I am powering the Raspberry Pi using the GPIO pins. I chose to power it this way because it's a more solid connection than just a micro USB cable.

Bear in mind that powering it this way will bypass the protection circuit and could cause permanent damage to the Pi in case anything goes awry.

According to the diagram, the 5V and Ground are to go to the power supply in parallel with the respective lines for the other components. The Clock and Data pins on the strip are connected to pins 23 and 19 respectively.

If you wanted to just wire up the Pi to your LED strip and use Kodi on the Pi itself then you can jump straight to the software side of this project. The upcoming steps modify this diagram slightly to include a switch for the LED strip.

Step 4: Building the Enclosure

*THIS PART OF THE PROJECT IS COMPLETELY CUSTOMISABLE BUT FEEL FREE TO COPY MINE IF YOU WANT*

I searched high and low for a suitable project box to house this circuit and components but I couldn’t find one so I just decided “Screw it, I’ll build my own!”.

I decided on the idea of building an enclosure big enough for the TV to rest on, which also provided more than enough room inside the box to carefully lay out the components for wiring as well as airflow.

I'm sorry to say I didn't take any pictures of the build process as I was on my own and anxious to get the thing built as quickly as possible. I went back and took as many helpful photos as I could.

I dug out some spare plywood sheets from my dad’s shed (thanks Dad!) cut them to size (measurements are in the materials list in step 1) and cleaned them up with a bit of sanding. Before assembling this, one thing I must tell you is:

Decide which panels are front, back etc and mark out the holes for the sockets, buttons and fan grills BEFORE assembly. I cannot stress enough how much of a PITA it will be to do all these if the box is assembled first.

Armed with a drill, a hammer and chisel, a file and some patience I managed to cut out the holes roughly leaving enough mistakes for the connector bushing to hide my dreadful cutting ‘skills’ – if you can, just use a jigsaw.

The LED on/off switch was a 22mm snap-in button, which meant it was really supposed to be used on thin material such as plastic, metal or just much thinner wood panelling. To get around this, I set the depth rod on the drill to stop when I was ¾ through the thickness of the wood and used a 35mm forstner bit to make a large recess from what would be the inside.

I then switched to a 22mm spade bit and flipped the panel around so I was drilling in from the front. The pilot hole was already there, so I patiently drilled the button hole all the way through, which left enough space for me to remove the button effortlessly.

I also drilled a series of holes for the fans to provide airflow. This wasn’t pretty but it functions absolutely fine.

In case I have to move the TV or when I move house I’d like to be able to detach the LED strips from the box and leave them attached to the TV. I thought of a couple of ways to do this, I tried getting a cheap 4 pin connector to work but the sockets melted during soldering so it wasn’t a solid connection. I then came up with the idea of using speaker spring connectors (pictured) – they’re not carrying much current so this would be ideal for it.

With all the difficult stuff for the case out of the way, it was time to assemble the box! I used a Kreg Mini Jig to use pocket holes to bring the box together. I didn’t need to use any glue because the pocket joints were super sturdy and I’d be able to disassemble the box if needbe (this is unlikely, however)

Once this was done, I sanded the hell out of it and just painted it black to hide all the rough stuff and markings that I couldn’t be bothered to sand off without stripping off a layer of ply.

Step 5: Wiring and Assembly

If you'll see the diagrams I haphazardly made, this is how all the components connect with each other within the box as well as how to connect them all up to the power supply.

Let's now assume the box is assembled. It should look something like above in the wiring diagram and the picture of the inside of my box (yes, wiring is an absolute mess but I'm going to tidy that up at some point soon)

Next you will need to prepare the wires to all be connected together.

Measure and cut some of the red and black equipment wire for the LED switch, the HDMI splitter, the speaker terminal connectors (for the LED strip) and the PSU itself.

For the HDMI to AV converter, you’ll need to strip back a sacrificial mini usb cable to provide power for it (a cable may come with the converter, if so use that one). The red wire is positive and the black wire is negative – you can ignore the two data wires so just cut them short and insulate them with some tape or heatshrink tubing to prevent them from interfering or short-circuiting.

The fans will have red and black wires as well (if they have a yellow one, just cut it short and insulate this also)

Bundle up all red wires and black wires together respectively (Positive to positive, negative to negative) as all of the devices need to be connected in parallel. There are several ways you can do this…

  • Solder all positive wires and negative wires in two respective distribution joints.
  • Use a terminal block (not really recommended as there won’t be any redundancy if any of them make a bad connection)
  • Distribution block – better than a terminal block but still not recommended for the reason above. If you use fork crimp connectors on these and are confident that your crimping skills are solid, then this would be a good option.
  • Wago connector. These are foolproof as they come in various sizes, can fit lower gauge wires and can provide a solid connection.

I chose to solder the wires in two distribution joints. I stripped all the wires back to about an inch, split the strands and twisted them together with the other wires in the joint. I then stripped back a thicker wire by 2 inches and then wrapped it around the joint to hold all of the wires together for soldering. Once soldered, the thicker wire goes to the respective terminal on the power supply. This was done for the positive wires (red) and the negative wires (black).

Cover the solder joints with heatshrink tubing and heat them up until they cover the solder joints perfectly.

Step 6: LED Strip On/Off Switch

This is what differentiates my Instructable from others on how to do this.

My plan is to have the Pi and the connectors running constantly and wire in a latching switch so I can turn the LED strips on or off. See GIF above using it with my PS3.

This way, the HDMI splitter still completes the circuit and thus enables us to continue watching/playing stuff on the telly regardless of the lights being on or off. I've drawn up a simple diagram for the switch I used, but if you get a different switch make sure you use the pinout diagram that comes with it and wire it accordingly.

Step 7: Installing OpenELEC and Assigning an IP Address

In this step, you will need to install OpenELEC on the Raspberry Pi. Thankfully this is very easy and straightforward to do.

Go to the OpenELEC Downloads page and select the Raspberry Pi image that is relevant to your model.

Plug your Micro SD card into your PC and download Win32 Disk Imager which will put the OpenELEC image on the card. It's very straightforward to use, but if you're not sure there's a guide on the link I provided.

Once the OpenELEC image has been written on the SD card, connect your Pi to a monitor and plug in a USB keyboard and the SD card.

Power on the Pi with a small 5V power supply or a micro USB phone charger to start the OpenELEC installation.

Just follow the prompts to set it up how you want (if you're not sure, there's a very helpful installation guide on the OpenELEC site) but I will tell you three things you absolutely must do during the setup.

  • Enable SAMBA
  • Enable SSH
  • Connect to WiFi (If using Pi3 or Pi Zero, you'll have WiFi built in but if not just use a cheap WiFi dongle)

Once you're connected to WiFi, now you'll need to assign a static IP address.

Settings > OpenELEC > Network > IPv4 > IP address Method

It's DHCP by default, but now you should change it to 'Manual' and enter in a vacant IP address on your network. The DNS and gateway will be populated by default. If you're not sure, check the OpenELEC website.

Step 8: Controlling OpenELEC Using the Yatse Phone App.

Now that your Pi has OpenELEC installed and is connected to the WiFi, download the Yatse remote app. It's free but also has a paid version with a few extra features (none of which are needed in this tutorial)

  1. Navigate your way to the 'Manage Hosts' part of the app
  2. Press the + button
  3. Select 'Kodi'

Your Pi should appear in the list, select this and follow the steps keeping default values.

Now you'll be able to control Kodi using your smartphone. Bear in mind that the Pi won't be plugged into a screen once the project is complete and this app will enable you to monitor it remotely. You'll be able to check if it's still connected to the network (if anything goes awry) and you'll also be able to turn it off or restart it just from the app.

As you can see from the pictures I have several devices running Kodi.

Step 9: Installing Hyperion and Remote Accessing the Raspberry Pi

This was the part I liked the least, which made it all the more rewarding when I configured it correctly!

Download Hypercon for Windows

Once this is downloaded, create a new folder and place the Hypercon.jar file in there. The reason for this is because if you open it straight from the download folder like I did, the config files that you'll generate will be all over the place. Open Hypercon in the new folder and all the files will be kept together.

When you open it, go to the SSH tab and enter the following

  1. System: Select 'OpenELEC/LE'
  2. Target IP: Enter IP address for your Pi
  3. Port: keep as 22
  4. Username: root
  5. Password: openelec
  6. Connect
  7. Click Inst/Upd. Hyperion

This will install Hyperion to the Raspberry Pi and pave the way for your LED configuration.

Step 10: Creating LED Configuration in HyperCon - Hardware Tab

  1. Configuration Name (enter anything you want here)
  2. Type: Select the LED strip you're using, which in this guide is WS2801
  3. Output: /dev/spidev0.0
  4. Baudrate: 1,000,000
  5. RGB Order: (I kept as RGB)
  6. Construction (Ignore this one)
  7. Direction: The LEDs were placed clockwise on the back of your TV, but now that your TV is facing you set this to counter clockwise.
  8. LEDs Horizontal: count the amount of LEDs that are horizontal, which includes the bottom if you added LEDs there. so if you have 12 LEDs on top and 12 LEDs on the bottom just put 24 in this section.
  9. LEDs left: count the LEDs on the left and put them in here
  10. LEDs right: same as previous step but with the right side.
  11. Bottom Gap: If like me you didn't include any LEDs at the bottom row of your TV then just put in the same amount of LEDs that you have on the top.
  12. 1st LED offset: This is important as this will determine where the LED strip starts. Adjust it so that the first LED in your chain is labelled 0 (see picture)
  13. Image Process: Keep all these values as default.
  14. Blackborder Detection: Tick this as this will bypass the black borders on your content (playing a 4:3 video on a 16:9 screen for example) Leave values as default.

Step 11: HyperCon Process Tab

In this step you will only need to enable the smoothing option and move onto the next step.

Step 12: HyperCon Grabber Tab

If you're planning to just use the Raspberry Pi as an Ambilight media centre then enable the Internal Frame Grabber with the default values and move onto the next step.

  • Grabber V4L2

Here you will enable the USB video grabber. The Device and Input fields will match the USB port but if not just a bit of tweaking will correct this. Change the Video Standard to whichever works in your region though it doesn't really matter.

Keep the remaining fields with their default values and move onto the next step.

Step 13: HyperCon External Tab

Like with the previous step - if you're planning to just use the Raspberry Pi as an Ambilight media centre then enable the Kodi Checker with the default values and move onto the next step. I'm not doing this, so I left it unchecked.

JSON/Proto/Boblight Server

  • Keep these default values but leave Activate Boblight unchecked.

Booteffect/Static Colour

  • Enable this and select an effect for the lights to display upon startup. Keep default values.

Proto/JSON Forward

  • Enable this and keep default values.

Step 14: SSH and Creating Hyperion Configuration File

Now you'll create and send the Hyperion configuration file to the Pi. All files from using this program will be stored in the same folder you created earlier in the 'ible. Follow the below steps carefully.

First, click Save at the bottom which will save the settings for you to come back and amend at your leisure.

Then click Create Hyperion Configuration which will generate a JSON file which we will send to the Pi shortly.

Click Local Config Path and select your generated file which will have the default name of hyperion.config.json

Click Send Config and this will send the configuration file to the relevant folder on the Pi.

Restart the Pi using your Yatse remote app. If all went well, the lights will display the boot effect you chose; if it didn't then retrace your steps.

Step 15: Controlling LEDs With the Hyperion Remote App

Download Hyperion from your phone's app store and open Settings using the menu button in the top right of the app.

Select Add server

  • Name: Anything you want goes here as long as you can identify this is your setup.
  • Address: IP address of your Pi
  • Port: I left this as default which was 19444 and should match the value in the JSON Server in the HyperCon tool.
  • Priority: 50

Now you should be able to change the colours of your LED strip as well as make it play some cool looking presets! To turn this off and make it default to the video grabber, just press the Power icon in the app.

Step 16: Adding HDMI Sources and Enjoying Your New Ambilight Setup.

Remember your HDMI sockets at the back of your enclosure? This is where the magic is about to happen!

Connect one or more (the latter can be achieved with a HDMI splitter or a HDMI AV Receiver) HDMI devices to the input socket and run another HDMI cable from the output socket to the TV.

Some devices might have HDCP enabled (PS4 has this for example) if this is the case disable it or enable passthrough if your device(s) have this.

Step 17: And You're Done!

I do hope you enjoyed my first Instructable. I'm so proud of building this and I have learnt so much throughout the process.

Please let me know what you think of this project and feel free to ask me any questions.

If you've built this from my Instructable, I'd love to see it!

Make it Glow Contest 2018

This is an entry in the
Make it Glow Contest 2018

Share

    Recommendations

    • Toys Contest

      Toys Contest
    • PCB Contest

      PCB Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018

    11 Discussions

    1
    None
    CrankyCoderBlog

    16 days ago

    What happens when you have no hdmi signal coming in to the splitter/av converter. i did this awhile back and where there is no signal, my av converter sends colorbar pattern so all my lights turn on in the color bar pattern at night when everything turns off.

    just wondering if you ran in to that.

    4 replies
    0
    None
    JimsicleCrankyCoderBlog

    Reply 16 days ago

    Mine does that, which is what necessitated the switch for the LED strips. When I first prototyped this it was just the connectors, PSU, Pi and a hastily connected LED strip and the colourbar pattern came up when there was no input.

    20181126_210609.jpg
    1
    None
    CrankyCoderBlogJimsicle

    Reply 13 days ago

    ok, so i am not the only one lol. the switch definitely seems like it's necessary. I wonder how the commercial one does it. :/

    0
    None
    JimsicleCrankyCoderBlog

    Reply 12 days ago

    I imagine there's a menu item that sends a message to the strip telling it to power down. Since I'm not smart enough to know how to do that, I just did an inline switch and forgot about it xD

    0
    None
    Jimsicleonetruegod

    Reply 15 days ago

    You're most welcome, thanks for your kind words.

    0
    None
    pawarana

    17 days ago

    You have a (order) link from the led strip?

    1 reply
    0
    None
    Jimsicletomatoskins

    Reply 23 days ago

    The basic functional circuit only took me a single weekend but designing and implementing the final project took me months and it only took this long due to the endless amounts of changes and testing I went through as the project went on.

    If I planned this better it would probably only take about 2 weekends, haha.

    Thank you very much for your kind words.