1

I am trying to understand the simplest ways to power a short LED strip of 30 WS281x lights.

Most of the instructions I’ve found mention using a separate power supply for the LED’s, but is it possible to simply use the GPIO outputs for power, data and ground? I’m working with an RPi Zero W.

With a limited number of LED’s, I wonder if this becomes a viable option, but I would like to understand the trade-off’s.

My question is sparked by flickering I’ve been seeing when trying to render colors with the LEDs soldered to the RPi Zero W.

I have a suspicion that because I’m attaching the LEDs directly to the GPIO, the LEDs are susceptible to voltage drop caused by changing CPU usage.

3
  • Is WS218B a real thing or a typo? Do you by any chance mean WS281x ...?
    – Ghanima
    Commented Apr 14, 2019 at 14:48
  • @Ghanima yes, edited. Commented Apr 14, 2019 at 14:50
  • You do need a separate power supply. The LED strip will draw too much current and probably damage your Pi if you power it direct from the GPIO.
    – CoderMike
    Commented Apr 14, 2019 at 15:05

1 Answer 1

1

There are separate issues at work here:

0) The individual LEDs of WS28x LED strips are enabled by an on-board control circuit. This way the LEDs themselves are technically not directly connected to the GPIO pins. The current limit of GPIO pins is therefore not a problem. Power and data lines are separate.

1) The LED strip - to be technically correct - is therefore not powered but controlled by the GPIO pins. However if the LED strip is connected to the power pins on the 40 pin GPIO header all the current the LEDs require needs to be routed through the traces on the Pi's. 30 LEDs with 50 mA each amounts to 1.5 A in total. That should be in the realm of the possible. The max amperage of header pins is listed with 1 through 3 A (depending on which product you look) and the current rating of the Pi's 5V header pin is about 2.5 A, see Raspberry Pi Power Limitations with the caveat that the Pi Zero got no Poly-fuse; still I would argue that it is safe to assume a current carrying capacity in the same range anyways.

See also: Powering WS2812B LED strip from Pi brownouts

the LEDs are susceptible to voltage drop caused by changing CPU usage.

I would not expect that to happen, unless the power supply itself cannot provide the current. According to Raspberry Pi 3 vs Pi 2 power consumption and heat dissipation we would expect a change from 0.1 A (idle) to 0.25 A (under load), add another 70 mA if WiFi changes from inactive to active, see Power consumption of Pi Zero W?. So the change is quite small compared to the LEDs' current.

Best bet is to check the power supply's capacity and the wiring from the supply to the Pi (many questions here deal with low quality and low cross section USB cables).

2) It is noteworthy that the WS28x have 5 V logic levels. This WS2812B datasheet list 0.7 * VDD as minimum high level. With VDD = 5 V that's 3.5 V which is higher than the Pi's maximum high output level of 3.3 V (let alone its specified minimum high output level). The use of a 3.3V to 5V logic level converter is highly adviseable.

See also: Powering up a WS2812 led strip with different power supplies

3
  • Thanks for the detailed response, Ghanima. In terms of wiring, I have a CanaKit micro USB charger plugged directly into the Pi, and then I use pins 2, 6 and 12 for power, ground and data (respectively) to the LED strip. Also, in practice, I only end up using 24 of the LEDs. What is the risk of not using the logic level converter in this case? Commented Apr 14, 2019 at 19:55
  • The GPIO pin #2 is labeled as 5V—does this still cause an issue with the Pi's maximum level of 3.3V? Commented Apr 14, 2019 at 20:51
  • @charliesneath, exactly 5V is the power pin of the Pi (as supplied by the USB cable) and also the power line of the LED strip. The 3.3V is the voltage of the GPIO pin used as a data line to control the LED strip. If the LED's controller (as the data sheet suggests) is a 5V logic it might or might not work properly, as the output high of the Pi is "not high enough" for the LED to detect it. As goobering's answer has it: (I've had mixed results)
    – Ghanima
    Commented Apr 14, 2019 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.