100% DIY 32x32 LED (single color?) matrix HELP

1.00
I have Minimal knowledge but i am quick to learn, only what i have gained from tinkering with Chinese knockoff arduinos and some parts ( i have made a working 3x3 display by hand and attempted a 6x6 but the code still confuses me because some people call a matrix and others use a char array and i did not have a steady enough hand to squeeze it onto protoboard. but i am wanting to make a 32 X 32 Led matrix that can display different animations and also incorporate a game or two into it as well I am wanting to do this 100% DIY from designing the led matrix PCB(Probably from JLCpcb) to soldering every chip on it because i just like the idea and it is for my father to entertain him in his home. The following list is my rambling for the idea / Questions i have about this project.

  • Main question is how to interface the required 32 x 32 IO pins for the Multiplexing, Would multiple shift registers work (74HC165) or an I2C IO port extender (PCF8574) or something like a serial to parallel IC that goes straight to 32 outputs Like the (HV9308) for example.

  • I am also wanting this to have a peripheral for the simple games (snake clone, space invaders clone, pong clone (with "simple" pong Ai and maybe function for 2 people???) plus any others people suggest that are small and easy to fit in. that is cordless preferably... maybe using the NRF23L01 Transceivers or other connection method.( the controller would have {general idea} 2 sets of 4 buttons {up,down,left,right} and then 2 or three buttons to switch between games and animations.

  • with all the things i am wanting in the software i am assuming that memory will be a problem, the stock memory in a mega328 has 32 KB, but would jumping to using a ATmega2560 with 256 KB be sufficient, or if there is a way to "add" sufficient flash memory to any AT chip or a way to store and access the diffrent games on a storage media, ie SD card/ memorie IC (EEPROM?). ((Lets put this on a ATtiny))..no

*I am thinking single color because RGB from an Arduino in a 32x32 matrix seems like it would be crazy to attempt from a DIY standpoint but feel free to give ideas and help if you believe it is with some ease, possible (within the memory limit of the ATmega2560 )

  • Overall i am looking for complete and utter support and help in the coding and development of this, within a day or too i will post a partial schematic for the matrix just for people to error check, I need help and i am hoping this wonderful community will make this idea possible.

*Updates Will come very frequently with probably no stand still more then 2 days in a row i hope someone(s) can take me under a wing and make this possible!

5/1/2018 ^ Thank You!

1.01 Just finished the grinding part of the LED's on the schematic so far so good, i am pretty sure im going to go with Shift registers for the driving of the led's. Going to open up a GitHub for this project maybe it will help stay organised.
V GitHub V
https://github.com/Revoric/DIY-32x32-LED-Matrix

5/20/2018

1.02 I have most of the supply i need, the chips arduino and P-fets but i am stuck hard on information and lack of knowledge on how to string together the code any help would be GREATLY appreciated. thank you!

Driver.pdf (586 KB)

Hi,
Welcome to the Forum.
This may help.
https://www.brainy-bits.com/how-to-control-max7219-led-matrix/

The max7219 is suited to driving LED matrix/arrays.

google 32 x 32 led dot matrix arduino

Tom... :slight_smile:

Revoric:

  • Main question is how to interface the required 16 x 16 IO pins for the Multiplexing, Would multiple shift registers work (74HC165) or an I2C IO port extender (PCF8574) or something like a serial to parallel IC that goes straight to 32 outputs Like the (HV9308) for example.

That would be 32x32 pins, for a 32x32 matrix.
Shift registers are the way to go. Look for LED driver types, so they can sink/source sufficient current and maybe even constant current.
Port extenders are no good - definitely not the PCF8574 which can not source any significant current - and way too slow due to the I2C overhead. Shift registers are much faster - and a lot cheaper to boot.

memory in a mega328 has 32 KB, but would jumping to using a ATmega2560 with 256 KB be sufficient, or if there is a way to "add" sufficient flash memory to any AT chip or a way to store and access the diffrent games on a storage media, ie SD card/ memorie IC (EEPROM?). ((Lets put this on a ATtiny))..no

Yes, that's the way. Just put the required patterns on external memory if you can't stuff it into flash.

  • Overall i am looking for complete and utter support and help in the coding and development of this, within a day or too i will post a partial schematic for the matrix just for people to error check, I need help and i am hoping this wonderful community will make this idea possible.

The circuit should be quite straightforward - just look at the 6x6 you mentioned, and go from there. 32x32 matrices are bigger, that's the only real difference. And of course you need a few more shift registers (8 total).

This is all assuming you want them just to be on/off. If you want brightness changes, you need drivers with PWM output. The same you need if you want to go RGB to be able to get all the different colours (maybe directly addressable LEDs can do the job, such as the common WS2812 - you can basically daisy chain them without the need of shift registers or drivers). For a 32x32 RGB you probably also have to look at the much faster and more capable Raspberry Pi type of computers, rather than Arduinos. Each individual image is 32x32x3x8 bits (for 24-bit colour) = 8 kB of data; so 1 second of 24 fps animation is 192 kB. Of course you'll be looking to animate on the fly, which needs a lot of processing power.

wvmarle:
That would be 32x32 pins, for a 32x32 matrix.
Shift registers are the way to go. Look for LED driver types, so they can sink/source sufficient current and maybe even constant current.
Port extenders are no good - definitely not the PCF8574 which can not source any significant current - and way too slow due to the I2C overhead. Shift registers are much faster - and a lot cheaper to boot.

You are correct, 32x32 pins i was stuck on 16 for some reason, anyway would i want a "normal" 8 channel(TLC6C598-Q1) Led driver shift register or would it be "O.K." for a 12 channel (TLC6C5912-Q1) or 16 channel(TLC5927) ect.. / what would be easiest in the code ( I know little to nothing to the code for this).

wvmarle:
Yes, that's the way. Just put the required patterns on external memory if you can't stuff it into flash.

In using the Atmega2560 and lets say storing the Patterns on an EEPROM witch i do not know how if its even possible ( nor the code to do so yet). would the be any oblvious problems to look out for that you know off the top of your head and in the coding for the shift register would it just be a serial out for every vertical or horizontal line with a 32 bit line? ie 1010101...ect (in Hex?) for the 32 led's in one line to be alternating.

wvmarle:
The circuit should be quite straightforward - just look at the 6x6 you mentioned, and go from there. 32x32 matrices are bigger, that's the only real difference. And of course you need a few more shift registers (8 total).

This is all assuming you want them just to be on/off. If you want brightness changes, you need drivers with PWM output.

The 6x6 one i made was with all 12 pins on a arduino mini and never worked lol..., brightness control would be cool allowing more definition in the patterns and games but would it be "easy" to fit into the memory and the overall coding, im guessing the hardware stays the same, just PWM capable Led driving shift registers?

on/off: 1 bit per pixel. 32x32 pixels = 16 bytes
PWM: 8-16 bits per pixel. 32x32 pixels = 1-2 kB.
EEPROM size on a Mega: 4 kB.

wvmarle:
on/off: 1 bit per pixel. 32x32 pixels = 16 bytes
PWM: 8-16 bits per pixel. 32x32 pixels = 1-2 kB.
EEPROM size on a Mega: 4 kB.

That makes sence, i am planning to use a atmega chip on the pcb itself so i could use any eeprom or multiple eeproms, connecting them using the I2C bus would that be a problem? 64kb or more if needed? Also do you think it would be possible to have just 4 bits per pixel, off, 50% 75% and 100% ? Also how could i load from the eeprom, can i store code like under a tag "Game1" and somehow call or load Game1 from the eeprom into the arduino and it would run or would i need all the code in the arduino itself? Thank you

At just 4 bits per pixel that's 512 bytes per image. 8 images in a 4 kB EEPROM.

I just realise I miscalculated the 32x32 1-bit image; that is 64 bytes per image, not 16. That's 64 images in a 4 kB EEPROM.

24-bit RGB (8 bits per channel) is 3 kB per image.

You said you want to do animations. How many images per animation? Do the math. Do consider using an SD card instead. Much more storage in less space.

wvmarle:
At just 4 bits per pixel that's 512 bytes per image. 8 images in a 4 kB EEPROM.
I just realise I miscalculated the 32x32 1-bit image; that is 64 bytes per image, not 16. That's 64 images in a 4 kB EEPROM
You said you want to do animations. How many images per animation? Do the math. Do consider using an SD card instead. Much more storage in less space.

Is it only possible to store images like i couldnt have a 64kb eeprom that has all the code and maybe images for 1 game and all the arduino does is call the eeprom up and then run what is on the eeprom? and for the animations i was thinking just simple things that catch the eye, like a single light going down and back, or from the center and out, random lines down, stuff like that. But i am really wanting to do atleast a game or too. Having the arduino mainly have some code that runs whats stored and then a interupt to select witch game or animation you would want, eather 2 buttion with diffrent states +1 and -1 or maybe a dip switch with 3 or 4 switches and when you press a buttion that adress is called in the code to select a specific game or animation

I'm sure you can store stuff in EEPROM for your things, I just don't see the point of using EEPROM when you have cheaper and larger storage available in the form of SD cards.

wvmarle:
I'm sure you can store stuff in EEPROM for your things, I just don't see the point of using EEPROM when you have cheaper and larger storage available in the form of SD cards.

Ah that makes sence i was just thinking that because 1 i dont have a way to easily write to sdcards unless i arduino it and i was under the asumption that it wouldnt be as fast, also even if i use a something to store all the game code would the arduino flash memory still need to fit it to run it, or could it "run" off the storage? Im in territory i know little about and am doing almost constant research. Do you know a good shift register that can do the pwm?

The complete sketch with all games must fit in your normal Flash (but with some smart programming you can do a lot in that).

Just create your files on a PC (as image maybe? bmp format or similar uncompressed image?) and drop them on the SD file. Encode game and order of images in the file name for your Arduino to figure out.

wvmarle:
The complete sketch with all games must fit in your normal Flash (but with some smart programming you can do a lot in that).

Just create your files on a PC (as image maybe? bmp format or similar uncompressed image?) and drop them on the SD file. Encode game and order of images in the file name for your Arduino to figure out.

I have done some research and it seems unless i write the whole program in Bitlash i cant use the outside storage as external flash, im not sure what you mean by using a image file, i was thinking somehow using at least like a text file for each 32x32 array image Like "Animation 1.0" through to like "Animation 1.93" with all the necessary in between and doing some clever coding for the animations just using a counter to cycle through a loop saving memory instead of calling each one on its own after a delay, these eather in seperate text files, or in one big file "Animation1" using the #define 4A {/32x32array}
and so on.

byte AniOne[4]

//*code to call Animation1 file up*

for (int i = 1; i <= 4; i++) {
AniOne[i-1] = [iA]} ;                  //  AniOne[0] = 1A [/ 32x32array} and so on

something like that on calling the arrays out of the file once it is loaded into the flash and once it is in
AniOne shifting through it row by row of each array if possible.

wvmarle:
on/off: 1 bit per pixel. 32x32 pixels = 16 bytes
PWM: 8-16 bits per pixel. 32x32 pixels = 1-2 kB.
EEPROM size on a Mega: 4 kB.

32x32 = 1024 bits -- 1024 leds to wire.
1024/8 = 128 bytes
1024*4 bits = 4KB

I'd go with addressable led strip. You could feed 32 x 32-led strips.

GoForSmoke:
32x32 = 1024 bits -- 1024 leds to wire.
1024/8 = 128 bytes
1024*4 bits = 4KB

I'd go with addressable led strip. At the rate those strips read you can fill 1024 leds then wait for eyes to catch up before displaying the next frame. 25FPS is 40 ms between frames. Check the data rate of WS2812 leds.

Yes it could be done with the WS2812 leds but i have no need or want for the RGB colour anymore and dont have $ 400 to spend on 1024 leds lol, im going with 3mm leds. Thank you anyway

This thread seems to be ignoring the best solution suggested so far. Go back to TomGeorge's reply #1.

TomGeorge:
Hi,
Welcome to the Forum.
This may help.
https://www.brainy-bits.com/how-to-control-max7219-led-matrix/

The max7219 is suited to driving LED matrix/arrays.

google 32 x 32 led dot matrix arduino

Tom... :slight_smile:

PaulRB:
This thread seems to be ignoring the best solution suggested so far. Go back to TomGeorge's reply #1.

It was in my thinking that it would require more memory and time using that because it seems i would have to have 8 8x8 arrays for every 1 frame? am i flawed i'm my thinking, i know very little about all of this and will gladly admit so. a small code example would be appreciated, i am a very visual learner. would the Max7219 support or be compatible with PWM to allow multiple brightness in the matrix

No, you would need 16 8x8 arrays. Same amount of memory whichever way you do it. When you say "require more time" did you mean you personally, or processing time? If personal time, I'm pretty sure it would be less overall. If processing time, definitely less.

Max7219 has 16 pwm/brightness levels, but not per pixel, only for each block of 8x8 pixels. If that's an important requirement then I apologize.

PaulRB:
No, you would need 16 8x8 arrays. Same amount of memory whichever way you do it. When you say "require more time" did you mean you personally, or processing time? If personal time, I'm pretty sure it would be less overall. If processing time, definitely less.

Max7219 has 16 pwm/brightness levels, but not per pixel, only for each block of 8x8 pixels. If that's an important requirement then I apologize.

No problem there your just giving your information, i am wanting 4 brightness levels for each pixel individule so i could have deffinition even with a single colour

@wvmarie do you believe that 2 TLC5940's (16 channel PMW capable shift register the max output is 60-120 with absolute max at 130mA Would i need this to be toggling transistors for power? ) and then using 4 MIC5891 on the Cathode (8 channle shift register with darlington transistors on each latch capable of sinking 500mA to ground) Thank you

Read the data sheet. Many such ICs are designed to drive LEDs directly.