How many LED lights can 1 Raspi control

integrated-circuitled stripraspberry pispi

I asked a question on Raspberry Pi Beta regarding Using one Raspi to control long (>100ft) of 5V LED strip, one answer in particular I found this answer useful, with a further comment which advised me to seek more specific information here:

IC means Integrated Circuit … To find out the max amount of LED's you need to
figure out how much data you can send on 25Mhz, then how much data is
actually sent. You need to find out this. It could be 255. But using
SPI extenders it can be 255 x 16. This is all different that what you
area asking.

Therefore, my question is this: ignoring powering for the moment, how many LEDs can one single Raspberry Pi control using the below LED strip, also, if SPI extenders are necessary, what are they and how do I use them:

enter image description here

  • 5M WS2801 Blcak PCB 32LED 5050 RGB Digital LED Strip Individually Addressable 5V
  • item: nonwaterproof black pcb ws2801 led strips
  • Model: 5050RGB WS2801
  • Working voltage: DC5V
  • LED Type:SMD5050 RGB
  • Led Qty: 32 led per meter
  • Wave length(NM):R-650mcd, G-520mcd,B-460mcd
  • Power(W/M):9W/M
  • IC: each led controlled by one WS2801 ic chip
  • Scale:256
  • View angle:120 degree
  • Life span:no less than 50000hrs
  • Packaging:5M/reel in antistatic bag
  • NONWaterproof

EDIT: The project involves installing accent lighting in a large area whereby it is sometimes difficult or impossible to hide and/or wire bulky AC-DC power supply units or raspberry pi units (which themselves need USB adapters). Ideally I would like to have 1 raspi and 1 power supply. The raspi would be connected once, and the power supply could be wired at 2m intervals. If this is not the case, I have to start hiding multiple power supplies and start networking multiple raspis, both of which make the project more complex.

Best Answer

WS2801's take 24 bits from the data stream and passes the rest to its output. In theory you could control a very large number of LEDs, but in practice, you are limited by data integrity, transmission speed, etc.

In my experience, controlling 170 LED's is common with these kinds of strips, because that works out to be 510 8-bit values, which fits within a DMX-512 "Universe" (which supports 512 such 8-bit values).

I have successfully controlled 300 LEDs in a strip of WS2811's (a 5-meter length with 60 LEDs per meter, similar to WS2801 except they aren't pure SPI, and the IC is actually inside the 5050 LED package) using a custom ARM-based DMX-to-WS2811 decoder. However, I don't recommend it because of latency. In my application, I needed to change all LEDs at the same rate as a video source, about 30 times per second.

With 32 LEDs/meter, you should be able to run approximately 5 meters on a given output, if you limit it to < 170 LEDs.

Voltage Drop

The voltage drop on a 5V LED strip (especially with the 0.5 oz. copper they are usually made from) can be significant. If you only provide power at one end of a 5 meter strip, LEDs driven white will not appear uniform. LEDs at the power-end of the strip will appear white, while LEDs further away will start to appear tinted pink or cyan. The manufacturer recommends providing power at both ends of the strip, but even then there is a gradient. Typically these LEDs require ~60mA at full white, so a 5 meter strip (160 LEDs) will require 9.6A, which is quite a bit when you consider that the power leads are often only 16 or 18 AWG. I recommend providing power at 2- or 3-meter intervals if possible, but it depends on your application.

Raspberry Pi: SPI Ports

According to the Raspberry Pi Education Manual (pg 130), the device has "five pins available to connect devices to the Raspberry Pi using SPI." One site indicates that:

The Raspberry Pi only implements master mode at this time and has 2 chip-select pins, so can control 2 SPI devices. (Although some devices have their own sub-addressing scheme so you can put more of them on the same bus)

Of course, you could probably "bit bang" your own SPI using other I/O pins, but I'm not familiar with the Raspberry Pi so I can't say what the performance would be like. Ultimately, you could control many lines using a single Raspberry Pi, but the speed at which you refresh or change the LED colors is subject to change.


Unfortunately I am not experienced with SPI extenders, so I cannot advise on the use of them. Perhaps someone else can address that part of your question.


Edit:

DMX

Per your edit: For slower refreshes like 5 Hz, it gets much easier (compared to maintaining 30 frames per second to match a video source). You might want to consider using a differential signal (like DMX) instead of SPI, which would allow you to control strips that are physically distant from a controller. SPI is quite limited on distance; if you think about it, the WS2801's act like repeaters, ensuring signal integrity down the line. If you want all LED strips to have the same color and brightness, then you don't need to treat a second strip differently from the first: you can send both strips the same information. Using DMX simplifies things because of its flexibility and use in the lighting industry.

For example, you would run say 5 meters at a time, giving each a DMX-to-SPI converter. You could then have each strip on its own universe if you still needed to individually control LEDs. Alternatively, you can have them all on the same universe, and they will all respond together. Thus, you could have a gradient from say blue to red on strip #1, and all strips would repeat the pattern. You can make your own DMX-to-SPI converters or get ready-made ones (for example the inexpensive "miniDMX 2801" available on eBay). I would recommend investigating how you could send DMX data using a Raspberry Pi.

If you assign each strip a different universe, you can then send unique data to each one. You'll have to calculate whether you have time to send all of the information needed in 1/5 s.

SPI

When you send data using SPI, the WS2801 waits for a 500μs or longer low level on the CLK. Once that happens, it latches the first 24 bits and then relays anything else. I am not sure how many of these in sequence you can actually connect. In theory, it would be however many bits you can send in 1/5 second (before the next frame is needed). However I wouldn't realistically expect this to work well for long runs (>500), but I could be wrong.

Power

Regardless of how you send data, you still need to provide power at regular intervals such that you are satisfied there are no color inconsistencies and you're not overloading any wires.