50 Ways to leave your LEDs
iseries
Posts: 1,492
Ever since I got the Holiday Spin kit the WS2811 LEDs have been laying around on the floor waiting...
So I thought why not 3D print a panel and mount them in there since I don't have a tree to put them on and they would take up less space than leaving them lying around.
This was a fun head twister to map the LED's in the matrix to pixels in a character set.
I used the generic 5X7 character font and mapped it to the 6x8 WS2811 LED's. Then I sent the string to it and watched the letters go by.
Here is a video of it in action.
Here is the C program that made it all work.
Now I can put my LEDs in a box.
Mike
WS2811 LED Matrix
So I thought why not 3D print a panel and mount them in there since I don't have a tree to put them on and they would take up less space than leaving them lying around.
This was a fun head twister to map the LED's in the matrix to pixels in a character set.
I used the generic 5X7 character font and mapped it to the 6x8 WS2811 LED's. Then I sent the string to it and watched the letters go by.
Here is a video of it in action.
Here is the C program that made it all work.
#include <stdio.h> #include <propeller.h> #include "ws2812.h" void DoDisplay(int); void DoStr(char*); void DoRastor(int, char); // font 5x7 in 8x8 format line by line long Font_57[] = {0x1f1f1f1f, 0x1f1f1f1f, //0x0 0x07030101, 0x3f1f0f07, //0x1 0x151b111f, 0x1f111b15, //0x2 0x1c1e1e1f, 0x10101818, //0x3 0x18040201, 0x01020418, //0x4 0x1f000000, 0x0000001f, //0x5 0x04040404, 0x04040404, //0x6 0x1111111f, 0x1f111111, //0x7 0x150a150a, 0x150a150a, //0x8 0x150a150a, 0x150a150a, //0x9 0x150a150a, 0x150a150a, //0xa 0x150a150a, 0x150a150a, //0xb 0x150a150a, 0x150a150a, //0xc 0x150a150a, 0x150a150a, //0xd 0x150a150a, 0x150a150a, //0xe 0x150a150a, 0x150a150a, //0xf 0x1f1f1f1f, 0x1f1f1f1f, //0x10 0x071b1d1e, 0x1e1d1b07, //0x11 0x00001f1f, 0x1f1f0000, //0x12 0x11111111, 0x11111111, //0x13 0x151b1b1f, 0x1f1b1b15, //0x14 0x1313131f, 0x1f131313, //0x15 0x1919191f, 0x1f191919, //0x16 0x1111111f, 0x1f111111, //0x17 0x1111111f, 0x1f111111, //0x18 0x1111111f, 0x1f111111, //0x19 0x1111111f, 0x1f111111, //0x1a 0x1111111f, 0x1f111111, //0x1b 0x1111111f, 0x1f111111, //0x1c 0x1111111f, 0x1f111111, //0x1d 0x1111111f, 0x1f111111, //0x1e 0x1111111f, 0x1f111111, //0x1f 0x00000000, 0x00000000, //0x20 0x01010101, 0x00010001, //0x21 0x0012091b, 0x00000000, //0x22 0x0a1f0a00, 0x00000a1f, //0x23 0x0e051e04, 0x00040f14, //0x24 0x04081111, 0x00111102, //0x25 0x02050502, 0x00160915, //0x26 0x0004080c, 0x00000000, //0x27 0x04040810, 0x00100804, //0x28 0x04040201, 0x00010204, //0x29 0x0e150400, 0x0004150e, //0x2a 0x1f040400, 0x00000404, //0x2b 0x00000000, 0x01020300, //0x2c 0x1f000000, 0x00000000, //0x2d 0x00000000, 0x00030300, //0x2e 0x04081010, 0x00010102, //0x2f 0x1519110e, 0x000e1113, //0x30 0x04040604, 0x000e0404, //0x31 0x0810110e, 0x001f0106, //0x32 0x0e10110e, 0x000e1110, //0x33 0x090a0c08, 0x0008081f, //0x34 0x100f011f, 0x000e1110, //0x35 0x0f01020c, 0x000e1111, //0x36 0x0408101f, 0x00020202, //0x37 0x0e11110e, 0x000e1111, //0x38 0x1e11110e, 0x00060810, //0x39 0x00030300, 0x00000303, //0x3a 0x00030300, 0x01020303, //0x3b 0x02040810, 0x00100804, //0x3c 0x001f0000, 0x0000001f, //0x3d 0x08040201, 0x00010204, //0x3e 0x0810110e, 0x00040004, //0x3f 0x1515110e, 0x001e010d, //0x40 0x11110a04, 0x0011111f, //0x41 0x0f11110f, 0x000f1111, //0x42 0x0101120c, 0x000c1201, //0x43 0x11110907, 0x00070911, //0x44 0x0f01011f, 0x001f0101, //0x45 0x0f01011f, 0x00010101, //0x46 0x0101110e, 0x000e1119, //0x47 0x1f111111, 0x00111111, //0x48 0x0404041f, 0x001f0404, //0x49 0x10101010, 0x000e1110, //0x4a 0x03050911, 0x00110905, //0x4b 0x01010101, 0x001f0101, //0x4c 0x15151b11, 0x00111111, //0x4d 0x15131111, 0x00111119, //0x4e 0x1111110e, 0x000e1111, //0x4f 0x0f11110f, 0x00010101, //0x50 0x1111110e, 0x00160915, //0x51 0x0f11110f, 0x00110905, //0x52 0x0e01110e, 0x000e1110, //0x53 0x0404041f, 0x00040404, //0x54 0x11111111, 0x000e1111, //0x55 0x0a111111, 0x0004040a, //0x56 0x15111111, 0x000a1515, //0x57 0x040a1111, 0x0011110a, //0x58 0x040a1111, 0x00040404, //0x59 0x0408101f, 0x001f0102, //0x5a 0x0303031f, 0x001f0303, //0x5b 0x04020101, 0x00101008, //0x5c 0x1818181f, 0x001f1818, //0x5d 0x0a040000, 0x00000011, //0x5e 0x00000000, 0x1f000000, //0x5f 0x000c0408, 0x00000000, //0x60 0x100e0000, 0x001e111e, //0x61 0x110f0101, 0x000f1111, //0x62 0x011e0000, 0x001e0101, //0x63 0x111e1010, 0x001e1111, //0x64 0x110e0000, 0x001e011f, //0x65 0x0f02120c, 0x00020202, //0x66 0x110e0000, 0x0e101e11, //0x67 0x110f0101, 0x00111111, //0x68 0x04060004, 0x000e0404, //0x69 0x080c0008, 0x06090808, //0x6a 0x09110101, 0x00110906, //0x6b 0x04040406, 0x000e0404, //0x6c 0x151b0000, 0x00111515, //0x6d 0x110f0000, 0x00111111, //0x6e 0x110e0000, 0x000e1111, //0x6f 0x110f0000, 0x01010f11, //0x70 0x111e0000, 0x10101e11, //0x71 0x031d0000, 0x00010101, //0x72 0x011e0000, 0x000f100e, //0x73 0x020f0202, 0x000c1202, //0x74 0x11110000, 0x00161911, //0x75 0x11110000, 0x00040a11, //0x76 0x11110000, 0x001b1515, //0x77 0x0a110000, 0x00110a04, //0x78 0x11110000, 0x0e101e11, //0x79 0x081f0000, 0x001f0204, //0x7a 0x0306061c, 0x001c0606, //0x7b 0x04040404, 0x04040404, //0x7c 0x180c0c07, 0x00070c0c, //0x7d 0x000d1600, 0x00000000, //0x7e 0x1f1f1f1f, 0x1f1f1f1f}; //0x7f char Matrix[8][6] = { 7, 6, 5, 4, 3, 2, 8, 9, 10, 11, 12, 13, 19, 18, 17, 16, 15, 14, 20, 21, 22, 23, 24, 25, 31, 30, 29, 28, 27, 26, 32, 33, 34, 35, 36, 37, 43, 42, 41, 40, 39, 38, 44, 45, 46, 47, 48, 49 }; char Billboard[300]; #define PIN 16 int LEDs[50]; int main() { int i; memset(LEDs, 0, sizeof(LEDs)); memset(Billboard, 0, sizeof(Billboard)); DoStr("Hello World "); for(i=0;i<72;i++) { DoDisplay(i); _waitms(250); } printf("Done\n"); while (1) { _waitms(1000); } } void DoDisplay(int offset) { int i, j; char x; for (int j=0;j<6;j++) { x = Billboard[offset + j]; for (int i=0;i<8;i++) { if (x & 0x01) LEDs[Matrix[i][j]] = 32; else LEDs[Matrix[i][j]] = 0; x = x >> 1; } } ws2812_set(PIN, LEDs, 50); } void DoRastor(int p, char x) { unsigned int u, l; x = x * 2; u = Font_57[x]; l = Font_57[x + 1]; for (int j=0;j<4;j++) { for (int i=0;i<8;i++) { Billboard[p+i] = Billboard[p+i] << 1; Billboard[p+i] = Billboard[p+i] | (u & 0x01); u = u >> 1; } } for (int j=0;j<4;j++) { for (int i=0;i<8;i++) { Billboard[p+i] = Billboard[p+i] << 1; Billboard[p+i] = Billboard[p+i] | (l & 0x01); l = l >> 1; } } } void DoStr(char *data) { int i; for (i=0;i<strlen(data);i++) { DoRastor(i * 6, data[i]); } }
Now I can put my LEDs in a box.
Mike
WS2811 LED Matrix
txt
980K
Comments
Can you post the 3D stl file for your panel?
Along a similar line is this product. See web page and attached image. He also created an Instructables article about his modules.
The creator of these 7 segment LED modules use 3 WS2811 chips to drive the segments, assigning each color channel on each chip to different segments. Granted the LED's are going to be a fixed color, but you can add them serially to easily add more digits.
I have 8 of these modules and have made a 3D printed mounting panel to hold them in groups of 4 but also allowing them to connect together in series for 8, 12, 16 digits on up.
I've created some P1 code to drive them and will need to adapt either my original code or leverage jonnymac's driver to run them with a P2.