I received my 20 meter of WS 2812 LED strip yesterday, with a total of 1200 LEDs, wich I am going to drive with a Teensy 3.1 and a 5V 20A power supply. The LEDs will be installed in a huge square that goes around the whole room (it is for a party room).
Due to the high amount of LEDs, I want to use 2 lines for the output each with 600 LEDs.
In order to avoid to put a 10 meter wire to the second batch of LEDs, is there a way to add LEDs in a reverse order?
To illustrate:
myleds[0] = first LED on 1st data line
myleds[599] = last LED on 1st data line
myleds[600] = last LED on 2nd data line (physically adjacent to 599)
myleds[1199] = first LED on 2nd data line
I read through all the API reference but i did not find any hint.
First, I suspect, but do not know for a fact, that what you ask is not possible.
In any case, you could just call a simple swapping function just before doing any show();
Something like:
void swap(){
CRGB temp;
for (int i = 0; i<300; i++){
temp = leds[600+i];
leds[600+i] = leds[1199-i];
leds[1199-i] = temp;
}
}
Pardon my mediocre programming skills. Something tells me somebody else will come up with a much more elegant, professional programmer like solution but hey… that should work !
For some functions, I found that you can skip the loop. I made a suspender sort of thing with one continuous stand looped around the neck and could use fill_rainbow to split the effect like this:
Just looked it up to get back to you… I was creating an “equalizer” effect and thus wanted the length of the lit “bar” on each side to start from the bottom. Based on an accelerometer, I’d map to the desired height of the bar (variable called “len”) and do this:
NUM_LEDS - len was with respect to my whole strip of 60, so it subtracted the bar height from the far end, used that as the start array value, and then populated len LEDs to the end.
+++ o o o o — o o o o + + +
If I had 14 LEDs (split into halves of 7) and len was 3, it would light up from pixel 14 - 3 = 11 to the end using the code above, which is the same as starting from the far end and lighting up 3.
I think the flip function above will work better if you’re not using canned functions that can take an array start index like fill_rainbow(), but wanted to add this just in case it helps
Hi @Sebastian_Stuecker , that would work of course but I was thinking about your setup and would definitely go for a programming solution myself.
Actually, if I was doing that ‘Party room’ with the strips you have, I would probably split my 1200 LEDs in 8 X 2.5 meter strips and run each from a separate pin of a OCTOWS2811 adaptor that sits on the Teensy 3.1.
Separate power wiring to each 2.5 meter stubs as well and still have the 4 stubs reversed to shorten the wiring AND deal with the LED addressing in SW rather than HW !
Hi Roy, thanks for the feedback. Why would you split in 2.5 meter pieces for the data part? What is the benefit over, lets say, just drive each 5 meter strip seperately? (if I split into 2.5 then it does not matter with the software solution any more because i need a lot of twisted pair cable anyway, because the setup is a closed loop )
For the software part, I want to use a lot of different patterns and select them via serial input etc. so I would like to treat the whole setup as one big array at the end of the day. If the teensy is fast enough to do some reversing in some routine that is called each time, ok, then I would probably not care. I will try as soon as I have my Teensy 3.1 and the OctoWs Adaptor - right now I am just working with an Arduino Yun and therefore its limited to around 600 LEDs.
so long question short. why 2.5 meter and not 5m or 10m. thanks!
Hi @Sebastian_Stuecker ,
Hi +Sebastian Stuecker,
I suggested 2.5 meter lengths because that is the result of dividing 20 meters into 8 pins (as available on the OCTOWS2811) thus using the parallel output capability of the OCTOWS2811 to it’s maximum.
1200 WS2812 LEDs on a single pin takes 36 milliseconds to update. Unless you use some kind of parallel output mechanism, you would not be able to update that many LEDs more than about 27 times per second. I find that this is not enough for most animations to be smooth. By using the OCTOWS2811, with it’s 8 output pins you could update all your LEDs about 200 times per seconds.
Definitely, the Teensy is fast enough to make any simple manipulation of data insignificant compared to the time required to update the LEDs.
Hi again,
I will give you a very simple situation to help visualize the value of using the full potential of the OCTOWS2811’s parallel output. As mentioned, you can’t update 1200 WS2812 LEDs more than 27 times per second unless you use some kind of parallel output.
Say you want a single dot (or any pattern) to move around your room, and you want it to move smoothly from dot to dot. Your dot or pattern would take 1200 / 27 = about 44 seconds to go around !!!
Now with parallel output, that same dot will probably take closer to 6 seconds. Of course you can speed that up by skipping every odd pixel or 2 or more but you can see that some smoothness is lost.
I agree with using all 8 channels on the Octo and would connect the second set of 4 in reverse to reduce wire length a little. Do make sure you use twisted pairs though, I usually strip down cat5 for this.
Then just use a conversion function when setting the leds. For your 1200 led example you could do this:-
int IndexToPhysical(int i)
{
if (i < 600)
return(i);
else
return( (i + 149) - (i % 150) );
}
Then to use just do this:
myleds[ IndexToPhysical(i) ] = CRGB:Black
Thanks again for the comments, I really appreciate it. The example with the moving pixel makes it very clear (because normally you think “why would I ever want more than 25 FPS” ). In fact I will use CAT5 since its very cheap. I will send a video once I have everything setup (which is probably not before mid november)
Last word of wisdom here… in my humble opinion, you have seriously underestimated the power supply requirements for your project.
From experience, I find the ws2812 device draws about 45 milliamps each if you turn them on full brightness white (Many here actually use 60 milliamps max current per WS2812 in their calculations.) If you ever try to illuminate your room with a blinding bright white light, you may request 1200 X 45 milliamps (IE: 54 Amps!!) from your 20 Amps supply.
A good PSU would simply shut-down using it’s over-current protection mechanisms but I dunno about any cheap ones !?
You could of course make sure that your sketch never exceeds that 20 Amps current but I find that wasteful to have so many LEDs and not be able to fully use the available light output.
In your case, if possible, I would get 3 more PSUs (yes, 20 amps each, it does not hurt to have extra current available !) and distribute them such that they power 2 strips each !
Last recommendation (maybe… you need to be very very mindful about voltage drop on the high current 5Vdc wires AND the actual voltage drop along the strips !! This is true in all cases but most critical if you decide to go for the single 20A PSU solution.
Have a look here to calculate voltage drops on wires based on wire gage, length and current:
Hi @Aaron_Liddiment , I just knew there was a smarter way to do this although I think that this line is not right…
return( (i + 149) - (i % 150) );
I think this would work…
return (1799 - i);
Anyways, I understand the method and would appreciate if you could help me with understanding how I could verify the efficiency of one method versus the other !?
Your solution definitely looks more efficient but how could I actually test that !? Are there tools that I could use !?
The 149 / 150 is for 8 strips of 150 leds with the last 4 being wired in reverse. If you were just feeding 2 strips of 600 you would use 599 / 600.
The best way to verify efficiency is to examine the assembler output from the C compiler, but this is not so easy with the Arduino dev environment. So I usually just resort to using an oscilloscope and a digital output to measure the time for a portion of code.
On the power side, I would agree with you @JP_Roy , I am making a sign with 24 x 144 leds using 18 awg wire and have found to get full bright white I need to power the strips from both ends and that it will draw just over 6 amps per strip.
when i wrote 20 amps it was a mistake I actually do have a 40 amps power supply (unfortunately it makes quite a lot of noise because of the fan)…i realize i might have to add another one. actually i am getting afraid of this monster with all the wires so close to each other and inside of the strip…not sure how it “looks like” should this thing ever be shortened.