home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
HTPC Projects
Hardware
Ambient Lighting System
[SOFT] AtmoDuinoSync - a way to lip-sync your AtmoDuino
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="kenwonders" data-source="post: 1058469" data-attributes="member: 29743"><p>This Arduino code can allow you to add a delay (in milliseconds) to the output so that your AtmoDuino updates at the same time as your TV. This is not the same as the loop delay as is in the AtmoLight plugin, this will drive the LEDs at the same rate as received, but delayed by the amount of time you specify, just like with audio.</p><p></p><p>To install:</p><ul> <li data-xf-list-type="ul">Ensure you are already able to compile the existing AtmoDuino source. Note your addLED setting.</li> <li data-xf-list-type="ul">Install the FastLED library (from here: <a href="http://fastled.io/" target="_blank">http://fastled.io/)</a><br /> </li> <li data-xf-list-type="ul">Install the QueueArray library (from here: <a href="http://playground.arduino.cc/Code/QueueArray" target="_blank">http://playground.arduino.cc/Code/QueueArray</a>)</li> <li data-xf-list-type="ul">Unzip file from this thread and place in dir (or open it and let the Arduino software do this for you)</li> <li data-xf-list-type="ul">Change the 3 settings near the top to suit<ul> <li data-xf-list-type="ul">NUM_LEDS - How many LEDs in your set</li> <li data-xf-list-type="ul">SERIAL_TIMEOUT - How long after no data is received before blanking out LED set</li> <li data-xf-list-type="ul">STREAM_DELAY - How long to delay the LED stream after receiving it.</li> </ul></li> <li data-xf-list-type="ul">Change the addLeds call to suit</li> <li data-xf-list-type="ul">Compile, upload and test with AtmoWin/AmbiBox</li> </ul><p>The LED data is buffered in a QueueArray. If you are using a Mega then you will be able to add nearly a second delay to 50 leds. To calculate how long, you can use these calculations:</p><p><strong>1 stream = 3 x (number of leds = 50 for me) + 4 = 154 bytes </strong>- how many bytes per led set, 4 bytes for unsigned long to hold frame time<strong></strong></p><p><strong>60 fps = 16.67ms per frame </strong>- worst case scenario for data rate from tv/film, change to 10ms for worst case colourcycle usage</p><p></p><p><strong>Using Uno = 2k = 2048</strong></p><p>2048 / 154 = number of whole frames = 13</p><p>13 - 3 (safety margin, other data in sram) = 10</p><p>10 * 16.67ms = 166.7ms maximum delay</p><p></p><p><strong>Mega/Teensy = 8k = 8192</strong></p><p>8192 / 154 = number of whole frames = 53</p><p>53 - 3 (safety margin, other data in sram) = 50</p><p>50 * 16.67ms = 833.5ms maximum delay</p><p></p><p>All suggestions for improvements would be great. I have some comments:</p><p></p><p>- This code was put onto a kit known as 'AdaLight' which although has a really lovely Arduino driver (a state machine), it is not well supported in software. If you have an AdaLight, this will work out the box for you as an AtmoDuino.</p><p></p><p>- If you buy a set of LEDs to chain with existing set and they do not work, ignore logic and try the data/clock in reverse (even if the arrows suggest otherwise!).</p><p></p><p>- Lastly a huge thank you to the other posters on this forum both English and German (translated!) for all their posts, I would not have a working setup without all that useful information.</p><p></p><p>Last file update: 2.1 - changed to FastLED</p></blockquote><p></p>
[QUOTE="kenwonders, post: 1058469, member: 29743"] This Arduino code can allow you to add a delay (in milliseconds) to the output so that your AtmoDuino updates at the same time as your TV. This is not the same as the loop delay as is in the AtmoLight plugin, this will drive the LEDs at the same rate as received, but delayed by the amount of time you specify, just like with audio. To install: [LIST] [*]Ensure you are already able to compile the existing AtmoDuino source. Note your addLED setting. [*]Install the FastLED library (from here: [URL='http://fastled.io/']http://fastled.io/)[/URL] [*]Install the QueueArray library (from here: [url]http://playground.arduino.cc/Code/QueueArray[/url]) [*]Unzip file from this thread and place in dir (or open it and let the Arduino software do this for you) [*]Change the 3 settings near the top to suit [LIST] [*]NUM_LEDS - How many LEDs in your set [*]SERIAL_TIMEOUT - How long after no data is received before blanking out LED set [*]STREAM_DELAY - How long to delay the LED stream after receiving it. [/LIST] [*]Change the addLeds call to suit [*]Compile, upload and test with AtmoWin/AmbiBox [/LIST] The LED data is buffered in a QueueArray. If you are using a Mega then you will be able to add nearly a second delay to 50 leds. To calculate how long, you can use these calculations: [B]1 stream = 3 x (number of leds = 50 for me) + 4 = 154 bytes [/B]- how many bytes per led set, 4 bytes for unsigned long to hold frame time[B] 60 fps = 16.67ms per frame [/B]- worst case scenario for data rate from tv/film, change to 10ms for worst case colourcycle usage[B][/B] [B]Using Uno = 2k = 2048[/B] 2048 / 154 = number of whole frames = 13 13 - 3 (safety margin, other data in sram) = 10 10 * 16.67ms = 166.7ms maximum delay [B]Mega/Teensy = 8k = 8192[/B] 8192 / 154 = number of whole frames = 53 53 - 3 (safety margin, other data in sram) = 50 50 * 16.67ms = 833.5ms maximum delay All suggestions for improvements would be great. I have some comments: - This code was put onto a kit known as 'AdaLight' which although has a really lovely Arduino driver (a state machine), it is not well supported in software. If you have an AdaLight, this will work out the box for you as an AtmoDuino. - If you buy a set of LEDs to chain with existing set and they do not work, ignore logic and try the data/clock in reverse (even if the arrows suggest otherwise!). - Lastly a huge thank you to the other posters on this forum both English and German (translated!) for all their posts, I would not have a working setup without all that useful information. Last file update: 2.1 - changed to FastLED [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
HTPC Projects
Hardware
Ambient Lighting System
[SOFT] AtmoDuinoSync - a way to lip-sync your AtmoDuino
Contact us
RSS
Top
Bottom