- January 19, 2007
- 791
- 741
- Home Country
- England
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:
1 stream = 3 x (number of leds = 50 for me) + 4 = 154 bytes - how many bytes per led set, 4 bytes for unsigned long to hold frame time
60 fps = 16.67ms per frame - worst case scenario for data rate from tv/film, change to 10ms for worst case colourcycle usage
Using Uno = 2k = 2048
2048 / 154 = number of whole frames = 13
13 - 3 (safety margin, other data in sram) = 10
10 * 16.67ms = 166.7ms maximum delay
Mega/Teensy = 8k = 8192
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
To install:
- Ensure you are already able to compile the existing AtmoDuino source. Note your addLED setting.
- Install the FastLED library (from here: http://fastled.io/)
- Install the QueueArray library (from here: http://playground.arduino.cc/Code/QueueArray)
- 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
- 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.
- Change the addLeds call to suit
- Compile, upload and test with AtmoWin/AmbiBox
1 stream = 3 x (number of leds = 50 for me) + 4 = 154 bytes - how many bytes per led set, 4 bytes for unsigned long to hold frame time
60 fps = 16.67ms per frame - worst case scenario for data rate from tv/film, change to 10ms for worst case colourcycle usage
Using Uno = 2k = 2048
2048 / 154 = number of whole frames = 13
13 - 3 (safety margin, other data in sram) = 10
10 * 16.67ms = 166.7ms maximum delay
Mega/Teensy = 8k = 8192
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
Attachments
Last edited: