0

Grand Central, RGB Matrix hardware requirements?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Grand Central, RGB Matrix hardware requirements?

by pplusa on Tue Mar 02, 2021 5:20 pm

I'm working on getting a display set up as part of a larger project, but I'm not super clear on Arduino/Arduino-like models these days versus the models listed in the 32x32 RGB matrix guides.

Is this hardware appropriate for getting a Grand Central controlling a 32x32 matrix?

If so, should I follow the Metro M4 notes in the Matrix Shield Guide (https://learn.adafruit.com/32x16-32x32- ... rix-shield - cut the CLK jumper and run a wire from CLK to Analog 4)?

I have:
  • Metro M4 Grand Central - product id 4064
  • Ethernet shield - product id 2971 (for ethernet communications with the larger system)
  • RGB Matrix Shield - product id 2601
  • 32x32 RGB Matrix - product id 2026

I'm woefully out of practice on the hardware end of this stuff, and just want to be sure so I don't brick something when I start powering it up and coding :D. I'm planning on using the libraries noted in the guide above - RGB Matrix Panel library, Adafruit GFX library, and Adafruit BusIO.

Thanks!

pplusa
 
Posts: 9
Joined: Tue Mar 02, 2021 5:04 pm

Re: Grand Central, RGB Matrix hardware requirements?

by dastels on Tue Mar 02, 2021 7:56 pm

Yes, I suspect the MetroM4 approach would work with the GrandCentral since it just uses a bigger SAMD51.

Take it one step at a time. Get the matrix running, then add in the ethernet support.

Dave

dastels
 
Posts: 6520
Joined: Tue Oct 20, 2015 3:22 pm

Re: Grand Central, RGB Matrix hardware requirements?

by pplusa on Wed Mar 03, 2021 4:36 pm

Perfect, thanks! I'll run with that and check in with details once I have it working.

pplusa
 
Posts: 9
Joined: Tue Mar 02, 2021 5:04 pm

Re: Grand Central, RGB Matrix hardware requirements?

by pplusa on Thu Mar 04, 2021 12:12 am

I had to hack it a bit (that's what we're here for though right?) but got the 32x32 RGB Matrix, with the RGB Matrix Shield, working with it using the libraries from the Learn page noted in the original post.

One tweaky bit was that I had to adjust a line from the library as noted in this post: viewtopic.php?f=47&p=743951

It looks like that change never made it into the official Adafruit RGB Matrix Panel library, and I normally use other languages so there might be a better way (as was Alkerion's concern), but it works (note his line numbers are off now due to library updates - swapping the pins in the
Code: Select all | TOGGLE FULL SIZE
defaultrgbpins[]
array still works though). I'm not quite sure, but from some other digging and scattered comments, it seems like something with I2C compatibility? Without the changes, it was crashing at
Code: Select all | TOGGLE FULL SIZE
matrix.begin();
(freezing up and disconnecting from the USB until pressing reset twice).

At that point, I cut the CLK, R1, R2,G1, G2, B1, B2 jumpers and added jumper cables between the Grand Central and the RGB Matrix Shield as follows:

27: CLK
32: R1
33: G1
34: B1
35: R2
36: G2
37: B2

From the Learn page, instead of
Code: Select all | TOGGLE FULL SIZE
#define CLK  8
(Or A4 or 11), I'm using:
Code: Select all | TOGGLE FULL SIZE
#define CLK  27
.

My preference to still using the shield versus jumpers straight to the ribbon cable is largely for appearance. Less of a rats nest with 7 jumpers versus 16, and I plan to either add shorter jumpers with and headers to the shield, or fabricate a custom shield with the updated schematics.

On to the networking bit. If I encounter any wonkiness from adding that I'll post another update. Otherwise the above is able to get the Adafruit Grand Central M4 Express with Adafruit RGB Matrix Shield working.

pplusa
 
Posts: 9
Joined: Tue Mar 02, 2021 5:04 pm

Re: Grand Central, RGB Matrix hardware requirements?

by dastels on Thu Mar 04, 2021 9:56 am

Awesome work!

Dave

dastels
 
Posts: 6520
Joined: Tue Oct 20, 2015 3:22 pm

Re: Grand Central, RGB Matrix hardware requirements?

by pplusa on Fri Mar 05, 2021 6:46 pm

Can't edit my previous comment, but code update for anyone that finds this in the future. Turns out there's an alternate constructor in the RGBmatrixPanel class that accepts a custom pin array (and panel width) - so you don't need to modify the library for use with the Grand Central. Didn't see it noted in the docs or used in examples, but I grabbed a Visual Studio plugin for Arduino and spotted it with intellisense.

Complete code for getting everything set up with the Grand Central, using the hardware notes above:

Code: Select all | TOGGLE FULL SIZE
#define CLK  27  // Grand Central: 23, 25, 26 or 27 for the CLK (match whatever pin you plug into).
#define OE   9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define D   A3

uint8_t rgbpins[] = { 32, 33, 34, 35, 36, 37 };
uint8_t panelwidth = 32;
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, panelwidth, rgbpins);

void setup() {
    matrix.begin();
    // Ready for use, draw whatever you want where appropriate (here, in loop, in a function call, etc.)
}

pplusa
 
Posts: 9
Joined: Tue Mar 02, 2021 5:04 pm

Re: Grand Central, RGB Matrix hardware requirements?

by kgrove on Fri Mar 05, 2021 10:49 pm

I'm in the process of attempting the same thing, but without the ethernet set up. Using the Grand Central for running some game mode logic and a 64 x 32 LED Matrix for displaying score/timer.

I'm not too familiar with arduino language, but definitely gonna look into it.

Is it necessary to use with CircuitPython? I've never setup something like this before, so I don't really know where to start.

kgrove
 
Posts: 50
Joined: Wed Feb 17, 2021 4:51 pm

Re: Grand Central, RGB Matrix hardware requirements?

by kgrove on Fri Mar 05, 2021 10:49 pm

I'm in the process of attempting the same thing, but without the ethernet set up. Using the Grand Central for running some game mode logic and a 64 x 32 LED Matrix for displaying score/timer.

I'm not too familiar with arduino language, but definitely gonna look into it.

Is it necessary to use with CircuitPython? I've never setup something like this before, so I don't really know where to start.

kgrove
 
Posts: 50
Joined: Wed Feb 17, 2021 4:51 pm

Re: Grand Central, RGB Matrix hardware requirements?

by kgrove on Fri Mar 05, 2021 10:52 pm

Also, what was the plugin called you found on VS Code?

kgrove
 
Posts: 50
Joined: Wed Feb 17, 2021 4:51 pm

Re: Grand Central, RGB Matrix hardware requirements?

by pplusa on Sat Mar 06, 2021 12:14 am

kgrove wrote:Using the Grand Central for running some game mode logic and a 64 x 32 LED Matrix for displaying score/timer.

The only modification you should need to make from what I have above is the int width = 32; should be int width = 64; for you.

kgrove wrote:Is it necessary to use with CircuitPython? I've never setup something like this before, so I don't really know where to start.

Nope - this is all C++ for Arduino code. In the pages for the Grand Central and RGB matrix you can find the Learn doc links - they mostly cover everything in regards to code, just swap in my bits above for the pinout and CLK modifications, and RGB Matrix Shield modifications (if you're using it). All the libraries referenced and so on are correct in the docs though.

If you manage to do something quirky with it and it seems like it's locking up or disconnecting from your computer, double-pressing the Reset button will get you back to bootloader mode and let you connect to it again :D

Simple text display is pretty straight forward - the Adafruit testshapes demo covers some basics on writing text in different colors, wrapping modes, positions, and sizes. One note for colors: only use matrix.Color333(0-7, 0-7, 0-7) or matrix.Color444(0-255, 0-255, 0-255) (both are R,G,B). The HSV color used in some examples isn't fully supported due to some type conversion wonkiness in the background. Color444 is the most accurate between what you punch in and what gets returned from the manipulations.

kgrove wrote:Also, what was the plugin called you found on VS Code?

Sorry, I should have clarified - I'm using Visual Studio 2019, not VS Code. The plugin doesn't appear to be available for VS Code, although the Visual Studio 2019 Community (a.k.a. free) edition can use the plugin if you're using a Windows machine.
The plugin though is Visual Micro: https://www.visualmicro.com/ - 45 day trial, cheap for hobbyist/student use after that. Completely replaces the Arduino IDE, so I can handle the entire project through one IDE (multiple Arduino devices, cloud server, web API, etc. too). For my use it was completely worth it just in the time it saves me over the Arduino IDE.

pplusa
 
Posts: 9
Joined: Tue Mar 02, 2021 5:04 pm

Re: Grand Central, RGB Matrix hardware requirements?

by kgrove on Thu Mar 11, 2021 2:13 pm

I was hoping to tweak my Grand Central w/ headers slightly (it hasn't been delivered yet). Though, in doing so, would I still be able to set different pin locations different from what you provided, or are these predetermined? For example, I wanted to set the pin numbers to 14-20:
14: CLK
15: R1
16: G1
etc.

pplusa wrote:At that point, I cut the CLK, R1, R2,G1, G2, B1, B2 jumpers and added jumper cables between the Grand Central and the RGB Matrix Shield as follows:

27: CLK
32: R1
33: G1
34: B1
35: R2
36: G2
37: B2

From the Learn page, instead of
Code: Select all | TOGGLE FULL SIZE
#define CLK  8
(Or A4 or 11), I'm using:
Code: Select all | TOGGLE FULL SIZE
#define CLK  27
.

My preference to still using the shield versus jumpers straight to the ribbon cable is largely for appearance. Less of a rats nest with 7 jumpers versus 16, and I plan to either add shorter jumpers with and headers to the shield, or fabricate a custom shield with the updated schematics.

On to the networking bit. If I encounter any wonkiness from adding that I'll post another update. Otherwise the above is able to get the Adafruit Grand Central M4 Express with Adafruit RGB Matrix Shield working.

kgrove
 
Posts: 50
Joined: Wed Feb 17, 2021 4:51 pm

Re: Grand Central, RGB Matrix hardware requirements?

by pplusa on Thu Mar 11, 2021 3:14 pm

kgrove wrote:would I still be able to set different pin locations different from what you provided, or are these predetermined?


You should be able to - I haven't tested all the pins but there is at least some flexibility in it. For example, it's looking like there will be some conflict with the ethernet shield so I moved the analog pins to A12-15. That will let me just knock out a custom tail-only shield to keep the profile thinner too.

As of right now, this is my pinout that's working:

Code: Select all | TOGGLE FULL SIZE
#define CLK  27
#define OE   26
#define LAT 28
#define A   A12
#define B   A13
#define C   A14
#define D   A15

uint8_t rgbpins[] = { 32, 33, 34, 35, 36, 37 }; // R1, G1, B1, R2, G2, B2


I did try RGB on 48-53 but wasn't having any luck, but I haven't tried 14-21 yet. I assume there's something specific that I'm just not hardware savvy enough to know yet, but I'd also assume other pins would work with some trial and error.

pplusa
 
Posts: 9
Joined: Tue Mar 02, 2021 5:04 pm

Re: Grand Central, RGB Matrix hardware requirements?

by kgrove on Thu Mar 18, 2021 5:30 pm

So, I finally got all the connections and the 32x64 LED Matrix hooked up.

So I believe I have everything hooked up correctly:
[*] Made connections from the RGB Matrix Shield to the GC M4:
32: R1
33: G1
34: B1
35: R2
36: G2
37: B2
[*] Connected the RGB Matrix Shield to 5V and GND
[*] Made the jump from CLK to A4
[*] CLK is hooked up to pin 27 on the GC
[*] I select my Board and Port in the Arduino IDE

As for the 16x32 RGB Matrix lesson, I've made it to the test example code page. When I get here "Now you are ready to test! Open up the IDE and load File→Examples→RGBmatrixPanel→testcolors_16x32 (for the 16x32 panel) or File→Examples→RGBmatrixPanel→colorwheel_32x32 (for the 32x32 panel).", I instead choose File→Examples→RGBmatrixPanel→testshapes_32x64. Then I modify this code
Code: Select all | TOGGLE FULL SIZE
// testshapes demo for RGBmatrixPanel library.
// Demonstrates the drawing abilities of the RGBmatrixPanel library.
// For 32x64 RGB LED matrix.

// WILL NOT FIT on ARDUINO UNO -- requires a Mega, M0 or M4 board

#include <RGBmatrixPanel.h>

// Most of the signal pins are configurable, but the CLK pin has some
// special constraints.  On 8-bit AVR boards it must be on PORTB...
// Pin 11 works on the Arduino Mega.  On 32-bit SAMD boards it must be
// on the same PORT as the RGB data pins (D2-D7)...
// Pin 8 works on the Adafruit Metro M0 or Arduino Zero,
// Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB
// Matrix Shield, cut trace between CLK pads and run a wire to A4).

#define CLK  8   // USE THIS ON ADAFRUIT METRO M0, etc.
//#define CLK A4 // USE THIS ON METRO M4 (not M0)
//#define CLK 11 // USE THIS ON ARDUINO MEGA
#define OE   9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define D   A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);

void setup() {

  matrix.begin();

  // draw a pixel in solid white
  matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
  delay(500);

  // fix the screen with green
  matrix.fillRect(0, 0, matrix.width(), matrix.height(), matrix.Color333(0, 7, 0));
  delay(500);

  // draw a box in yellow
  matrix.drawRect(0, 0, matrix.width(), matrix.height(), matrix.Color333(7, 7, 0));
  delay(500);

  // draw an 'X' in red
  matrix.drawLine(0, 0, matrix.width()-1, matrix.height()-1, matrix.Color333(7, 0, 0));
  matrix.drawLine(matrix.width()-1, 0, 0, matrix.height()-1, matrix.Color333(7, 0, 0));
  delay(500);

  // draw a blue circle
  matrix.drawCircle(10, 10, 10, matrix.Color333(0, 0, 7));
  delay(500);

  // fill a violet circle
  matrix.fillCircle(40, 21, 10, matrix.Color333(7, 0, 7));
  delay(500);

  // fill the screen with 'black'
  matrix.fillScreen(matrix.Color333(0, 0, 0));

  // draw some text!
  matrix.setTextSize(1);     // size 1 == 8 pixels high
  matrix.setTextWrap(false); // Don't wrap at end of line - will do ourselves

  matrix.setCursor(8, 0);    // start at top left, with 8 pixel of spacing
  uint8_t w = 0;
  char *str = "AdafruitIndustries";
  for (w=0; w<8; w++) {
    matrix.setTextColor(Wheel(w));
    matrix.print(str[w]);
  }
  matrix.setCursor(2, 8);    // next line
  for (w=8; w<18; w++) {
    matrix.setTextColor(Wheel(w));
    matrix.print(str[w]);
  }
  matrix.println();
  //matrix.setTextColor(matrix.Color333(4,4,4));
  //matrix.println("Industries");
  matrix.setTextColor(matrix.Color333(7,7,7));
  matrix.println("LED MATRIX!");

  // print each letter with a rainbow color
  matrix.setTextColor(matrix.Color333(7,0,0));
  matrix.print('3');
  matrix.setTextColor(matrix.Color333(7,4,0));
  matrix.print('2');
  matrix.setTextColor(matrix.Color333(7,7,0));
  matrix.print('x');
  matrix.setTextColor(matrix.Color333(4,7,0));
  matrix.print('6');
  matrix.setTextColor(matrix.Color333(0,7,0));
  matrix.print('4');
  matrix.setCursor(34, 24);
  matrix.setTextColor(matrix.Color333(0,7,7));
  matrix.print('*');
  matrix.setTextColor(matrix.Color333(0,4,7));
  matrix.print('R');
  matrix.setTextColor(matrix.Color333(0,0,7));
  matrix.print('G');
  matrix.setTextColor(matrix.Color333(4,0,7));
  matrix.print('B');
  matrix.setTextColor(matrix.Color333(7,0,4));
  matrix.print('*');

  // whew!
}

void loop() {
  // Do nothing -- image doesn't change
}


// Input a value 0 to 24 to get a color value.
// The colours are a transition r - g - b - back to r.
uint16_t Wheel(byte WheelPos) {
  if(WheelPos < 8) {
   return matrix.Color333(7 - WheelPos, WheelPos, 0);
  } else if(WheelPos < 16) {
   WheelPos -= 8;
   return matrix.Color333(0, 7-WheelPos, WheelPos);
  } else {
   WheelPos -= 16;
   return matrix.Color333(WheelPos, 0, 7 - WheelPos);
  }
}


Right before the
Code: Select all | TOGGLE FULL SIZE
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);


I add
Code: Select all | TOGGLE FULL SIZE
uint8_t rgbpins[] = { 32, 33, 34, 35, 36, 37 };


and also add 'rgbpins' to the 10th argument of the matrix()

I hit upload, then it throws this error
Code: Select all | TOGGLE FULL SIZE
Sketch uses 26544 bytes (2%) of program storage space. Maximum is 1032192 bytes.
Device       : ATSAMD51x20
Version      : v1.1 [Arduino:XYZ] Jun 23 2019 17:45:08
Address      : 0x0
Pages        : 2048
Page Size    : 512 bytes
Total Size   : 1024KB
Planes       : 1
Lock Regions : 32
Locked       : none
Security     : false
BOD          : false
BOR          : true
Write 26816 bytes to flash (53 pages)
[====                          ] 15% (8/53 pages)
SAM-BA operation failed
An error occurred while uploading the sketch


Then disconnects the M4 and I have to reboot it.

Is it trying to take up all of the storage space on the M4? Is there something I'm missing here?

kgrove
 
Posts: 50
Joined: Wed Feb 17, 2021 4:51 pm

Re: Grand Central, RGB Matrix hardware requirements?

by kgrove on Fri Mar 19, 2021 5:13 pm

So I just realized I need to make the OE, LAT, A, B, C, D connections as well. Still new at this...

Based on the jump modification in the attached photo, I am assuming you also attach a jump from the M4 to the outside pin hole.

If this is true, is it safe to solder connections from all outside pin holes (OE, LAT, A, B, C, D) to the M4?
Attachments
image (1).png
image (1).png (717.79 KiB) Viewed 105 times

kgrove
 
Posts: 50
Joined: Wed Feb 17, 2021 4:51 pm

Re: Grand Central, RGB Matrix hardware requirements?

by pplusa on Mon Mar 22, 2021 10:56 am

kgrove wrote:So I just realized I need to make the OE, LAT, A, B, C, D connections as well. Still new at this...

Based on the jump modification in the attached photo, I am assuming you also attach a jump from the M4 to the outside pin hole.

If this is true, is it safe to solder connections from all outside pin holes (OE, LAT, A, B, C, D) to the M4?


Sorry, got caught up with work and life stuff.

Basically cut the jumpers for any pins you're using elsewhere (i.e. OE, LAT, A, B, C, D, RGB 0 & 1). At that point, if you look towards the center of the shield, there are holes right next to the jumpers. If you have actual jumpers, use them and just solder a pin into the inner hole matching whichever pin you're using (i.e. solder the inner CLK hole to one pin on the jumper, plug it in to pin 27 on the Grand Central). Anything from an inner pin to outer pin with the same name has a trace between them so you need to break the jumper if you're soldering it to a different pin.

In the sample photo they're using A4 as the CLK, which is why they cut the jumper (severing the built-in connection from the inner CLK to Digital 8) and solder a wire from A4 to the inner CLK pin spot.

Personally, what I wound up doing, was cutting a protoboard to fit the tail of the Grand Central behind the ethernet shield, adding header pins to it, then soldering wire from the header pins to the 2x8 connector. I'm glad I got the shield to learn how it worked, but with all the customizations it wasn't really needed in the end.

The attached fritz image has a slightly different pinout than I've been using - same pins are in-use but I swapped a couple around to make fabricating a circuit board a little easier. You can effectively use male-to-female jumper wires in the same way, you'll just need 2 extra for the extra grounds pins on the connector. Note the slot in the connector is on the top in the image facing the Arduino, and you'll plug the jumpers into the pins on the bottom of the connector (orientation matters - the wires in the fritz just go to the top of the pins so you can see them).
Attachments
Display Shield Fritz.jpg
Display Shield Fritz.jpg (95.67 KiB) Viewed 91 times

pplusa
 
Posts: 9
Joined: Tue Mar 02, 2021 5:04 pm

Please be positive and constructive with your questions and comments.


cron