RGB Addressable WS2812 PTH - wiring + code?

Has anyone had any experience using the LED - RGB Addressable WS2812 PTH 5mm Diffused (5 Pack)?

Have tried a few times of the past little while on trying to get them working with a Pico W and had no success so far.

To be honest not sure how to wire them since I’ve tried a few things and likewise with the code.

Thanks in advance :slight_smile:

Which tutorial are you following? This one seems to be fairly comprehensive.

Although they are designed to be linked together to form a sequence, it is quite practical to start with just a single one, to confirm the wiring and the sketch. If you are trying to do it with all five then it is possible that it won’t work if you are powering it with 5V from the MCU. Can you show the wiring you have tried?

Setting the pin correctly is critical - can you show the code you are using to test? The led count is less important, although obviously if you set it to a value lower than the number of LEDS then only that number will show.

On the wiring side it should be something like

But start with just one; that if that works add the 2nd.

You controller should have its ground connected to the led ground strip. Then the controller “out pin” to Data in (DIN) pin.

After that point, it looks like a stock WS2812 data transfer from your controller to the first led.

So if you have a library for that, try it.

Edit:

You may need to tweak the timing in any library

Edit 2
I had a look at the timing difference between these and the WS2812B, we can see it does not full overlap, so different timing will be needed if using a WS2812B code/library.

WS2812 PTH 5mm Diffused (5 Pack)
T0H	0.35 uS +/- 0.15 uS	=> 0.20uS - 0.50uS
T0L	1.36 uS +/- 0.15 uS	=> 1.21uS - 1.41uS	
T1H	1.36 uS +/- 0.15 uS	=> 1.21uS - 1.41uS
T1L	0.35 uS +/- 0.15 uS	=> 0.20uS - 0.50uS

WS2812b
T0H	0.40 uS +/- 0.15 uS	=> 0.25uS - 0.55uS
T0L	0.85 uS +/- 0.15 uS	=> 0.07uS - 1.00uS
T1H	0.80 uS +/- 0.15 uS	=> 0.65uS - 0.95uS	
T1L	0.45 uS +/- 0.15 uS	=> 0.30uS - 0.60uS


Thanks all, was able to get it sorted following the tutorial suggested and didn’t need to adjust the timing (or as of yet atleast). What’s the power pull on these when using them with RPI 4s, looking to use about 7-9 off the board, I assume I may either need to reduce the amount I want to use or use an external supply.

1 Like

Hi Jack

That is a good idea anyway. Saves a lot of bother down stream, particularly if you may want to add at some future time.

Could not find anything on current requirements per LED. The data sheet (if you could call it that) linked is more like an application note. Tells how to wire them and data timing but not much else. Of course current is dependant on quite a few factors but is usually quoted at white and full brightness. That could be 20mA per colour or 60mA per LED. Best practice is to allow for this with all LEDs on. Then you can’t go wrong and should have no bother.
Cheers Bob