Antes de nada dar las gracias a David , www.grabthiscode.com por su tutorial, que he seguido junto a http://pibob.nadnerb.co.uk/
http://misapuntesde.com/res/Ambilight_con_Raspberry_Pi.pdf con http://pibob.nadnerb.co.uk/software.html. En este tutorial encontrarás la forma en el que hacer tú propio Sistema ambilight, no te desesperes. Y si no encontrabas como hacerlo aquí tienes la solución. ¡¡suerte¡¡
Materiales:
-Tira de 50 leds ws2801 <— Muy importante que el chip sea ws2801http://www.ebay.es/itm/230873716903?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649#ht_2298wt_1165
-Cargador 5V 2A (1A por cada 25leds, si quieres una tira de 100 leds, pues necesitas 4A más o menos) https://www.fasttech.com/products/1271304
-Arduino uno o arduino mega. Ambos sirven, pero el Mega es más potente. https://www.fasttech.com/products/1001001 (opcional)
-Jumper wires (cables macho-macho para conectar los leds con el arduino) https://www.fasttech.com/products/1141800
-Conector hembra de corriente 5,5 x 2,1 mm http://dx.com/es/p/male-female-dc-power-converter-connector-adapters-w-terminal-blocks-for-cctv-camera-pair-105084
Lamentablemente todas vienen de china y tardarán unas 2 semanas en llegarte como minimo.
Aparte de estas piezas, necesitas pensar como vas a montarlo en la TV. Hay varias formas: muchos usan una malla metálica, otros un cartón y otros, un canal de pvc adhesivo.
Montaje y configuración.
El tutorial se va a dividir en dos partes. Primeramente vas a conectar los leds al arduino y vas a cargar éste con el programa que los va a controlar. Por último, vas a configurar la raspberry con el sistema operativo y conectada al arduino.
1ª Parte. Arduino + Leds.
Para esta parte, necesitas tener a mano la tira de leds, el arduino, el cable usb que viene con él, los jumper wires, el cargador de corriente y el adaptador del enchufe.
Los leds tienen 2 extremos, uno va conectado a la corriente (macho) y el otro al arduino (hembra).
Conecta el extremo que va a la corriente.
Por el otro lado (el conector hembra), tenemos que conectarlo al arduino. Esta conexión es distinta según el modelo de arduino que estés usando:
- Arduino Mega:
- Amarillo/Blanco: 51
- Verde: 52
- Azul: GND
- Arduino Uno:
- Amarillo/Blanco: 11
- Verde: 13
- Azul: GND
No te preocupes por los cables que se quedan sueltos y el conector que se queda suelto, pues son para conectarlos a otra tira de leds.
Ahora que tienes todo montado, vas a cargar el software en el arduino (este software no es volátil, por lo que se va a quedar grabado en el arduino hasta que lo sobreescribas).
Para ello, descargate el IDE desde la web de arduino. http://arduino.cc/en/Main/Software
Instálalo y conecta el arduino por USB a tu pc. Si todo ha ido, en el administrador de dispositivos podrás ver el arduino. Si no te encuentra los drivers, los tienes en el paquete que te has bajado (/drivers).
Una vez lo tienes todo listo, abre el software del Arduino, vete a “Tools” -> “Board” y selecciona el modelo que tengas (Arduino Mega 2560…en nuestro caso), después revisa en “Tools” -> “Serial” que está marcado el puerto “COM” correspondiente (por defecto estará marcado si has instalado bien los drivers) y por último, vas a cargar en software en “File” -> “Open” y ahí eliges éste archivo. LEDstream.pde
Una vez seleccionado el archivo, pulsa sobre “Upload” y espera que termine. Si todo ha ido bien (recuerda que debes tener todo el sistema conectado leds + corriente + arduino), al finalizar la carga, los leds se encenderán de color Rojo -> Verde -> Azul. Si no pasa eso, intenta repetir el proceso porque algo ha fallado.
Primera parte del tutorial terminada. ¿Fácil, no? Sigamos!
Parte 2.0. Raspberry pi.
Ahora te toca instalar y configurar el software de la raspberry pi.
Siguiendo estos pasos lo lograras.
1. Installación de Raspbmc
Necesitas descargar la última version de RaspBMC e instalarla en tu SDcard de tu raspberry.
Info aqui: http://www.raspbmc.com/download/
2. Entra por ssh a la raspberry (puedes usar putty para hacerlo, login/password=pi/raspberry)
Una prueba de tu nivel en ingles.
Part 2 - Compile/install Boblight
2.1 - Boot up your Pi and your fresh installation of XBMC should be running. To speed up the installation of other components you can stop the XBMC process. You also need to run some updates before you begin:
sudo initctl stop xbmc
sudo apt-get update
2.2 - Install the packages make, gcc, g++ and subversion. Remember to type 'Y' when prompted to confirm installation.
sudo apt-get install make gcc g++ subversion
2.3 - Download boblight source from Googlecode
svn checkout http://boblight.googlecode.com/svn/trunk/ /home/pi/boblight_source
2.4 - Configure and check boblight source is ready to compile
cd /home/pi/boblight_source/
./configure --without-portaudio --without-x11 --without-libusb
2.5 - Check it has completed ok without any errors. There may be warnings, but thats ok, so go ahead and run make...
make;sudo make install
Part 3 - Configure and test Boblight
- sudo wget https://www.dropbox.com/s/xy423w6kj76ldwq/boblight.conf -O /etc/boblight.conf --no-check-certificate
Ahora necesitas un archivo de configuración dónde vas a decirle en que puerto tienes el arduino conectado, cuantos leds tienes y en que posición. Este archivo es muy delicado para arduino, por lo que si quieres puedes usar el que yo he configurado para 50 leds ws2801, con la siguiente posición de los leds: 20 leds arriba, 10 en cada borde y 5-5 abajo en el siguiente orden (5 abajo derecha, 10 lateral derecho, 20 arriba, 10 lateral izquierdo y 5 abajo izquierda, es decir, en sentidocontrario a las agujas del reloj empezando por centro abajo). Este archivo tienes que colocarlo en /etc/boblight.conf. Desde aquí quiero agradecer al usuario infernum de forocoches, su ayuda con la configuración de las coordenadas de los leds.
Con el siguiente comando automáticamente se descarga y se coloca en esa dirección:
El archivo boblight.conf puedes modificarlo como te plazca, pero debes tener en cuenta que:
- El nombre de cada “light” DEBE ser de 3 carácteres. Ni uno más ni uno menos.
- DEBES usar el delayafteropen=1000000 para arduino (sino no se encenderán los leds)
- Hscan y Vscan son las coordenadas de tu pantalla. Más info en la siguiente foto:
- Si vas a usar los leds conectados al arduino, el “type” debe ser “momo”, en cambio si quieres saltarte el arduino y usar directamente los pines GPIO, el “type” debe ser “ws2801″.
- El output suele ser “/dev/ttyACM0″ si estás usando el usb de la raspberry conectado al arduino. En cambio, si usas los pines GPIO, es “/dev/spidev0.0″.
Después de esto, te recomiendo reinciar la raspberry: sudo reboot.
3.2 - Start the boblight daemon
sudo boblightd -f > /dev/null
3.3 - You should hopefully see "Pibob: setup succeeded" or something similar. Now you can test the boblight daemon by telling it to turn all LEDs green:
sudo boblight-constant 00FF00
(el punto 3.4 y 3.5 es si no funciona)
3.4 - At this stage, you may find your LEDs don't do anything and you get an error complaining about "libboblight.so", if so, try a reboot (el punto 3.4 y 3.5 es si no funciona)
sudo reboot
3.5 - Test again by turning all the LEDs a nice raspberry colour, or grab any other colour you like from ColorPicker.com
You can press CTRL+C to stop boblight-constant and run it again with a different colour.
sudo boblight-constant AB0030
( si no funciona repetir todo el proceso)
3.6 - If not all of your LEDs are lit up, you may need to make some changes to boblight.conf (step 3.1c)
3.7 - You don't want to have to manually start the daemon every time you start Raspbmc so you can put an entry in rc.local so it starts automatically. Start editing rc.local:
sudo nano /etc/rc.local
Paste this on the line before "exit 0" (escribir ante del ultimo "exit 0"
/usr/local/bin/boblightd -f
If you also want to set a static colour for your LEDs you can add another line directly below the code above (but above "exit 0")
sudo /usr/local/bin/boblight-constant AB0030 -p 254
Part 4 - Configure XBMC
So your LEDs are working, you can now send basic colours to boblight daemon via boblight-constant and you set Raspbmc to do both automcatically on boot. You now need to get XBMC to send colour information to each LED when a video plays. This currently requires a custom build of XBMC with a modified OMXplayer. crckmc and nyar have kindly done the hardwork and provided such a build.
4.1 - Download the XBMC build
cd ~
wget https://www.dropbox.com/s/mf3p4ubuujlr8qg/xbmc-rbp-pibob-20130429.tar.gz
4.2 - Stop the current build of XBMC and unzip the new build. This step can take a while.
sudo initctl stop xbmc
sudo tar -xzf xbmc-rbp*.tar.gz -C /opt
4.3 - The custom XBMC is now installed and will be looking for a config file which tells XBMC where and how to communicate with boblightd which in turn communicates with the LEDs. Create the config file:
sudo nano /home/pi/boboptions.txt
Paste this into the new file and save
host=localhost
port=19333
priority=128
sizedown=112
margin=5
timeout=35
interpolation=0
speed=75
autospeed=0
saturation=1.5
threshold=30
4.4 - And we're done! All that's left to do now is reboot. Provded you followed all the steps above, your Pi will boot up, your LEDs will come on with a static colour and when you play a video you should see the LEDs change colour in sync with the video. When you stop the video, your static colour should return.
So, reboot and give it a try:
sudo reboot
Finally, don't forget to disbale automatic updates within the Raspbmc settings. If you do, you may lose boblight functionality next time Raspbmc updates (if you're running the June 2013 Raspbmc build or newer, then you can obviously leave this option enabled).
Ya no tienes excusa para no montarte tu propio sistema Ambilight. Anímate a hacerlo y postea las fotos de cómo te ha quedado todo!
- Primera Publicación: 31 de ene. de 2014. GRACIAS