Of all the many questions that have been asked about issues they face when using the MD_Parola and MD_MAX72XX libraries, there are a few themes that keep re-emerging. In this article I’ll cover the top eight questions, their most likely cause and solution.
1. Matrix Module Type
The matrix module type is required for the libraries to configure the correct way of managing the rows and columns of the display (see this previous article).
Prior to version 3.0 of the MD_Parola library, the matrix type was defined by editing the MD_MAX72XX.h file in the library folder. Many old third party tutorials and projects still refer to editing what is now non-existent code, creating confusion with some people.
From version 3 onwards, the module type is selectable for each sketch and specified as a parameter when the MD_Parola/MD_MAX72XX objects are created. All the examples provided with the libraries will have
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
at the top of the sketch. This should be changed to match the type of hardware controlled by the sketch.
The different hardware types available are listed in the MD_MAX72XX library documentation. If the type is unknown, just try each option in turn until the displays show readable text (nothing gets damaged, you just see things out of sequence). Alternatively, use the MD_MAX72XX Dynamic_HW example, which prints out the module type after changing the hardware type – the one that is legible on the display is the hardware being used.
Another common mistake is not placing the input wires from the Arduino hardware to the chain of modules on the right side, with the complaint that the text is upside-down or no module types work properly. Correct orientation has always (to date) resulted in one module type working.
2. Power Supply
The second most common issue is using a power supply that is under-rated for the project’s power needs. Each matrix module can consume just over 200mA (see this previous post), so once the number of modules exceeds a small threshold (2 or 3) the Arduino board’s built-in power supply cannot provide enough power for the matrices to function properly. You need to connect a suitable external power source.
Symptoms of for this issue include the Arduino resetting, modules not lighting properly, intermittent faults and/or specific modules not working.
One way to troubleshoot power problems from non-functional modules is to reduce the number of matrices (starting at one set) and increase to see when the problem reappears (2, 3, 4, 5?), or swap the position of the modules and see if the fault follows the module (hardware problem) or stays in the same place (likely power problem).
When adding an external power supply make sure the additional power supply and the Arduino power supply have their ground (0V) connected.
The MAX7219 will work with 3.3V from low voltage MCUs. However, if you are trying to power a long string of matrices the voltage drop down the line is likely to be too large for the matrices towards the end of the daisy chain. This can be resolved by distributing voltage to both ends of the matrix chain or providing a separate 5V supply just for the matrices.
3. Signal Degradation
Assuming that you have checked that the power supply is working and that the connections between modules are good, then you may have some signal propagation or distortion problems if the displays still work intermittently.
All the signals except for DOUT to DIN (which only connects adjacent modules) will deteriorate and distort over distance. One method to overcome this distortion is to connect the signals in parallel to the source every few modules rather that daisy-chaining through a long string of modules.
Another option to try is to install pull-up or pull-down resistors (depends on the ‘off’ level for the signal). These prevent the signal from floating by providing a ‘higher resistance’ path to 5V (pull up) or GND (pull down) when the digital signal is not asserted properly. Once the floating signal is switched on or off by the processor I/O the signal takes the lower resistance path from the PU/PD path and the signal changes level. A reasonable value for the resistor is greater than 10k.
The MAX7219 is a 5V device but just about works with a 3.3V signal from a low voltage processor. However, once more than a few matrix modules are in the chain, the distance and voltage drop may attentate the signal enough for it not to be recognised. In that case, you should really should be using voltage level shifters with a separate 5V power supply, connected grounds between the 5V and 3.3V supply and pull up/down resistors for the signal lines.
4. Double Height Display not Working
Double height displays usually have a lot of modules, so the most common types of issues are related to Power Supply and Signal Degradation, discussed above.
5. Animation not Working
A fundamental principle of using the Parola library is that the displayAnimate() method needs to be called every time through the loop(), and the loop(), or any code called from it, should be non-blocking (ie, does not contain calls to delay() of any kind).
All the animation occurs in displayAnimate(), so if is not called frequently animations slow or stop. MD_Parola does not use any timer interrupts within the library. All timing is done based on millis(), which is why nothing happens unless you keep running displayAnimate().
Message display can be stopped before the animation ends by using the displaySuspend() or displayReset() method, depending on the effect required. An alternative is to just not invoke displayAnimate().
6. Font File Substitution
The font data format is defined in the MD_MAX72XX library. You can add your own font to override the system font using the setFont() method.
Defining your own font is easy but tedious (see this previous post). MD_MAX72XX also includes a couple of utilities for modifying/creating font data. If you don’t use Microsoft Excel then this third party tool may be useful once you have read the documentation.
The format of the font data is explained in the MD_MAX72XX library documentation.
There are practical limits to the size of the font data. From version 3.2.0 MD_MAX72XX allows for 65535 characters in the font file. On a small processor (eg, Uno) there is not enough flash memory to hold this much data. On a practical level, you also need to define all the characters in the font file, a long job!
7. Characters not Displaying Properly
This issue usually relates to character data in UTF-8 format being processed as straight ASCII characters.
The MD_Parola UTF8 example and this previous post provide details and code to overcome this issue.
8. Need More Flash Memory for my Code
The memory footprint of the MD_Parola library can be reduced to free up additional Flash Memory. There are a number of #defines in the Parola header file that allow you to turn off animation groups that you may not be using. Look for ENA_MISC, ENA_WIPE, ENA_SCAN, ENA_SCR_DIA, ENA_OPNCLS, ENA_GROW and ENA_SPRITE.
In the MD_MAX72XX font file, the latest version 3+ font definitions allow for smaller font files if you are only using a subset of the ASCII characters. You can set a start and end index code for the font data. See the MD_MAX72XX documentation or the header file for a description of the font file file format. You will need to edit the first line of the font data and change the number of table entries to match the definition. Removing the characters with code > 127 can gain quite a bit of flash memory for the sketch.
And, of course, when all else fails read the manual. All library documentation is in the relevant docs subfolder (open the file index.html). Each library also has many examples that illustrate how the library methods are combined to achieve an outcome, or can be used as starting point for your own project.