plan44 / plan44-feed

OpenWrt feed containing plan44 packages
29 stars 9 forks source link

p44-ledchain: Unexpected behaviour with SK6812 LED strip #5

Closed r3dDoX closed 4 years ago

r3dDoX commented 4 years ago

Hi and first of all thanks for the awesome "p44-ledchain" driver. I just installed it this weekend on my new Onion and was able to get my LED chain working in a couple of minutes!

I have something that I don't quite understand though. I bought this product: https://www.brack.ch/m5stack-sk6812-rgb-led-flex-strip-50-cm-1008233?query=sk6812&redirected=1. Which should be an SK6812 with RGBW LEDs. So I installed it on the onion with the command: "insmod p44-ledchain ledchain0=0,72,4. Attached the 5V to the "+" pin, the ground to the "G" pin and Pin 18 of the Expansion Dock to the "S" pin of the LED chain. I then wrote 4 bytes to the "/dev/ledchain0": "\xFF\x00\x00\x00" and expected a red first LED. But to my suprise it was green. So I tried all 4 bytes and found out, that the 4th byte is not white but already the next LED. After testing a while with all the LEDs it seems that they only take 3 bytes (GRB) but I need to finish the stream with an additional byte of "\x00". For the whole strip that means I write 72 * 3 bytes plus an additional "\x00" in the stream to get all of them glowing in the color I want.

So my basic question is, did I misunderstand the SK6812? Is there differences in SK6812 LED strips that I didn't see in this product? Did I use your driver wrongly or is it just a little bug?

r3dDoX commented 4 years ago

83B2AB5A-DAE2-4DD0-BE19-A8FFB0C69CCF

I took a closer look at the actual Pixel and can‘t see a dedicated big white section as I expected to see. So maybe I misunderstood what SK6812 stands for?

plan44 commented 4 years ago

Hi @r3dDoX, It seems to me that the LED strip you got is in fact only RGB, not RGBW :-( On the brack page they only say "RGB"...

I'm not sure what chip names those LED strip manufacturers use, and maybe there's a SK6812 variant that is only RGB, like the WS2812/13. Having green as the first channel very much looks like WS2812/13 GRB byte order. The only specs I have is a half-chinese half-english datasheet from Dongguang Opsco Optoelectronics, and there they name the chip "SK6812RGBW". All the actual "SK6812" led strips I bought so far were RGBW.

I'd try to use WS2813 mode with your strip and see if it behaves correctly with that. Also, looking into the LED chip with a magnifier might help, if the chip actually has a white LED, you should see a part of the chip glued over with yellowish phosphorescent.

plan44 commented 4 years ago

Ah, I just found a page that explains it: apparently there are SK6812 strips that work like WS2812/13...

r3dDoX commented 4 years ago

Thank you very much for that quick and thorough analysis.

Yeah I was under the impression that SK6812 are meant to only be RGBW so I didn't check all the details since I expected them to specifically be RGBW. But as you can see in the picture above, it definitely has no white section on this LED, so I will try the WS2812/13 modes. Thanks for helping me :+1: