3 ms·
So I finally got around to writing about a project using the Raspberry Pi to power a panel of WS2812b LED's. Let me know what you guys think.
by slicedbrandy 7y ago
So I finally got around to writing about a project using the Raspberry Pi to power a panel of WS2812b LED's.
Let me know what you guys think.
- timClicks 7y agoReally cool! Thanks also for taking the time to take photos and add figures.
- drtse4 7y agoJust FYI, since I've implemented something similar in Swift, using the PWM you would have had to implement more or less the same algorithm, i.e. changing the duty cycle of an high frequency signal to generate these "slot-based" patterns that identify the 0s and 1s of the WS281x (there are minimal timing differences between the variants) protocol. Note: God bless the Oscilloscope, essential for these projects.
- JoshMcguigan 7y agoThanks for sharing. One question about the code, why does the LedPanel struct use a String as a buffer rather than using a Vec<u8>? edit - I think I see the reason now. Using a string made it easy to print the u8 as a string of bits, which you could then iterate over using chars. This was used to help perform the conversion from bits directly representing colors to the on the wire representation.
- slicedbrandy 7y agoThat would certainly work as well, and ultimately it does get converted into a Vec<u8>. I did consider just having the buffer as it from the start, but by using a String it was just a little more intuitive when it came to pushing more bits onto the buffer, as well as doing the padding operation at the end. More just to reduce complexity during development than anything I guess.
- JoshMcguigan 7y agoI may have overlooked some things, but I made a quick PR[0] just to see what this would look like using a Vec<u8>. Feel free to close if you prefer the original. [0]: https://github.com/tomarrell/rasp-ws2812b/pull/2 https://github.com/tomarrell/rasp-ws2812b/pull/2
- xgbi 7y agoUnrelated, but how did you draw your curves/charts? They look fantastic.
- slicedbrandy 7y agoThanks! I drew them using Notability on an iPad, then exported the document as a jpeg and cropped them out.