[HOW TO] Build Ambilight on Linux (AppleTV; Sams image; Ubuntu 8.04;...) - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52) +---- Thread: [HOW TO] Build Ambilight on Linux (AppleTV; Sams image; Ubuntu 8.04;...) (/showthread.php?tid=101406) |
[HOW TO] Build Ambilight on Linux (AppleTV; Sams image; Ubuntu 8.04;...) - illiac4 - 2011-05-13 How to build ambilight (amblone) on Linux. This guide is focused on AppleTV with Sam.Nazarko image build on Ubuntu 8.04 LTS, but it will also work for other Linux versions. I did this with standard configuration and Ubuntu installed on internal disk. I think it will also work with USB pen drive install and USB hub with small modification of boblight.conf (line: output /dev/ttyUSB0) file. So lets get started. First you will need some hardware. This guide is using the hardware idea from Amblone project. So for building the hardware just go to http://amblone.com/guide On this site there is also schema for building the circuit board. In this guide i will be using Arduino Mega1280 (http://arduino.cc/en/Main/ArduinoBoardMega) micro-controller with four channels output but it is the same on Arduino Duemilanove (http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove). The only difference is that Duemilanove uses just two channels (one channel means one led stripe and one led stripe one colour). They are both USB type. Basically you will need: - 1x Arduino micro-controller (Arduino Mega1280 (4 channels) or. Arduino Duemilanove (2 channels)) (BUY: http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=250772053631&rvr_id=231895391331&clk_rvr_id=231895391331&mfe=sidebar or. http://cgi.ebay.de/Arduino-Duemilanove-2009-AVR-Atmega328p-20PU-USB-board-/250796447800?pt=LH_DefaultDomain_3&hash=item3a64a21838 ) - 1x RGB LED stripes without lens. I'd recommend this one (5-m) (BUY: http://www.dealextreme.com/p/rgb-multicolored-5-meter-150-led-30w-light-strip-dc-12v-14963 Or. http://www.dealextreme.com/p/rgb-multicolored-1-meter-30-led-6w-light-strip-dc-12v-14965 ) - 1x A USB A to B cable (at some stores on e-Bay you get one with Arduini board as a gift - 12x 2N 3904 transistors http://www.dz3w.com/uploadfile/2010/0807/20100807060813814.gif (BUY: http://cgi.ebay.com/30-x-2N3904-NPN-General-Propose-Transistor-/250816569522?pt=LH_DefaultDomain_0&hash=item3a65d520b2 ) - 12x 2200ohm resistors (BUY: http://cgi.ebay.com/100-x-Resistors-2-2K-Ohms-1-4W-5-Carbon-Film-/250537839379?pt=LH_DefaultDomain_0&hash=item3a55380b13 ) - 1x power supply 12v 1A to fit in Arduino and powering RGB LED stripes (BUY: http://www.dealextreme.com/p/ac-to-dc-12v-1a-power-adaptor-with-5-4mm-dc-plug-eu-type-110-240v-15991 ) - 1x PCB Board (BUY: http://cgi.ebay.com/Paper-Phenolic-Prototyping-PCB-5x7-Universal-Board-/220656308165?pt=BI_Electrical_Equipment_Tools&hash=item3360240fc5 ) - PIN Headers (BUY: http://cgi.ebay.com/5-X-40-pin-2-54mm-PCB-Male-Header-DIY-Arduino-MCU-/160573025973?pt=LH_DefaultDomain_0&hash=item2562e5eeb5 ) - Some wires (BUY: http://cgi.ebay.com/Arduino-Solderless-Breadboard-Dupont-Jumper-Wires-QTY30-/370460721579?pt=Vintage_Electronics_R2&hash=item56412e01ab ) Now you have all parts for start building. Use Amblone guide on how to build the board from resistors and transistors. http://amblone.com/guide First you have to program the micro-controller with the .pde file. Download .pde for Arduino board from http://code.google.com/p/boblight/source/browse/trunk/arduino/boblight_arduino_pwm/boblight_arduino_pwm.pde (copy and paste content to notepad and save as f.e. arduino.pde file) (This .pde is suitable for both Arduino Mega1280 and Arduino Duemilanove) After that download software from http://arduino.cc/en/Main/Software or. direct link http://arduino.googlecode.com/files/arduino-0022.zip Connect micro-controller to the PC and install drivers (included in software). Then run the program, select com port, Arduino board type and upload the .pde you have downloaded). If you are having troubles, you can read on Arduino site the how too guide. Now if you have uploaded the .pde to the controller, you are ready to install Boblight on ATV (Linux). -------------------- How to ride on Linux -------------------- First i did enable root account on Sams image. Later you can disable it. Quote:sudo passwd rootThis will prompt for a new root password and once you confirm it, you can start using the root account to login. If you want to disable root account in Ubuntu you need to lock the root account by using the following command Quote:sudo passwd -l root Quote:sudo apt-get install libx11-dev libgl1-mesa-dev libxrender-dev portaudio19-dev libavcodec-dev libavformat-dev libswscale-dev libxext-dev Download http://packages.ubuntu.com/natty/libavdevice-dev (libav_0.6.2.orig.tar.gz) and upload it with WinSCP into /tmp folder on AppleTV. You can also wget it. Quote:cd /tmp Quote:cd Download .conf file from SVN. Conf file for Mega1280 http://code.google.com/p/boblight/source/browse/trunk/arduino/mega.conf and for Duemilanove http://code.google.com/p/boblight/source/browse/trunk/arduino/duemilanove.conf After that, rename it to boblight.conf and copy it into /etc (/etc/boblight.conf) with WinSCP. You can of course direct download it from Ubuntu if you know how to Now you can start boblight. Quote:ldconfig You can experiment then a little with settings. At the moment i have those Quote:boblight-X11 -f -x -o speed=70 -o value=10 -o saturation=5.5 -o threshold=100 This are options for boblight-X11: Quote:Usage: boblight-X11 [OPTION] Some tips: - If you run Quote:boblightdwithout switch, it will run in foreground (useful for troubleshooting). With CTRL+c you can cancel foreground deamon) - First test lights with Quote: boblight-constant ffshould run blue light. To exit CTRL+c. - If it says: (root@appletv-ubuntu:/tmp/boblight-read-only# boblight-constant ff ERROR: libboblight.so: cannot open shared object file: No such file or directory root@appletv-ubuntu:/tmp/boblight-read-only#) then (run Quote:ldconfig[quote] as root)Stops boblight deamon. - Quote:killall boblight-X11Stops boblight-X11 deamon. - Quote:boblight-X11 --helpHelp info for more config options. - Read this to auto-start "boblightd" http://forum.xbmc.org/showpost.php?p=800473&postcount=10 - Advance Launcher with Ambilight: http://forum.xbmc.org/showpost.php?p=851313&postcount=36 - To dim the lights select Screensaver as black. - It makes no affect on CPU if using one or four channels. - On my AppleTV the processor is: - around 37% when on idle (on system info screen) - 47% when playing 1080p movie (Avatar 8GB file) (Using CrystalHD 70012) - 40% when playing 720p movie (Law Abinding Citizen 4GB file) (Using CrystalHD 70012) - 30% on standard divx film (Animal United 1,57 - 2cd file) TNX to bobo1on1 for making this possible and great IRC support. Feedback and tips are welcome. P.S.: Here you can see some pictures of power circuit that I have build. This is just for better ''imagination''. You have to be careful that you do insert some sort of isolation between the Arduino and power circuit. http://www.flickr.com/photos/64262741@N03/ Also when soldering use paste to achieve good contacts between the components and solder. And when you are finished done soldering clean the PCB board (i have used Acetone and brush) to avoid conductibility between electronic parts. Also double check that there is no shortcuts between transistors. - davidw - 2011-05-13 Awesome!! I need this too for my system! So I connect this via USB to my HTPC? Great Post! Cheers, David - Sam.Nazarko - 2011-05-13 Please don't enable root. If you don't want sudo infront of every command run sudo -s to elevate your privileges temporarily. Can I add this to Ubuntu documentation on my blog please? - Sam.Nazarko - 2011-05-13 Also: 60% CPU usage idle? That is high.. If you want advice for start-up you could add it to /etc/rc.local -- but bare in mind the May 2011 update changed rc.local, and I do reserve the right to update this file again, so it might get overwritten one day - illiac4 - 2011-05-14 Sam.Nazarko Wrote:Please don't enable root. If you don't want sudo infront of every command run sudo -s to elevate your privileges temporarily. Can I add this to Ubuntu documentation on my blog please? You can of course add this to your site. I will make modifications to the tutorial so the root will not be enabled. About startup i'm having still some troubles and as soon i will succeed i will update the tutorial. - Sam.Nazarko - 2011-05-14 I presume there is a command to fire up the daemon? You can either make an init.d script which allows you to stop, restart or start. Or you can take a much simpler route and append it to rc.local, adding it in just before the xinit statement to launch XBMC - bobo1on1 - 2011-05-14 You can start boblightd any time you want, but if you start boblight-X11 you have to be running an X server. - Sam.Nazarko - 2011-05-14 I see. Problem is that X11 is not started till XBMC launches, and that hangs up rc.local, so adding the boblight command after it would not initialise till XBMC closes. Maybe spawn two concurrent processes, like this: Code: (xinit /usr/local/bin/xbmc --standalone);(boblight-X11 &) But that relies on the fact that Boblight does not hang at the command line and wait for someone to end the process -- X for example hangs, but once XBMC closes, it closes letting rc.local finish. If this didn't happen - you'd have to edit the file to get to the tty1 session. What I've wrote should be okay though -- it should run Boblight in backgorund - illiac4 - 2011-05-14 I have made two scripts. Copied it into /etc/init.d Chmod 755 Lights.sh script starts Boblight and boblight-X11 Quote:#!/bin/sh Lights_kill.sh script stops Boblight and boblight-X11 Quote:#!/bin/sh To run it just go with terminal: Quote:cd To stop it just go with terminal: Quote:cd The problem is that this two scripts are working after the XBMC is up and only through terminal. Does someone know how this two scripts could be initiated inside XBMC? Can someone write small how to add bobolightd and x11 to auto start. Where in rc.local should the command be inserted so that the startup will work. - illiac4 - 2011-05-19 Well i'm still trying to do auto startup of boblight. The first part is working. And this is to start the boblight. Boblight startup: - Create lights.sh script under /etc/init.d Quote:#!/bin/sh- give lights.sh 755 permissions - create symbolic link Quote:ln -s /etc/init.d/lights.sh /etc/rc2.d/S10lights.sh But the second one is making troubles. With this one i'd like to start the DISPLAY=:0.0 and boblight-x11. So i have put the following into rc.local file but it will not start. I have tried without quotes and nothing. The boblight-x11 has to start after X. If i enter manually command Quote:DISPLAY=:0.0 boblight-X11 -f -x -o speed=65 -o value=5.5 -o saturation=1.7 -o threshold=75 > /dev/null 2>&1into terminal it works but automatic does not. Quote:#!/bin/sh -e - thesam73 - 2011-05-19 Nice. Great, thank you very much for that ! Any chance it will work on the atv2 ? - alx5962 - 2011-05-19 Does this works on linux if hardware acceleration is enabled on XBMC ? - illiac4 - 2011-05-19 On ATV2 it will not work, because ATV2 has not USB port to accept usb input. And it does work with CrystalHD enabled. We only have to figure out how to autostart the boblight, display and boblight-x. Cheers - bobo1on1 - 2011-05-19 You can still run a boblightd client on the atv2 and use a machine with usb to drive the leds. You might have to write the client yourself though. - thesam73 - 2011-05-20 ok, thanks for the answer. Many thanks for the atv support anyway cheers |