skyfan
Posts: 3
Joined: Mon Dec 16, 2019 2:19 am

Driving Lots of WS2812 LED Strips

Sat Dec 21, 2019 12:51 pm

Hi,

I'm working on a project where I want to control a number of 30-LED (WS2812B) strips in parallel. At the moment, I'm using the GPIO18 PWM0 pin on a RaspberryPi (Model b Rev 2) to test my code on a small WS2812 strip, and that works fine, just using the power from the Pi. I’m using the library from https://github.com/jgarff/rpi_ws281x to drive the individual LEDs.

In my actual project I want 19, metre long (i.e. 30-LED) strips, and I want to animate them all in parallel. I'm only currently running them at about 10% brightness, but I'm wondering about how much power I need to be able to run this. At any point in time, there will only be about 15 LED's running per strip, and most of the time none at all (the animation will be triggered by a button and runs for about 5 seconds).

This is all for a costume, so I'm trying to work out how to wire this, and power this portably. My Pi, I think only has a single PWM pin, so that means I either need a newer Pi with more PWM pins, or I think I have to run all 19 strips with the data lines connected in serial (meaning more wiring, and distance for the data line).

Here is a rough diagram of how I think I need to wire it up.

Image

(p.s. yes, I know the image only shows 18 strips)

Originally, I was hoping to power them all in parallel, and run (say) groups of 4 or 5 strips per PWM line (because I thought there were 4 on the Pi, not 1), but I'm no longer sure I can do that unless I have a Pi or other device that can drive multiple data lines.

Power

So if I understand correctly, I have 570 (LEDs) * 50mA (per LED) * 0.1 (brightness) = 2850mA which I think is 2.85A. Is this correct, and is it a reasonably accurate way to estimate the power I’d need?

If so, it seems to me that I need to connect all 19 strips in parallel to the power, and then drive their data lines from the Pi, or other device. By putting the strips in parallel for their power the amount of power required I think should be less.

Data

Even if I assume I can power the 19 strips, I’m still not sure about controlling them all via that single PWM line (GPIO18). The more I read, the more uncertain I am about the ability to drive separate strips without having to run the data-out from each strip to the data-in of the next one, which means (in my project), a length of wire between the strips (35cm at the outer edge in the image, and 6cm at the centre). So all up, to put the data of all 19 strips in serial like this, I’m looking at, I think, around 23 metres of data line, and that seems like a lot to me, making me worry that the data signal is going to degrade resulting in the animation not working consistently along the entire length of the data line.

The animation on each of the 19 strips is to be identical, and run at the same time. Is there a way to drive all 19 data lines in parallel, like have a single signal from the Pi/other device that controls each of the 19 separate strips as if they are a single strip?

If not, and there is a way to ensure that the 23 metres of data line is OK, then it's just going to be some tricky programming, but that, I do know how to do.
Regards,

SkyFan

User avatar
rpdom
Posts: 20382
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Driving Lots of WS2812 LED Strips

Sat Dec 21, 2019 1:37 pm

You should be able to drive the data in pin for each of the strips from the same PWM GPIO output if you connect them all together. I don't have a datasheet to hand, but I'm certain the data line uses very little current. You will also need to connect the 0V line from each of the strips to a GND pin on the Pi.

I would recommend powering the 5V on the strips from a separate power supply to the Pi itself, with the 0V commoned between the Pi and the power supply.
[edit]
Now I do have a datasheet to hand and it says that the data line takes up to 1uA, which is negligible. If that is correct, then in theory you could control over ten thousand strips in parallel from the one GPIO pin.
Last edited by rpdom on Sun Dec 22, 2019 5:29 am, edited 1 time in total.
Unreadable squiggle

Roger
Posts: 7
Joined: Tue Nov 15, 2011 9:40 am
Location: Essex

Re: Driving Lots of WS2812 LED Strips

Sat Dec 21, 2019 4:07 pm

When I measured the current drawn by 30 WS2812Bs coded with fffff ('white' full on) they drew 1.12 amps. Maximum number of WS2812Bs I have in a string is 150 and I use a 10 amp power supply. I have a number of strips of a 100 running off 5 amp power supplies. I power my pizeros from the same power supply as the LEDs using the pizero’s GPIO Header. The data control signal is reshaped before being passed on to the next WS2812B, each WS2812B removes 24 bits of data for its own use before passing the rest of the data on, I drive straight from a GPIO pin. Before I added extra five volt power at 50 and 100 devices I found the devices stopped operating as they became further from the start of the string. I have never tried to use one data signal to drive multiple WS2812B in parallel, I have always gone from DOUT to DIN in a serial manner. I can see no reason why parallel shouldn’t work. I get the impression WS2812B characteristics vary, one specification I’ve seen says 1 micro amp for the DIN current, indicating a GPIO pin should be able to drive multiple WS2812Bs in parallel. Some of my strips have almost 2 metres between pizero and first WS2812B DIN. As yet I have no strings with a significant distance between a DOUT and DIN of the next devices.

User avatar
rpdom
Posts: 20382
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Driving Lots of WS2812 LED Strips

Sat Dec 21, 2019 6:13 pm

I have a Pi Zero that drives a strip of 60 WS2812. The strip is connected to the Pi by about 5m of 3-core 2A mains cable. The Pi is powered by a Pi 3 PSU via a 3m cable (in addition to the PSU's standard cable). It runs reliably with all LEDs at full brightness (It's hooked up to my doorbell and the LED strip is above my front door, so that the LEDs fade up to full white brightness when the doorbell is rung, stay that way for a few minutes, then slowly fade out again).
Unreadable squiggle

skyfan
Posts: 3
Joined: Mon Dec 16, 2019 2:19 am

Re: Driving Lots of WS2812 LED Strips

Sun Dec 22, 2019 4:29 am

Thanks @rpdom and @Roger, those are both helpful and encouraging responses. I guess my next thing is to buy a 5M reel, cut it up and run some tests.

Being able to run the data lines in parallel will simplify the software considerably.

Putting them in serial means that the physical orientation of every second strip will be reversed, so that means my code will need to animate the pixels on those strips in the opposite order for it to look synchronised.
Regards,

SkyFan

skyfan
Posts: 3
Joined: Mon Dec 16, 2019 2:19 am

Re: Driving Lots of WS2812 LED Strips

Wed Jan 01, 2020 9:29 am

Turns out, it works a treat. With a single reel of 150 LEDs was able to drive it with my power supply, though python on my Pi was too slow to keep up with the frame rate.

So I cut the 5M strip up into 1M pieces, I then tested 2 in parallel so that the single PWM line was driving the data-in of both strips.

I was able to drive both strips of 30 LEDs perfectly in synch, and the frame rate was back to normal because the python code only needed to drive 30 LEDs instead of 150.

So I'm feeling encouraged enough to start wiring this up to drive 5 strips and then if that works still, I'll buy the other strips.

Again, thanks for the help.
Regards,

SkyFan

Return to “Beginners”