How to control the CrowPi 2 8x8 RGB matrix?
I'm looking for more info on how to use the RGB matrix on the CrowPi 2, connected to GPIO26. Where can I find an example script, or who knows which kind of component is precisely used?
On https://forum.elecrow.com/discussion/29/crowpi2-hardware-introduction/p1 point 25, I found this, but this doesn't contain any detailed info...
Output module, this 8x8 (8 rows and 8 columns) RGB module contains an array of 64 LEDs. It can display lights in multiple colors and make various animations
I think I found some info that leads to a PWM interface for WS2811 on PIN 32 = PWM0 = BCM 12.
And can be controlled with https://pypi.org/project/rpi-ws281x/
But I still need to validate and test...
I'm still learning this thing but I suspect the Adafruit_LED_Backpack library can be used to control that. Note that this library is now deprecated and there's a newer version available.
This is the replacement library:
I think the matrix is implemented as a series of 64 I2C devices, each 24 bits long, and it's loaded by pumping 192 bits down the serial I2C bus.
Here's the control chip's datasheet. https://cdn-shop.adafruit.com/datasheets/ht16K33v110.pdf
My bad. @FrankD seems to have it right. I looked into this more and found that the matrix is actually wired as a string of tiny microcontrollers, each with red, green, and blue LEDS to form one pixel. The CPU sends a serial stream of data, 24 bits per pixel, and each pixel microcontroller eats 24 bits and then passes on the rest of the data to the next one in line. The data rate is 800 kHz (1.25 usec/bit), so it should take 64 * 24 * 1.25 = 1920 usec plus a 300 usec low pulse as a start-of-frame, for a total of about 2.3 milliseconds to load the matrix with a fresh image. Be careful to NOT use DMA channel 5 when configuring the Pi, as it will cause SD corruption, according to the library documentation. Use channel 10, instead. (The default changed when this was reported.)
Details about hos it works, with a nice video of similar lights in projects:
Nice article on building your own hardware:
So far I haven't found how to install the base library in Bullseye. It does seem to require root access based on reading the low-level C library, in order to open /dev/mem to create a "mailbox" for kernel access.
Here's the sample code on the system. I wrapped it in a while(True) loop to run continuously. For the upgraded OS, You'll need to install the Python package with PIP from your link above. You need to be root to run this as it requires access to /dev/mem.
Beware of turning on too many LEDs at once at full brightness. If you turn on all 64 to full brightness at once, they'll try to use over 3 amps! Most power supplies can't handle that. At full brightness, each pixel can use 50 milliamps at 5vdc. 50 * 64 = 3200, or 3.2 amps.