I’ve previously mentioned that I was initially using this code by James Bruce to drive the ambilight. While I was waiting for the circuit board components to arrive, I thought I would take some time to expand on his work, fix some bugs, and add a few features I thought were missing. After a few recent tweaks it’s now ready for distribution.
I’ve reworked the Adalight code to provide user-friendly options that allow you to easily customize it for your setup. I also added a brightness limiter and a calibration mode, which sets all LEDs to the same values.
Although I’ve only tested it with WS2812B strips, in theory the code should work with any FastLED supported chipset! These are relatively small changes from a programming standpoint, but it should make it easier for anyone to build their own Adalight setup without mucking around with the code.
I’ve created a git repository for the project, which I’ve decided to call Adalight-FastLED. You can find the repository, with the download links, here: https://github.com/dmadison/Adalight-FastLED
If you find an issue with the code or can confirm that it works with a specific LED type, please let me know! (Creating an issue on the GitHub repo would be the preferred method.) I’m hoping to keep the repository up to date for the foreseeable future.
This post is part of a series on creating a DIY ambilight using Adalight and WS2812B LEDs. Check out the project page here.
Next up: Part 7 – Videos and Gifs
Mason · April 18, 2017 at 10:05 pm
I tried your sketch “Adalight-fastLED” with FastLED 3.1.3 library and Prismatic 184.108.40.206 but the LED didn’t light up at all, the Led works fine with Adafriut Neopixel Library so i know for sure its not a hardware issue, any idea how to fix the issue with your code ?
Dave · April 18, 2017 at 10:27 pm
The current code has no issues that I’m aware of.Check that you have the correct serial port selected in Prismatik, otherwise try sending data through another application or switching USB ports / cables.
Scratch that last – someone else reported an issue with the code if your LED length is above 85. You can try out a test fix on the ‘development’ branch, otherwise expect a fix in the next release.
Daniel · April 22, 2017 at 7:02 am
nice project and well done work.
I tried the “Adalight-fastLED” Release 1.1.0, but the Leds wont light up. I have 114 leds. I tried it with 60: works fine.
The limit is 85 leds. I did not debug the code, but 85 leds with 3 byte color is 255 bytes; i think this causes the limit.
Is there an intention to make Adalight-fastLED work with more than 85 leds?
I used FastLed 3.1.3 with prismatik 5.11.3.
Dave · April 22, 2017 at 3:58 pm
Thanks for the kind words. Someone else reported the same problem earlier this week. I’m not 100% sure what’s causing the issue, but I have a hunch. I’ve pushed a test fix to the ‘development’ branch on Github, which works for LED lengths above 85 on my setup. See if that works for you, and I’ll include the bugfix in the next release.
Sofos · November 8, 2017 at 8:24 am
Since I’m starting to collect what I need for this project…I want to do it with 144 leds/m LED strip.
I have a 34” inches ultrawide monitor. From my calculations that is 108 leds at the top and 43 leds at the side so total of 302 leds. Is it possible or there’s still the limitation of the 85 leds?
Thanks in advance.
Dave · November 8, 2017 at 8:51 am
The 85 LED limitation should be fixed and work fine with 302 LEDs, although I’ve never tested with that many. I’d recommend against it though, as your framerate will be very poor (see the appendum posts about Adalight framerate).
sofos1990 · November 8, 2017 at 9:07 pm
Thanks for the reply. I just read it very fast. I will read it carefully later today.
I just wanted to ask according to your experience…is the difference between the LED strip and the actual monitor colors noticeable? I mean at the point where the LED strip will have a different color than the monitor.
Also, I’m reading that using a faster micro-controller won’t help much because the code is already lightweight but I was thinking of using 2 or even 3 Arduinos (1 for both the sides and 2 for the top and bottom). Most likely it won’t make any difference but let’s say I do it how do I mix them all in the Prismatik software?
Dave · November 8, 2017 at 10:28 pm
If you haven’t already, I’d recommend reading through the entire build series for my ambilight. It should answer most of your questions.
The big limitation speed-wise is the throughput of the virtual serial port. Prismatik doesn’t support multiple serial outputs; you can’t run 2 or 3 Arduinos without some sort of go-between.
Sofos · November 9, 2017 at 10:44 am
You were right yeah after I read the build I think I will give it a go.
Definitely the more LEDs will add more latency but I still believe it won’t be bad. The 60 leds/m seems pretty ok to me from the video and from what you describe. Hopefully 144 perform the same.
I’m trying the software now but Prismatik only allows up to 99 leds. Horizontally I need 108 and ideally 112. Vertically I need 43 but the best would be 49. How can I allow more than 99 leds per direction on Prismatik ? Ambibox allows 300 zones max. and I need ideally 322. Bambilight allows 100 per direction so it’s still less. Hyperion allows more but it only works with Raspberry Pi? I can’t find any guide with Arduino. There’s seem to be a version of Ambibox which allows up to 400 zones(leds) but it’s not available in the public. Only the guy who modded it has and he doesn’t seem to be active anymore. Any idea?
Dave · November 9, 2017 at 11:49 am
If the software doesn’t exist, you’ll probably need to program it yourself. As a stop-gap you could modify some driver software to make logical groups of LEDs running off the same color data, which would allow you to use any of that software.
Although again I’d recommend not attempting to build an ambilight setup with that many LEDs for a variety of reasons.
Mpegger · July 13, 2019 at 2:30 pm
I was having problems with my 270 LED SK9822/Prismatik setup (couldn’t go over 20FPS without random flashes of color) and I stumbled upon your site in my search for help. I saw that you were having no problems with high FPS rates and so I downloaded your code and it works great! The 270 LED setup can do 60FPS now, running with a 2,000,000 baud rate.
All the other scripts I tried so far, along with edits I performed here and there (I have ZERO Arduino/programming experience, but I understand the basics of coding), did not solve my problem, but your code worked without a hitch! Thank you for your code!
One thing I would like to know, is what the optional GROUND_PIN is for in the script? I am tieing the ground from the LEDs to a normal ground pin on the Arduino, but I did not uncomment the Ground_PIN definition.
Dave · July 13, 2019 at 11:26 pm
I’m glad to hear my code helped you out!
The GROUND_PIN definition is a leftover from the code that I used as a basis for my modifications. If for whatever reason you can’t connect the LED strip to one of the Arduino’s ground pins, you can set that definition and ground the strip through one of the digital I/O pins of your choice. I doubt anyone uses it, and it will probably be removed if I ever rewrite the code.
Michal · November 22, 2020 at 7:16 pm
Thanks for posting your project.
I am using Prismatic, your version of Adalight and WS2812B led strip.
I have one problem with this setup. During color changing the leds are flickering (sometimes).
I though that this is due to low fps, but fps is around 25 to 60 hz. You mentioned about led flickering in article.
I left lines 43 and 44 uncommented but with no effect.
Do you have any idea what can be a problem?
Dave · November 22, 2020 at 8:56 pm
Hi Michal. I’d start by checking your wiring and that the power supply is sufficient for the number of LEDs you’re using. If those check out, then the flickering is likely caused by serial data transmission issues and the WS2812B LEDs blocking the buffer. If you haven’t already, I’d recommend reading some of the follow-up articles on framerate limits with Adalight and WS2812B LEDs. You may need to increase your baud rate to achieve a stable setup.
Michal · November 23, 2020 at 4:23 pm
Thanks for your reply. This is small setup for tests only. (3 leds and sufficient power supply). Wiring is also correct. Data transmission is set to max value (11520). Fps in prismatik is about 50 – 70 fps. I noticed that leds flickers when color is changing to bright white. Can you recommend another led strip? Maybe SK6812 will be better?
Dave · November 23, 2020 at 4:51 pm
If you have access to a logic analyzer you can check if the serial data is being interrupted by the LED latch. Although if the flickering happens when switching to bright white it may be a power issue that’s fixed with a capacitor in parallel. Bear in mind that 115200 is often not the highest baud most hardware supports; although if you’re using only three LEDs I doubt that’s giving you grief.
Any sort of clocked strip is a better option than WS2812B. I’d recommend either APA102 or SK9822.
Michal · November 24, 2020 at 7:18 pm
You were right. It was the power supply. I had 9 leds and Arduino Micro powered from USB port. I thought it was enough.
Today I connected leds to 3A power supply and added capacitor. I guess now everything is ok. This flickering was very subtle and subjective, but now i think it is better and looks very good.
Thank you Dave.