Arduino FastLED Project Problems and Solutions.

Published on 24 January 2025 at 12:02

Having only started about with microcontrollers a couple of months ago I am still on a pretty steep learning curve but have successfully done a few simple projects at home including a scrolling text LCD display, some simple led based light displays and some messing about with something called FastLED. It's kind of hard to describe to non electronics type folk but its a combination of a long string of chips with LED's called neo pixels and some software running on the controller. The strip comes in a reel, you can get them with either 30, 60 or 90 LED's per meter, I think I saw one with 120 too but I use the ones with 60, they look fine and don't take too much current, although a full string at full brightness on white will take an absolutely massive 18 amps at 5 volts!! Fortunately you can limit this by turning the brightness down and by not having all leds on white at the same time. I found that the average pattern running 300 leds takes about 1.5 amps, much more manageable. I also found that reducing the max output from 255 to about 175 halved the current but didn't make a massive difference to the output of the LEDs, fortunately the software allows you to set max brightness.

Every individual neo pixel has 3 leds in it- one red, one blue, one green, each one's brightness can be individually altered to give any colour at any intensity. To do that you fire a 3 x 8 bit data stream at each pixel in the string,  each byte has a value of between 0 and 255, which determines the intensity of each led. For example 255,0,0 turns the red led on full bright and the green and blue remain off. 0,255,0 turns the green full on and red  and blue off, 255,255,255 would turn all 3 on full whack and so you would get white light from that LED. The clever bit though is how the first led of the string strips off the first 3 bytes and then sends the rest of the packet down the line. The next one strips off and uses the next 3 bytes and sends on the rest and so on. My strips are 300 LED's each so the first led gets 900 bytes, the next, 897, the next 894 and so on until the very last LED in the string gets it's data and does it's thing.

Anyway I was telling my mate Malc about all this and he asked me if I could do something to add colour and interest to the American themed diner at his bowling alley - a great opportunity to actually do something useful, practical and profitable, how could I possibly refuse?

The diner is approximately 15 meters by 15 meters, Malc wanted the lights so they were chasing, originally there was going to be one long string round 3 walls but then he rightly suggested having 2 strings going half way round, one chasing left to right and the other right to left. I had to agree that it would look good like that, I knocked up a test pattern or 6 to see what he liked best and then picked a pre existing pattern from the fastLED library that I thought he would like even more. There are libraries available for most things these days, there is a superb web site called Github where people deposit open source stuff that other sad old gits have ready access, there is an unbelievable amount of stuff for aurduino controllers on there. Running a library within your code allows you to easily call pre programmed functions - in the case of fastLED 56 different patterns, without you needing to know the maths and so on to make chasing light patterns work - you just need to know how to all them from your program or sketch as they are called in the world of Arduinos.

Anyway, I had purchased 8 strings of hermetically sealed LED's probably a bit overkill but they are only a couple of quid per string more than the unprotected ones and you will inevitably get steam and airborne grease in a diner, they will need cleaning every now and again so they seemed like a prudent purchase. I purchased 3 x 10 amp power supplies so I could split the load and run the LED's at high brightness. I tested everything at home and then me and Russ spent a day moving furniture and sticking led strips to the walls right up high near the ceiling. We had to clean the walls before the strips would stick properly, we found the super strong detergent normally used to clean the bowling lanes did the job perfectly.

Next day I went back and fitted one controller in the ceiling void, my intention was to run all 8 strings of 300 led's from the single controller, there seemed to be no technical reason why I couldn't do that. We connected up one power supply and 2 strings first to make sure it all worked, it did but there was an annoying intermittent flashing on the second string that I couldn't understand. It was when we went to add extra strings that things really went pear shaped.

FastLED experts tell you that you need to put a 470ish ohm resistor in series with the data line to help make things reliable but I couldn't understand why that should be the case, I tried with and without it made no difference. It was also suggested that a capacitor installed on the power lines right next to the led strip would be a good idea too - it probably is but it made no difference in our case.

What I found was there was a massive 3 phase cable in the roof void running right the way along the length of the diner, it seemed to be inducing a massive amount of noise in to the data line, every time we tried to introduce a third line the whole lot went tits up, most perplexing. What I found was by adding a terminating resistor I could improve performance somewhat but it was seemingly a bit hit and miss. I didn't have the spec for the arduino with me so didn't know what the max output current was, I now know it's 20-40milli amps. I started cautiously with a 10 k resistor, which made a small difference but it was still not right. As I only had 10 k or 330 ohm resistors with me I put a second 10 k in parallel and things then looked a whole lot better with only the very occasional bit of weirdness to ruin my otherwise splendid afternoon. I put another resistor in parallel so now I had about 3.3k going from the data line to earth and it worked perfectly, it meant I was only pulling about 1.5 milliamps but it was enough to crunch the very low energy of the induced noise. I could go much lower, the 330 ohm resistors I had on me would have given about 15 milli amps, which would have been within tolerance, although I didn't know that at the time and didn't want to blow the controller. Next time I go back I will put 1k's in instead, which should do the job splendidly.

I need to add more power supplies, I also need to add a bit of resilience so will now have 4 arduinos and 4 power supplies, each controlling one pair of strings, each data line terminated with a 1k resistor to earth. That'll do it.

I am a bit surprised nobody seems to have encountered and solved this before, I found numerous threads where folk had encountered strange problems, I have concluded that most folk that play with these things are software gits rather than hardware gits. Just about every thread I found on github and elsewhere suggested software bugs, my experience definitely suggested otherwise.

Anyway, I am waiting for some  bits now so I can go back and finish the job,I will do a video when it's all working. I was extremely pleased though that when we had the 2 strings running several customers took the time to say how cool they thought it looked, I hope they comeback and see it when it is all fully up and running. 

Add comment

Comments

There are no comments yet.