I recently purchased quite a few parts for a school project (LED lamp) I bought a screen for my Rpi 3b+ (works flawlessly) a strip of WS2812B LEDs (1M RGB LED Strip - WS2812B 144 Per Meter - Black Strip - Weatherproof | Core Electronics Australia) and some other bits and bobs. My plan was to use my rpi zero to control the LEDs via this flask through Apache app- GitHub - naztronaut/FCW: Flask Controlled WS2812b LED Strip. I successfully was able to run the web server, but when I went to run it with my LEDs they just would not turn on- I reinstalled, checked logs- the thing I found was that the website/code was failing to control the LEDs- I am planning to only run them for 10cm or so and I concluded I wouldn’t need an external power supply (can someone tell me if I can cut this strip as well). I then followed the core electronics tutorial- and strandtest.py failed as well- I have no idea what has happened, and I know that my GPIOs are not faulty as they work fine with my screen- I have also tried it on my 3b+.
Please check your power supply. WS2812B LED strips require a separate power supply in addition to the control signal from the Raspberry Pi. The power supply is needed to provide sufficient current for the LEDs to function properly. It’s unlikely that the Raspberry Pi’s GPIO pins can supply enough power for the entire LED strip. Make sure you have a suitable power supply connected to the LED strip. Cutting the strip into a smaller length shouldn’t be a problem, but make sure to provide adequate power for the LEDs you’re using.
And since you have an LED strip now, you may want to do some other projects with it. Here is a Pocket RGB light using Arduino and WS2812B:
Thanks- I think I’ll cut it to around 10cm or so, the rpi should be able to power it.
Each WS2812B LED can draw up to 60 milliamps (mA) at full brightness (all three colours—red, green, blue—on at the same time). That’s a total of 20mA per colour. Now, since you’re using a 1-meter strip of these LEDs with 144 LEDs per meter, if you cut it down to 10cm, you’ll be left with around 14 LEDs (since 10cm is roughly 1/10th of a meter).
Now, let’s work out how much power you’d need to run those 14 LEDs at full brightness:
14 LEDs * 60 mA/LED = 840 mA
So, you’ll need about 840 milliamps of current. The 5V GPIO pin on a Raspberry Pi can supply a maximum of around 50 mA, which is far less than the 840 mA you’ll need to run those 14 LEDs at full brightness.
Even though you’re only planning to light up a 10cm strip, the Raspberry Pi’s GPIO won’t be able to provide enough power.
I think it’d be a good idea to use a separate power supply, but I could be wrong.
Welcome to the forum and thanks for posting some photos of your setup I think I can spot what the problem is.
Data only flows one-way down the WS2812B strips so you need to make sure your data is connected to the right end of the strip. One end will have a Data output pin instead so that these strips can be daisy chained together.
As for cutting the strips, you should be fine as long as you cut along the centre of the copper pads.
This isn’t quite correct, the combined current output of the input and output GPIO pins can’t exceed 50mA, but the 5V pins are just a passthrough of the power supply that is connected to the Raspberry Pi.
Provided your Raspberry Pi and LED strip combined don’t exceed the current rating of your power supply you should be ok without an external supply. Most Raspberry Pi LED projects will need an external power supply though since LEDs draw a lot of power so by the time you’ve got a Pi and a few USB accessories there isn’t a whole lot of juice left to also run a high power LED strip.
For 10 LEDs and an official Pi power supply you should be ok, just as long as you don’t have too many other devices also connected to the Pi.
Also, if you’re getting into WS2812 projects I can’t recommend this guide enough, it is fantastic and covers everything you’ll need to know.
I’ve Got them working now- very responsive and bright. Thanks for your help- Sam
Great to hear it was just a quick fix and your project is back on track
We’d love to see some photos of the finished LED lamp once your school project is finished.
Have you checked the power supply?