Where Do I Start?? WS2812b led matrix multipurpose clock.

Hey everyone. It's been a while since my last post here.

I'm actually a lot lost right now, so lost that I wasn't even sure where I should post my question.

My basic project is to make an Addressable RGB Led matrix that functions mainly as a digital clock. It's going to be controlled by an esp8266.

I did some research and can't figure a few things.

  1. What dimension does my matrix need to be? I ordered 5 meters 60led/meter strips on which every led can be cut individually. So i basically have 300leds. What or how do i dictate my Matrix's pixel dimensions? Is there any sort of library that has basic english characters for use with matrix? I was looking at neopixel but im not sure what to search for.

  2. I want to control whats being displayed through a web server, but thats not for now. What i want to say is, Is there a certain way of doing things so i wouldnt have to do everything all over again everytime i want to add some new feature? ( say, like a light based alarm clock?)

3.Would it be too complicated to control this through a web server(whats being shown) as well as with an ir reciever ( switching modes between clock/basic rgb light functionalities) ?

  1. Most Importantly, Where do i start? Im pretty comfortable with the hardware, but cant help but feel im over-complicating things.

Im really sorry if this question seems to vague. Im having much trouble putting my thoughts to words. I would gladly add any needed information I didnt add here.
Thanks.

Programmable LEDs require an array of one byte per LED. You fill the array with the pattern you want on the LEDs, then write the whole array to the LEDs.

What you haven't said is how are you going to arrange those 300 pixels?

You didn't already cut them did you? You can buy the WS8212 LED boards in breakable sheets.

kaseftamjid:

  1. What dimension does my matrix need to be? I ordered 5 meters 60led/meter strips on which every led can be cut individually. So i basically have 300leds. What or how do i dictate my Matrix's pixel dimensions?

It depends on:

  • What set of characters you want to display.
  • How many characters you want to display at once.
  • How readable you want the characters to be.

For alphanumeric characters, I would not go any smaller than 5 by 7 (5x7) which is 5 columns of 7 rows. At 7 pixels per column, you can get 42 columns from your 300 LEDs. Assuming one blank column between characters that would fit 7 characters.

For more readable characters you should have more pixels per column. Sixteen seems to be a good compromise between cost and readability. That would be 18 columns or not much more than a character or two in 300 pixels.

kaseftamjid:
Is there any sort of library that has basic english characters for use with matrix? I was looking at neopixel but im not sure what to search for.

SteveMann:
Programmable LEDs require an array of one byte per LED. You fill the array with the pattern you want on the LEDs, then write the whole array to the LEDs.

What you haven't said is how are you going to arrange those 300 pixels?

You didn't already cut them did you? You can buy the WS8212 LED boards in breakable sheets.

I was still searching for info while i posted this, so i didnt decide then on how i would arrange those leds.
oh god no, i havent, its going to be a nightmare to individually connect each led, i plan to decide on a lenth and width and then make smaller strips, most likely horizontally to make a grid.
I already ordered those 5m roles, as i thought they would be the easiest to make into a grid
like this

johnwasser:
It depends on:

  • What set of characters you want to display.
  • How many characters you want to display at once.
  • How readable you want the characters to be.

For alphanumeric characters, I would not go any smaller than 5 by 7 (5x7) which is 5 columns of 7 rows. At 7 pixels per column, you can get 42 columns from your 300 LEDs. Assuming one blank column between characters that would fit 7 characters.

For more readable characters you should have more pixels per column. Sixteen seems to be a good compromise between cost and readability. That would be 18 columns or not much more than a character or two in 300 pixels.

  1. Basic english characters, small/capital alphabet, and numbers. no special characters.

  2. As i said before, its main purpose is to be a clock, so 4 characters with a colon is an absolute must. So, 5 characters.

  3. Average viewing distance is about 1.5~2 meters. so considering the brightness of 5050 leds, 5x7 would do fine, i guess. But Im trying to calculate perfect pixel matching for 5 characters. as you said, more pixel per column, can i put it at 6x10? (6 as in width).

I cant help but feel like im doing something wrong. say if i use it at 6x10, wont i have to make my own font array? how would that include the spaces between each characters? can i even put 5 characters with 6x10?
Ive been searching and looking at these kind of rgb matrix projects all day, but most, if not all of them left out the more important ‘why we did this’ portion out and made things oversimplified. so now im not clueless, but even more confused

edit: ahh… i was messing with a glcd font creator and found out that even numbers are there to make life more complicated. Odd numbers it is. now again im not sure what pixel dimensions i should use

So.. This is where i am right now. After deciding on font size and grid size, I cant figure out the "gaps" that was mentioned. For example.

This is what ive decided for my grid 38x7 rows. So 5x7 should fit perfectly here.

so my question.

  1. Are the gaps just pixels in between turned off, the same way fonts are? or do i have to physically adjust things to make a gap?
  2. Any software suggestions? I still cant find clear indications online. How am i supposed to use the 5x7 font libraries i can find online for arduinos? they all seem to use some sort of hex code to refer to each pixel, how do i figure that out?
  3. Can someone help me find at least a bare-bone code thats similar to what I'm trying to do? Ive been sitting here for hours but cant even decide what line of code to start with..

With a 5x7 font (anything less than 9 pixels high) it is easy to store each character as a set of bytes where each byte represents one column of the character. Since your font height is 7 you would just ignore one of the bits in the bytes. If all characters are the same width they would all use the same number of bytes (5 in your case). You would have a font consisting of 475 bytes (95 printable characters of 5 bytes each). To find the start of a character, subtract 32 from the character (the first 32 ASCII character are not printable) and multiply the result by 5. That gives you the starting point in your font.

To form the image you want to display on your 38x7 display, make a 38-byte buffer. For each character, find the character in the font and copy 5 bytes from the font to the buffer. Then add a byte of 0 to the buffer for the space between characters.

To scroll messages you might want to start the buffer pointer at a negative number so be sure to ONLY put bytes from the font (and the blank byte) into the buffer if the buffer pointer is between 0 and 37!

Then all you have to do is figure out how the bits in the buffer map to your pixels. To limit the number of cuts in your LED strip it is likely that your pixels are in horizontal rows of 38 rather than vertical rows of 7. It is also likely that to simplify wiring your pixels alternate between left-to-right and right-to-left. All this can be calculated in software once you have chosen a layout. Just copy the buffer to the pixels and your're done!

Here is a 5x7 font that looks like what I describe:

byte Font5x7[475] = 
{
0x00, 0x00, 0x00, 0x00, 0x00,  // 0x20
0x00, 0x00, 0x5F, 0x00, 0x00,  // 0x21 !
0x00, 0x07, 0x00, 0x07, 0x00,  // 0x22 "
0x14, 0x7F, 0x14, 0x7F, 0x14,  // 0x23 #
0x24, 0x2A, 0x7F, 0x2A, 0x12,  // 0x24 $
0x23, 0x13, 0x08, 0x64, 0x62,  // 0x25 %
0x36, 0x49, 0x56, 0x20, 0x50,  // 0x26 &
0x00, 0x08, 0x07, 0x03, 0x00,  // 0x27 '
0x00, 0x1C, 0x22, 0x41, 0x00,  // 0x28 (
0x00, 0x41, 0x22, 0x1C, 0x00,  // 0x29 )
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,  // 0x2A *
0x08, 0x08, 0x3E, 0x08, 0x08,  // 0x2B +
0x00, 0x80, 0x70, 0x30, 0x00,  // 0x2C ,
0x08, 0x08, 0x08, 0x08, 0x08,  // 0x2D -
0x00, 0x00, 0x60, 0x60, 0x00,  // 0x2E .
0x20, 0x10, 0x08, 0x04, 0x02,  // 0x2F /
0x3E, 0x51, 0x49, 0x45, 0x3E,  // 0x30 0
0x00, 0x42, 0x7F, 0x40, 0x00,  // 0x31 1
0x72, 0x49, 0x49, 0x49, 0x46,  // 0x32 2
0x21, 0x41, 0x49, 0x4D, 0x33,  // 0x33 3
0x18, 0x14, 0x12, 0x7F, 0x10,  // 0x34 4
0x27, 0x45, 0x45, 0x45, 0x39,  // 0x35 5
0x3C, 0x4A, 0x49, 0x49, 0x31,  // 0x36 6
0x41, 0x21, 0x11, 0x09, 0x07,  // 0x37 7
0x36, 0x49, 0x49, 0x49, 0x36,  // 0x38 8
0x46, 0x49, 0x49, 0x29, 0x1E,  // 0x39 9
0x00, 0x00, 0x14, 0x00, 0x00,  // 0x3A :
0x00, 0x40, 0x34, 0x00, 0x00,  // 0x3B ;
0x00, 0x08, 0x14, 0x22, 0x41,  // 0x3C <
0x14, 0x14, 0x14, 0x14, 0x14,  // 0x3D =
0x00, 0x41, 0x22, 0x14, 0x08,  // 0x3E >
0x02, 0x01, 0x59, 0x09, 0x06,  // 0x3F ?
0x3E, 0x41, 0x5D, 0x59, 0x4E,  // 0x40 @
0x7C, 0x12, 0x11, 0x12, 0x7C,  // 0x41 A
0x7F, 0x49, 0x49, 0x49, 0x36,  // 0x42 B
0x3E, 0x41, 0x41, 0x41, 0x22,  // 0x43 C
0x7F, 0x41, 0x41, 0x41, 0x3E,  // 0x44 D
0x7F, 0x49, 0x49, 0x49, 0x41,  // 0x45 E
0x7F, 0x09, 0x09, 0x09, 0x01,  // 0x46 F
0x3E, 0x41, 0x41, 0x51, 0x73,  // 0x47 G
0x7F, 0x08, 0x08, 0x08, 0x7F,  // 0x48 H
0x00, 0x41, 0x7F, 0x41, 0x00,  // 0x49 I
0x20, 0x40, 0x41, 0x3F, 0x01,  // 0x4A J
0x7F, 0x08, 0x14, 0x22, 0x41,  // 0x4B K
0x7F, 0x40, 0x40, 0x40, 0x40,  // 0x4C L
0x7F, 0x02, 0x1C, 0x02, 0x7F,  // 0x4D M
0x7F, 0x04, 0x08, 0x10, 0x7F,  // 0x4E N
0x3E, 0x41, 0x41, 0x41, 0x3E,  // 0x4F O
0x7F, 0x09, 0x09, 0x09, 0x06,  // 0x50 P
0x3E, 0x41, 0x51, 0x21, 0x5E,  // 0x51 Q
0x7F, 0x09, 0x19, 0x29, 0x46,  // 0x52 R
0x26, 0x49, 0x49, 0x49, 0x32,  // 0x53 S
0x03, 0x01, 0x7F, 0x01, 0x03,  // 0x54 T
0x3F, 0x40, 0x40, 0x40, 0x3F,  // 0x55 U
0x1F, 0x20, 0x40, 0x20, 0x1F,  // 0x56 V
0x3F, 0x40, 0x38, 0x40, 0x3F,  // 0x57 W
0x63, 0x14, 0x08, 0x14, 0x63,  // 0x58 X
0x03, 0x04, 0x78, 0x04, 0x03,  // 0x59 Y
0x61, 0x59, 0x49, 0x4D, 0x43,  // 0x5A Z
0x00, 0x7F, 0x41, 0x41, 0x41,  // 0x5B [
0x02, 0x04, 0x08, 0x10, 0x20,  // 0x5C backslash
0x00, 0x41, 0x41, 0x41, 0x7F,  // 0x5D ]
0x04, 0x02, 0x01, 0x02, 0x04,  // 0x5E ^
0x40, 0x40, 0x40, 0x40, 0x40,  // 0x5F _
0x00, 0x03, 0x07, 0x08, 0x00,  // 0x60 `
0x20, 0x54, 0x54, 0x78, 0x40,  // 0x61 a
0x7F, 0x28, 0x44, 0x44, 0x38,  // 0x62 b
0x38, 0x44, 0x44, 0x44, 0x28,  // 0x63 c
0x38, 0x44, 0x44, 0x28, 0x7F,  // 0x64 d
0x38, 0x54, 0x54, 0x54, 0x18,  // 0x65 e
0x00, 0x08, 0x7E, 0x09, 0x02,  // 0x66 f
0x18, 0xA4, 0xA4, 0x9C, 0x78,  // 0x67 g
0x7F, 0x08, 0x04, 0x04, 0x78,  // 0x68 h
0x00, 0x44, 0x7D, 0x40, 0x00,  // 0x69 i
0x20, 0x40, 0x40, 0x3D, 0x00,  // 0x6A j
0x7F, 0x10, 0x28, 0x44, 0x00,  // 0x6B k
0x00, 0x41, 0x7F, 0x40, 0x00,  // 0x6C l
0x7C, 0x04, 0x78, 0x04, 0x78,  // 0x6D m
0x7C, 0x08, 0x04, 0x04, 0x78,  // 0x6E n
0x38, 0x44, 0x44, 0x44, 0x38,  // 0x6F o
0xFC, 0x18, 0x24, 0x24, 0x18,  // 0x70 p
0x18, 0x24, 0x24, 0x18, 0xFC,  // 0x71 q
0x7C, 0x08, 0x04, 0x04, 0x08,  // 0x72 r
0x48, 0x54, 0x54, 0x54, 0x24,  // 0x73 s
0x04, 0x04, 0x3F, 0x44, 0x24,  // 0x74 t
0x3C, 0x40, 0x40, 0x20, 0x7C,  // 0x75 u
0x1C, 0x20, 0x40, 0x20, 0x1C,  // 0x76 v
0x3C, 0x40, 0x30, 0x40, 0x3C,  // 0x77 w
0x44, 0x28, 0x10, 0x28, 0x44,  // 0x78 x
0x4C, 0x90, 0x90, 0x90, 0x7C,  // 0x79 y
0x44, 0x64, 0x54, 0x4C, 0x44,  // 0x7A z
0x00, 0x08, 0x36, 0x41, 0x00,  // 0x7B {
0x00, 0x00, 0x77, 0x00, 0x00,  // 0x7C |
0x00, 0x41, 0x36, 0x08, 0x00,  // 0x7D }
0x02, 0x01, 0x02, 0x04, 0x02,  // 0x7E ~
};

johnwasser:
All this can be calculated in software once you have chosen a layout. Just copy the buffer to the pixels and your're done!

I have decided on a layout. a link or name would be very helpful

Another thing that popped in my mind, won't it be easier to use as many pins as the rows? 5 data pins for 5 rows? I do understand that the MCU cant run 5 pins at the very same time, instead execute each pin separately, would it be faster or slower than a single 1 wire interface?

kaseftamjid:
Another thing that popped in my mind, won't it be easier to use as many pins as the rows? 5 data pins for 5 rows? I do understand that the MCU cant run 5 pins at the very same time, instead execute each pin separately, would it be faster or slower than a single 1 wire interface?

It's 7 rows, not 5. I guess treating it as 7 strips of 38 might be faster. Depends on how the data is sent to the strips. Have you tried sending patterns to a strip yet?

johnwasser:
It's 7 rows, not 5. I guess treating it as 7 strips of 38 might be faster. Depends on how the data is sent to the strips. Have you tried sending patterns to a strip yet?

my strips are on the way, right now im working with serial monitor and simiulations