update README for AtmoLight

This commit is contained in:
King Kévin 2015-07-17 13:25:42 +02:00
parent d808c5dafa
commit ea0a9bdd7d
1 changed files with 31 additions and 39 deletions

70
README
View File

@ -14,13 +14,12 @@ To implement this I used:
The original AtmoLight offers only has 4 channels: top, bottom, left, right.
Each channel correspond to an LED strip, but all LED on the strip will show the same color.
But I am using a 60 LEDs WS2812B BlinkyTape LED strip, with individually controllable LEDs.
And I would like to use this capability to have a more fine grained ambient light.
Thankfully VLC comes with several AtmoLight device types, such as fnordlicht, which some offers more channels.
Plus VLC offers the possibility to divide the screen sides in "zones".
So to match the 16/9=1.78 aspect ratio of my screen I divided the LED strip in 19 LEDs for top and bottom, and 11 LEDs for the sides, for a close aspect ratio of 19/11=1.73.
Sadly VLC come with a limit of 16 zones per side.
At least with the 19/11 LEDs combination I can also do the 16/9 LEDs combination.
The BlinkyTape LED strip offers 60 LEDs WS2812B LEDs.
To match the 16/9=1.78 aspect ratio of my screen I divided the LED strip in 19 LEDs for top and bottom, and 11 LEDs for the sides, for a close aspect ratio of 19/11=1.73.
Although the LEDs are individually controllable, they will have the same color per side.
To have a more fine grained ambient light VLC comes with several AtmoLight device types, such as fnordlicht, which offers more channels.
See the fnordlich branch for the corresponding implementation.
code
====
@ -44,54 +43,47 @@ The LED strips are connected in parallel as follows:
- 08 LEDs on pin D6 (PD7) for the bottom second LED strip
- 11 LEDs on pin D7 (PD8) for the right LED strip
`main.c` will parse the UART input data for fnordlicht commands and set the LED colors on the strip.
Don't forget to configure the AtmoLight VLC video filter accordingly:
- device type: fnordlicht
- count of fnordlicht's: 51
- number of zones on top: 16 (maximum)
- number of zones on bottom: 16 (maximum)
- zones on left/right side: 9 (to follow 16/9 aspect ratio)
- calculate an average value: yes
- channel 0 summary: zone 4 summary
- channel 1 left: zone 3 left
- channel 2 right: zone 1 right
- channel 3 top: zone 0 top
- channel 4 bottom: zone 2 bottom
- channel/zone assignment: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50
Only 50 LEDs will be used (16+9+16+6), but the 51st LED for the summary will trigger the output of the 50 LEDs.
`main.c` will parse the UART input data for AtmoLight messages and set the LED colors on the strip.
It will use the AtmoLight channel color values to set the colors on the corresponding WS2812B LED strips.
other
-----
`test.rb` will connect to the microcontroller and run standard tests to see if all is working.
`parse_vlc_dump.rb` will parse the data from a file give a argument and format the data coming out of VLCs AtmoLight fnordlicht module.
This helps to see what data/commands VLC sends.
The easiest way to get data it to use 2 USB to UART converter with TX/RX interconnected, VLC using the first (ttyUSB0), and you getting the data on the other (ttyUSB1).
To set the baurdaute: `stty -F /dev/ttyUSB1 19200`.
The easiest way to see what messages VLCs AtmoLight (AtmoLight device type) is sending, use 2 USB to UART converter with TX/RX interconnected.
VLC should use the first (ttyUSB0), and you get the data on the other (ttyUSB1).
To set the baurdaute: `stty -F /dev/ttyUSB1 38400`.
To get the data: `xxd -ps /dev/ttyUSB1 > dump.txt`
To show the data: `./parse_vlc_dump.rb dump.txt`
A example for a white picture is available in `vlc-fnordlicht-dump.txt`
A summary for diffentes pictures is available in `vlc-atmolight-dump.txt`
limitation
==========
Don't forget to short the reset pin of the microcontroller with 5V to prevent reset when the serial port is open.
Else the firmware will miss the start of VLC's communication (the sync) while booting.
This would make the LED light output garbage.
Else the firmware will miss the start of VLC's communication while booting.
This will automatically be corrected after some short time though since the firmware synchronises on the AtmoLight message header.
In the current WS2812B implementation setting an LED colors requires 36 us.
Thus setting 11 LEDs (left/right strips) requires 396 us, and 19 LEDs requires 684 us.
Outputting the data to the WS2812B strips requires 48 us for a single LED on all pins/strips in parallel.
For 11 LEDs per strip is requires 348 us.
For 11 LEDs per strip it requires 348 us.
The fnordlicht protocol uses a baud rate of 19200 bps with 8N1 configuration.
Thus sending/receiving one byte requires 1.0s/(19200bps/(8+1)bits)= 469 us.
This leaves enough time to output the LED color values to the strips.
To set the color of an LED it VLC to send a 15 bytes fnordlicht command.
Thus in one second for 50 LEDs we can show 1.0s/(19200bps/(8+1)bits/15bytes/51leds) = 0.5 fps.
This is not a particularly fast refresh rate.
The AtmoLight protocol uses a baud rate of 38400 bps with 8N1 configuration.
Thus receiving one byte requires 1.0s/(38400bps/(8+1)bits) = 234 us.
Since the ATmega buffers one received byte while the next one is shifted in.
This leaves enough time to ouput WS2812B data, particularly since this code is not interruptable, without loosing an incoming byte.
This also leaves enough time set the color of 11 LEDs.
But this does not leave enough time for setting the color of 19 LEDs.
Thankfully the LED color setting code is interuptable.
The colors will be set, while new data is coming in and saved in the interrupt routine.
A buffer of 2 AtmoLight messages is thus enough to handle setting the LEDs and output the data.
And finally the VLC AtmoLight video filter module is only available in VLC <= 2.2.
To set the color of all channels VLC sends a 19 bytes AtmoLight message.
Thus the AtmoLight refresh rate is 38400bps / (8+1)bits/byte / 19bytes/frame = 224 fps.
This is faster than any (almost) video frame rate.
Finally the VLC AtmoLight video filter module is only available in VLC <= 2.2.
This module has been removed for VLC 3.0.
links
@ -101,5 +93,5 @@ VLC AtmoLight video filter module README: https://github.com/videolan/vlc/blob/2
VLC AtmoLight removal announcement (2015-05-10): https://mailman.videolan.org/pipermail/vlc-devel/2015-July/103679.html
VLC AtmoLight removal (2015-05-10): http://repo.or.cz/w/vlc.git/commit/6713041eebe0c4245de4f78dfeb5effecb797faf
VLC changelog: https://github.com/videolan/vlc/blob/master/NEWS
Fnordlicht protocol: https://raw.githubusercontent.com/fd0/fnordlicht/master/doc/PROTOCOL
AtmoLight protocol: http://www.vdr-wiki.de/wiki/index.php/Atmo-plugin
WS2812B LEDs: http://www.world-semi.com/en/Driver/Lighting/WS2811/WS212B/