Ws2812b 8x32 chain using NEO_TILES

Hi there,

I’m trying to chain multiple neopixel panels together to create a RSS feed with code flashed to my Adriano nano, pushed via usb from my Raspberry Pi.. I’ve already verified I have my configuration correct for the matrixes and the tile format via the “Howdy” example provided in the neomatrix library.

However when I try to implement this same configuration to the code I am working with, I get no results on either panel. If I set the configuration back to a single panel, life is good, so I’m obviously missing something here.

The source code provided was intended to run on (3) chained 8x8 matrices, and I believe that may be part of the problem.

I owe anyone that can help me with a bucketload of thanks, since this little Christmas project has become quite overwhelming!

Here is the code I’m trying to run, with (2) 8x32 matrices chained together:

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>

#define PIN 6

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, 2, 1, PIN,
NEO_TILE_TOP + NEO_TILE_LEFT + NEO_TILE_ROWS + NEO_TILE_PROGRESSIVE +
NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);

const uint16_t colors[] = {
matrix.Color(250, 0, 0)};

const byte numChars = 128;
char receivedChars[numChars]; // an array to store the received data
boolean newData = false;
String data;
int x = matrix.width();

void setup() {
Serial.begin(9600);
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(40);
matrix.setTextColor(colors[0]);
matrix.fillScreen(0);
matrix.show();
}

void loop() {
recvWithEndMarker();
showNewData();
}

void recvWithEndMarker() {
static byte ndx = 0;
char endMarker = '\n';
char rc;

while (Serial.available() > 0 && newData == false) {
rc = Serial.read();
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
ndx = 0;
newData = true;
}
}
}

void scroll(String text){
//scrolling text
matrix.setTextColor(colors[0]);
int len = text.length();
for(int i=24;i>(len*(-6));i--){
matrix.fillScreen(0);
matrix.setCursor(i, 0);
matrix.print(text);
matrix.show();
delay(30);
}
}

void showNewData() {
if (newData == true) {
Serial.print("Just received: ");
Serial.println(receivedChars);
data = receivedChars;
newData = false;
scroll(data);
}
}

I don't think you will be able to do this on a nano. Each 32x8 matrix will need 32 x 8 x 3 = 768 bytes of dynamic memory, so two panels need 1536. Your sketch already shows 501 bytes of dynamic memory being used, so you are exceeding the total 2048 bytes before you even start. Your sketch will run as written on a Nano Every, which has 6k of dynamic memory, and is the same size as a nano. (I don't have any of the 32x8 matrix panels for testing, but I do get output to a neopixel strip).

Also, avoid using the String class for the variable data, it should work as a char array, the same way you have receivedChars defined.

(edit)
Alternately, you may be able to drive the neopixels from the raspberry pi and eliminate the arduino entirely.

Thank you for your reply and insight!

Just to confirm, you’re saying my nano’s memory is dependent on my sketch, and multiplied by the amount of panels I’m trying to drive (more or less)?

Just curious, I don’t know the amount of dynamic memory used offhand, but the “tutorial” from adafruit worked fine. But I also understand that was printing a simple message vs pulling text from an RSS feed.

Furthermore, I may be barking up the wrong tree entirely, since my end goal is to link 5 of these panels together.

The internet makes things look so easy!

Thank you again for your insight!

Each pixel will need 3 bytes of dynamic memory. Each 32 x 8 panel has 256 pixels, so you need 768 bytes of memory per panel. Five panels will require 768 x 5 = 3840 bytes of memory. The nano only has 2048 bytes of memory, so will not work. You need something with more memory (such as a mega, which has 8192 bytes).

Also consider that each pixel will need approximately 60mA of current for full brightness white color, or approximately 15.36 amps per panel. although you will likely need considerably less with a scrolling text display since most pixels will be off at any given time.

Thank you again for your input!

I’ve got my power supply situation all figured out.

I have a mega on order, and hopefully life will be good.

David,

I concur with you on this post, but I am vexed by it.

I have been writing a programme that controls four 8x8 matrix’s and it works perfectly on a Mega after failing on an UNO.

However, I have been monitoring memory usage after using PROGMEM to store arrays etc outside of SRAM. The result is that it reports I have 5700kb of free memory, so I thought I would switch to a Arduino Micro, which you will likely know has 2500kb of SRAM. This would mean that I have around 300kb spare. Alas, it doesn’t work on the Micro but I can’t see why. I have monitored SRAM at different locations within my code, and throughout memory usage is fairly static.

Any thoughts would be appreciated.

Regards,

Christopher

so I thought I would switch to a Arduino Micro, which you will likely know has 2500kb of SRAM

I think that would come as a surprise to everyone, it has 2.5 K of memory.

have monitored SRAM at different locations within my code, and throughout memory usage is fairly static.

Show us how you are doing this in your code.

Is it monitoring the space between the stack and the heap?
The compiler report can’t detect memory allocated dynamically after compilation. Like declaring an array for the LED’s buffer.