[REVIEW] LED Matrix 4x64 Module with MAX7219

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

[REVIEW] LED Matrix 4x64 Module with MAX7219

#1 Post by SimPassion »

 
Just want to share this compact 4 x MAX7219 Modules board layout with 8x8 LEDs output each, so an overall of 4x64 = 256 LEDs output

Indeed they come with dedicated 64 LEDs matrix modules on each, though the whole can be diverted to use 256 individual LED output through a LED matrix shown below
The 4 x MAX7219 board module can also be chained
The only limitation to be aware and I've found, while performing testing, is we get some display issue starting from the 5th chained module, however it work fine up to 4 x chained whole 4 x MAX7219 board, so up to 4 x 256 = 1024 LEDs in one chain. I guess the issue is similar to the well known power line issue, so we have to separate the power line for each individual 4 x MAX7219, which I haven't done during my testing. Perhaps I'll have more time later, for a proper new testing with mentioned condition

This board requires MD_MAX72XX Library by majicDesigns https://github.com/MajicDesigns/MD_MAX72XX
The HARDWARE_TYPE has to be switched from default "MD_MAX72XX::PAROLA_HW" to "MD_MAX72XX::FC16_HW" in order to work properly
And MAX_DEVICES have to be set to the MAX7219 board to be used in the chain, where a single 4 x MAX7219 board count as 1 device only

Code: Select all

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 16
Coming from here : https://www.az-delivery.de/en/products/ ... ix-display

image.png
LED_Matrix_4x64_02.jpg
LED_Matrix_4x64_03.jpg
LED_Matrix_4x64_04.png
LED_Matrix_4x64_05.png
 

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#2 Post by SimPassion »

Just updated screenshots above to incorporate pinout

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#3 Post by jph »

Hello Gilles
Great stuff,
I am trying to dig out my old info on these units which I still use as they are superb and cheap!.

The best lib, in my opinion, to use for the ardunio IDE for these is the 'ledcontrol' library.
You can install it from the standard lib install
example for install from lib manager from the ide -
ledcontrol.jpg
I also have a mssageport lib if you are interested for direct control ?
they are really useful units.

It is great to see someone using them.
Some observations from a while back.
They DO suffer from data degradation do to the lack of smoothing caps on VCC.
The faster the processor and the faster the SPI speed the more the issue is shown,
To get around this then simply add 10uF caps as shown.
With these in place I can use hardware SPI addressing with a pico up to 10MHz !. with no issues.

Pics of added electrolytic smoothing capacitors.

(sorry the pics are crap as my phone is too old haha :)
IMG_20221228_090311865.jpg
IMG_20221228_090323302.jpg
IMG_20221228_090332356.jpg
Joe. CISSP, MSc.

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#4 Post by SimPassion »

Hi Joe, thanks for the head-up, definitely a well-known issue for which I forgot to add the capacitor on each module, as it's always the same for any MAX7219 board
Here's a quick shot of a current real project for commercial advertising, for which, as said on top of the thread, I encountered some display issue. I guess when fixed, things will get better
I have 6 Led Matrix 8x32 modules at the moment and the issue starts after the 4th
I will come again here, later in the day on it, as I have to go out of home right at the moment.

Advertise_Project_01.jpg
 

User avatar
Keith Baxter
Posts: 4671
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#5 Post by Keith Baxter »

Hi,

AM only supports up to 4 MAX7219 devices.
Might do more using MP.
ice_screenshot_20221228-163755.png
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#6 Post by SimPassion »

Keith Baxter wrote: Wed Dec 28, 2022 2:37 pm Hi,

AM only supports up to 4 MAX7219 devices.
Might do more using MP.

ice_screenshot_20221228-163755.png

Keith
Thanks Keith, for this one in the current WIP, I will enhance the mockup with final rewire, capacitors added as mentioned, additional potentiometer, with an already working Arduino sketch
Indeed the usage of such module for flight simulation will be a bit different and I do think of specific library to get individual leds addressing,perhaps like the one Joe mentioned and obviously MessagePort usage as you stated

Here's my current adjustment of an existing AZ Delivery sample

Code: Select all

// Use the MD_MAX72XX library to scroll text on the display
//
// Demonstrates the use of the callback function to control what
// is scrolled on the display text.
//
// User can enter text on the serial monitor and this will display as a
// scrolling message on the display.
// Speed for the display is controlled by a pot on SPEED_IN analog in.
//
#include <MD_MAX72xx.h>
#include <SPI.h>

#define IMMEDIATE_NEW   0     // if 1 will immediately display a new message
#define USE_POT_CONTROL 1
#define PRINT_CALLBACK  0

#define PRINT(s, v) { Serial.print(F(s)); Serial.print(v); }

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 16

#define CLK_PIN   13  // or SCK
#define DATA_PIN  11  // or MOSI
#define CS_PIN    10  // or SS

// SPI hardware interface
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary pins
//MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

// Scrolling parameters
#if USE_POT_CONTROL
#define SPEED_IN  A5
#else
#define SCROLL_DELAY  75  // in milliseconds
#endif // USE_POT_CONTROL

#define CHAR_SPACING  1 // pixels between characters

// Global message buffers shared by Serial and Scrolling functions
#define BUF_SIZE  255
//uint8_t curMessage[BUF_SIZE] = { "Init : Set Message |                                     | " };
uint8_t curMessage[BUF_SIZE] = { "Welcome to our offices - SALES DIVISION: Saturday 09:30-12:00 (1st/3rd Saturday & 4th Saturday based on month) - WOOD Workshop : Friday 14:30-17:00 (1st/3rd & 4th Friday of month) |                                     | " };
uint8_t newMessage[BUF_SIZE];
bool newMessageAvailable = false;

uint16_t  scrollDelay;  // in milliseconds

void readSerial(void)
{
  static uint8_t  putIndex = 0;

  while (Serial.available())
  {
    newMessage[putIndex] = (char)Serial.read();
    if ((newMessage[putIndex] == '\n') || (putIndex >= BUF_SIZE-3)) // end of message character or full buffer
    {
      // put in a message separator and end the string
      newMessage[putIndex++] = ' ';
      newMessage[putIndex] = '\0';
      // restart the index for next filling spree and flag we have a message waiting
      putIndex = 0;
      newMessageAvailable = true;
    }
    else if (newMessage[putIndex] != '\r')
      // Just save the next char in next location
      putIndex++;
  }
}

void scrollDataSink(uint8_t dev, MD_MAX72XX::transformType_t t, uint8_t col)
// Callback function for data that is being scrolled off the display
{
#if PRINT_CALLBACK
  Serial.print("\n cb ");
  Serial.print(dev);
  Serial.print(' ');
  Serial.print(t);
  Serial.print(' ');
  Serial.println(col);
#endif
}

uint8_t scrollDataSource(uint8_t dev, MD_MAX72XX::transformType_t t)
// Callback function for data that is required for scrolling into the display
{
  static uint8_t* p = curMessage;
  static enum { NEW_MESSAGE, LOAD_CHAR, SHOW_CHAR, BETWEEN_CHAR } state = LOAD_CHAR;
  static uint8_t  curLen, showLen;
  static uint8_t  cBuf[15];
  uint8_t colData = 0;    // blank column is the default

#if IMMEDIATE_NEW
  if (newMessageAvailable)  // there is a new message waiting
  {
    state = NEW_MESSAGE;
    mx.clear(); // clear the display
  }
#endif

  // finite state machine to control what we do on the callback
  switch(state)
  {
    case NEW_MESSAGE:   // Load the new message
      memcpy(curMessage, newMessage, BUF_SIZE);	// copy it in
      newMessageAvailable = false;    // used it!
      p = curMessage;
      state = LOAD_CHAR;
      break;

    case LOAD_CHAR: // Load the next character from the font table
      showLen = mx.getChar(*p++, sizeof(cBuf)/sizeof(cBuf[0]), cBuf);
      curLen = 0;
      state = SHOW_CHAR;

      // if we reached end of message, opportunity to load the next
      if (*p == '\0')
      {
        p = curMessage;     // reset the pointer to start of message
#if !IMMEDIATE_NEW
        if (newMessageAvailable)  // there is a new message waiting
        {
          state = NEW_MESSAGE;    // we will load it here
          break;
        }
#endif
      }
      // !! deliberately fall through to next state to start displaying

    case SHOW_CHAR: // display the next part of the character
      colData = cBuf[curLen++];
      if (curLen == showLen)
      {
        showLen = CHAR_SPACING;
        curLen = 0;
        state = BETWEEN_CHAR;
      }
      break;

    case BETWEEN_CHAR: // display inter-character spacing (blank columns)
      colData = 0;
      curLen++;
      if (curLen == showLen)
        state = LOAD_CHAR;
      break;

    default:
      state = LOAD_CHAR;
  }

  return(colData);
}

 void scrollText(void)
{
  static uint32_t	prevTime = 0;

  // Is it time to scroll the text?
  if (millis()-prevTime >= scrollDelay)
  {
    mx.transform(MD_MAX72XX::TSL);  // scroll along - the callback will load all the data
    prevTime = millis();      // starting point for next time
  }
}

uint16_t getScrollDelay(void)
{
#if USE_POT_CONTROL
  uint16_t  t;

  t = analogRead(SPEED_IN);
  t = map(t, 0, 1023, 25, 250);

  return(t);
#else
  return(SCROLL_DELAY);
#endif
}

void setup()
{
  mx.begin();
  mx.setShiftDataInCallback(scrollDataSource);
  mx.setShiftDataOutCallback(scrollDataSink);

#if USE_POT_CONTROL
  pinMode(SPEED_IN, INPUT);
#else
  scrollDelay = SCROLL_DELAY;
#endif

  newMessage[0] = '\0';

  Serial.begin(57600);
  Serial.print("\n[MD_MAX72XX Message Display]\nType a message for the scrolling display\nEnd message line with a newline");
}

void loop()
{
  scrollDelay = getScrollDelay();
  readSerial();
  scrollText();
}

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#7 Post by jph »

Hi Both,
Gilles, yes, I see now you are using the old lib for the AVR devices for scrolling text. very nice. :)
I am sure the caps will help but the code is very old. If you have issues, perhaps we can update it to a more modern and faster processor like the pico or stm32 / ESP32 etc.
Although, an UNO should do this job nicely.
As well as the 10uF caps, also link a 'ring main' - vcc and gnd - from the first to last device. That may well help.

Keith, this code is nothing to do with AM, it is Arduino IDE only and will not work with AM. In fact, these devices are not supported in any way with AM. There is no limit of 4 etc as they simply are not supported.
They CAN easily be supported with Mesageport which I have posted examples of how to fully utilise the code in the past, although, for Gilles' use then this is only Arduino IDE needed.

Gilles, it is interesting on your comments regarding the support of 64 / 128 /256 leds etc.
Yes, it can be done and would be interesting via AM (It can easily be done now via my messageport lib) but it has problems in the fact that there is no common gnd so (effectively) each led need two wires which are specific.
A more interesting solution I believe is the SX1509 units.

I use these quad 64 bit blocks but I use then as LED DIGIT drivers for numerics as they are nice and compact and cheap.

Have you looked at the WS2812B RGBLED display units for moving messages ? - light years ahead :D
Really neat.

Joe
Joe. CISSP, MSc.

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#8 Post by SimPassion »

jph wrote: Thu Dec 29, 2022 9:10 am
1 - As well as the 10uF caps, also link a 'ring main' - vcc and gnd - from the first to last device. That may well help.

2 - A more interesting solution I believe is the SX1509 units.

3 - Have you looked at the WS2812B RGBLED display units for moving messages ? - light years ahead :D
Really neat.

Joe
1 - Watching you initial picture on the MAX7219 unit with caps on it, isn't the need to also add one cap on the first module full to the right of the picture ?

MAX7219_Unit_Caps_Added_01.jpg

2 - Nice idea indeed, just it's an I2C link, not sure all will be stable in a whole chain, if it's chain able in any case ?
https://learn.sparkfun.com/tutorials/sx ... -guide/all

3 - I wasn't aware of this solution and definitely have to take more time around what's new in a few area. Just found this : https://www.aliexpress.us/item/22518323 ... _shipto=US


 

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#9 Post by jph »

Hi Gilles and good morning. :)
Let me try to answer these in order.

There is no need to add a cap to the first input unless you use excessively long DC power supply leads as the output stage of a switching supply (buck or boost) would have adequate smoothing capacitance (meaning most non branded units). By all means, add a cap in this position if you would like to though.
I tested with a Meanwell 5V 20A supply with around 0.75M of cable to connect to the unit. Absolutely no issue. However, the Meanwell not only has the appropriate output stage capacitance but also the appropriate inductance. As we say in the UK 'Suck it and see' :lol:

Also, the power line run to the 'second' added cap is only about 35 to 40mm in total so the cap on the 'second' stage is actually working well on the 'first stage' (hope that makes sense ?)

I actually tested it with 3 complete 4 block units chained at 10MHz SPU using a Pico and I found I actually only needed a cap on each second 7219. To b fair, the caps are so cheap tht you may as just well add one to each stage :D

THE biggest limiting issue will almost certainly be the noise (crap) coming from your DC PSU). Again,, that is why I would always use a Meanwell unit and no other.
---------------------------
2.
The SX1509 is remarkable. 16 I/O units, all outputs are individually and independently PWM addressable. CHEAP. All I2C.

A genuine 15mA sink on all outputs - AT THE SAME TIME. all again, pwm selectable individually as LED drivers etc.
What appears to be limited numbers of I2C address allocations is easily solvable via the TCA9845A I2C expander. Less than a euro and 8 channel. SO each 16 channel SX unit can be access via an 8 channel dirt cheap TCA unit giving 16 x 8 = 128 individually controlled PWM output units to 15mA, with INPUT select ability.
As the address of the TCA is also selectable you can keep on expanding the units to 256, 512 etc etc.
This aspect is in reference to the original point you made about using the 7219 units in matrix mode to drive individual LEDs. This is the way I have chosen after looking at both. I2C isn't an issue when you use a port expander.
-------------------------
3.
That is a great example video. :D

But take a look at something like -
https://www.aliexpress.com/wholesale?ca ... .1000002.0

Lot's to play with. ;)

Cheers,
Joe
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: [REVIEW] LED Matrix 4x64 Module with MAX7219

#10 Post by jph »

After just looking at the latest (your fault haha :lol: ) I just ordered a couple of these 8 x 32 units of the WS2812B units in a semi flexible matrix -

seems good value at around 14 euros per sheet of 8 x 32 unit. So only 28 euros for a true 8 x 64 unit. Nice. 8-)

https://www.aliexpress.com/item/1005002 ... 18024r6otM

You can use the neopixel lib as they are simply wired as sequential order - my MP lib support this ok.

You should be able to make a complete scrolling 16 million colour display with these.
Again, I do have a simple Messageport lib for this for AM if you would like it. You can always expand on it.
Joe.
Last edited by jph on Sun Jan 01, 2023 7:34 am, edited 2 times in total.
Joe. CISSP, MSc.

Post Reply