Neomatrix 16x16 Guidance

I have a 16x16 neomatrix connected to a Arduino Nano Every which is then connected to a computer. I have a couple questions about memory.

There is the program storage space, which is 49,152 bytes. Then there is the dynamic memory, which is 6,144 bytes.

For my requirements, I need to play several animations on this board. I have come up with the format: an animation is a collection of frames, and each frame contains information on what pixels to light up.

The smallest amount of information I need to store is the row, column, and hex color code. I figured this would be 32 bits (4 bytes) of information per pixel (4 bits for row, 4 bits for column, 24 bits for hex color code). As memory is an issue here, the goal is to store the animation "files" on the computer, and when requested, transfer them onto the board via the serial connection. It is not wanted to store the animations on the board itself as they need to be easily updatable and flashing the board every time a new animation is created/wanted is not ideal.

Back to my question. If I transfer data over the serial connection (an animation), and store this inside an array (collection of frames) in order to play on the LEDs, where is this actually stored? Am I working with the dynamic memory (6 KB) or the program storage space (48 KB), or something different?

Warning, I am asking questions, not answering your big one.

What frame rate do you hope to achieve? How long in frames might they need to be?

What is the nature of one frame? If there are only a few pixels in a frame, it makes sense to encode row, column and color… at a certain point it will be better to think about smarter organization and encoding, like runs of one color, or exploitable patterns within a frame or frame to frame coherence.

Are there anything like longer loops that repeat within an animation? How about if you had background and foreground, can the motion be isolated and reduced and therefor represented with less data?

Do you actually need to use 16 million colors? Perhaps fewer bits per color or lookup tables of a smaller set of colors you could store by index?

Etcetera. You may have more time than space. The speed of the Arduino might amaze you, and faster fully compatible boards exist, with the extra benefit of larger memory of both kinds.

Hardware be cheap.

What happens in between animations? I mean when you download a new one, and what time are you hoping to stay within for doing?

If you wouldn’t have to kill us after doing, please tell us a whole bunch more about the desired goal(s).

a7

Why store in PC? Why not text file in micro SD card connected to Arduino? Several GB will enough.

Framerate: Right now, I have it set to delay 100ms after every "frame". The entire purpose is to play an "animation", such as a single firework going up and popping or something similar.

Frames: I started with encoding individual pixels. Obviously I leave out pixels that aren't illuminated in that frame, so I'm only specifying ones that are. In the future, I might utilize the GFX library more heavily and encode basic shapes (squares, circles, rectangles, etc). So instead of specifying all pixels in a line, I could just write a custom command for "draw line starting here and going there" which would save a bunch of space as well. Thank you for your input, I definitely need to think more on the encoding scheme and how best represent the data, and I was hoping someone would respond like what you had done.

Animations: They can be custom made, so I have to expect anything. However, like I mentioned above, I could write some code to encode a giant background color as a single command and utilize the GFX library to draw that, instead of specify all 256 pixels be a certain color.

Colors: Nope, I can definitely reduce that down depending on the project requirements. It might be useful to even program that in (choose the number of colors you wish to have) and have it default to Just 16 bits instead of the 24 bits.

Unfortunately, I am kind of stuck with this hardware. I am in a production environment so the hardware chosen was chosen for a reason (cost, licencing, etc). I have talked to them about soldering on a SD card slot to the board depending on what I can achieve with what I have, but that's more down the line. Of course, that would help a ton and would allow me not to even worry about this kind of stuff.

Animations again: Animations are just set on a loop. IE an animation has 10 frames, after frame 10, maybe sleep for 500ms and then start from frame 1 again. I have a shim program running on the computer (not the board) that will capture events. My goal is to have a user interact with the computer, have them trigger some event, and then based on that event play a certain animation. I was also worried about this, since I can't store all the animations on the arduino, they have to be passed through the serial connection to the board to play, so I'm hoping the connection is fast enough so there isn't that much of a noticable "delay" between an event being triggered on the computer and the animation starting on the LEDs. Also, the user is indirectly triggering events, meaning it does not need to be millisecond perfect since they "don't know" the exact moment they are triggering an event. Of course, if the user does something on the system and it takes 5 or 10 seconds, that would probably not be acceptable. But delays of at most I'd say 2 seconds would probably be fine.

If you have any more questions, let me know!! Thank you so much for them.

I'm in a production environment, so I do not have control over what is connected to the board. I did suggest this idea but I'd like to see how far I can get without an SD card. If one is definitely needed, requirements can change but I'd have to ask.

But again, yes, as the developer and not the hardware engineer I wish I could have that SD card connection because it would make my life a lot easier!

If you need 4 bytes/pixel for a 16x16 display, that is 1024 bytes/frame.
If you baud rate is 115200, that is about 11,520 chars/sec to 1 frame will take about 90 msec to transfer. That gives you 10 ms to do other stuff which is a lot for a MCU.

As for where that would go, it would go into SRAM so you will use up a large chunk of your 6K available. Plus, depending on the library and the structure of your code, you may have the current buffer + the receive buffer.

A lookup table of full 24 bit colors could hold the 16 (4 bits per color number) or 256 (8 bits) unique colors you are interested in.

So you store the color number for the pixel, then look up (index) the actual RGB to feed to the smart pixel.

A common technique from the 20th century when memory was dear. :slight_smile:

Also known as a palette or CLUT.

a7

1 Like

Just idea. Frames on PC (like picture maybe), Processing read these frames and sending data to Arduino over USB/serial.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.