heavily inspired by the c-base matelight by jaseg, "just" shrunken down
Raspberry PI 3B+ powered LED matrix with the same resolution as the c-base matelight with 16x40 LEDs. Fun fact, when you buy a ten pack of 8x8 matrices, you get the same amount of LEDs = 640 of them.
We had an event with short talks at the xHain Hackerspace recently and we wanted to use the club matrix as a timer for the presenter. I have yet to write a font generator and a script to do that though and the only thing I can kind of reliably do is playing a video. The sane solution: search on youtube for a 15min countdown video, which kind of worked.
But since we were at the hackerspace, one member wanted to try to let ffmpeg generate the countdown. The first version of the script by Niklas was almost perfect, but used a PNG as a background image. Then another member (danimo) took a look and removed the background image and let ffmpeg turn the background from green to red in the last minute.
We had an event with short talks at the xHain Hackerspace recently and we wanted to use the club matrix as a timer for the presenter. I have yet to write a font generator and a script to do that though and the only thing I can kind of reliably do is playing a video. The sane solution: search on youtube for a 15min countdown video, which kind of worked.
But since we were at the hackerspace, one member wanted to try to let ffmpeg generate the countdown. The first version of the script by Niklas was almost perfect, but used a PNG as a background image. Then another member (danimo) took a look and removed the background image and let ffmpeg turn the background from green to red in the last minute.
When I finally found the error in this function, I had already written a lookup table for all the 640 LEDs. This is fixed for my setup, but it should be possible to rearrange it for others.
int matrix_arrangement[] = { 0,1,2,3,4,9,8,7,6,5 };
voidclub_matrix_render(void)
{
for (int i=0; i<led_count; i++)
{
int led_real_x = i % width; // 0 to 39int led_real_y = i / width; // 0 to 1int matrix_number_x = led_real_x / 8; // should be 0 to 4int matrix_number_y = led_real_y / 8; // should be 0 or 1int matrix_number = matrix_number_y * 5 + matrix_number_x; // 0 to 9int matrix_x = led_real_x % 8; // 0 to 7int matrix_y = led_real_y % 8; // 0 to 7
ledstring.channel[0].leds[matrix_arrangement[matrix_number] * 64 + matrix_y * 8 + matrix_x] = matrix[i];
}
}
Club Matrix | From 10 x 8x8 LEDs to 40 x 16 LEDs
2019-12-24 19:30:18
So this took me a while. The library that I'm using stores the matrix data in a one dimensional array with the length of 40 * 16.
Each LED matrix is 8x8 and are connected in that order:
When I finally found the error in this function, I had already written a lookup table for all the 640 LEDs. This is fixed for my setup, but it should be possible to rearrange it for others.
int matrix_arrangement[] = { 0,1,2,3,4,9,8,7,6,5 };
voidclub_matrix_render(void)
{
for (int i=0; i<led_count; i++)
{
int led_real_x = i % width; // 0 to 39int led_real_y = i / width; // 0 to 1int matrix_number_x = led_real_x / 8; // should be 0 to 4int matrix_number_y = led_real_y / 8; // should be 0 or 1int matrix_number = matrix_number_y * 5 + matrix_number_x; // 0 to 9int matrix_x = led_real_x % 8; // 0 to 7int matrix_y = led_real_y % 8; // 0 to 7
ledstring.channel[0].leds[matrix_arrangement[matrix_number] * 64 + matrix_y * 8 + matrix_x] = matrix[i];
}
}