Using the Parola library for double height displays is becoming increasingly popular with library users. Setting up the hardware and the library is not difficult, but it can cause problems if not done correctly. This article will explain the hardware and software setup considerations for trouble-free double height displays.
LED Matrix Setup
A single LED matrix is a square array of 8×8 LEDs. To make a double height display the matrices are stacked on top of each other to create a 16 LED high display, as shown in the picture below.
How the hardware is arranged is critical, but it depends on the style of LED matrix module used. There are 2 types of single matrix modules generally available – square and rectangular types. Square modules have the display mounted on a PCB the same size; rectangular modules are illustrated in the photo above.
A single height display of modules using Parola always has the Data In connector (DIN) on the right hand side, and modules are numbered right to left. This arrangement does not change in double height displays, with the first row designated as the lowest row of the display. Additional rows are stacked with the second row above the first, the third above that, etc.
The square module type is the easiest to arrange, as modules can be placed touching side by side and top to bottom without any display gaps. In this case, the order of the modules should be contiguous, with the last module on the bottom row connected to the first module in the top row (shown in the figure at left). This type of arrangement can be generalized for more rows, as additional rows would follow the same rising zig-zag pattern. In this arrangement, the matrices in every row remain in their ‘normal’ orientation. However, care needs to be taken to ensure a reliable connection between the end of one row and the start of the next – bad wiring here has been the cause of many reported problems.
The rectangular module type is more problematic. Modules cannot be stacked in the same way as before as this would leave a gap between the rows of LED matrices. The only practical arrangement is to fold the row back on itself so that the tops of the matrices are touching and the protruding part of the rectangle is pointing down in the lower row and up in the upper (figure at right). The stacking continues in the same snaking pattern for additional rows. In this configuration the matrices in the top row are effectively flipped upside down and numbered back to front compared to the ‘normal’ orientation. This needs to be compensated for in software (see below).
A second important consideration for double height displays is the font definition.
The figure at left shows that, compared to a single height display, a double height character is split between the top and bottom row. This means that the font definition needs to take this into account. The tools to do this are covered in detail in this previous blog, but essentially there are 2 schemes that can be implemented to define and manage the split character map:
- Two font files, one for the top and one for the bottom row, each containing the image for half of the character. In this scheme, the same ASCII code in each font is used to display the character, with the correct ‘half character’ font used for each row. This allows a full 255 character for display but uses more memory for the font files.
- One font file, with the lower and upper 128 ASCII codes (bottom and top half of the range) defining each half the character image. In this scheme, the ASCII code for one half of the character is offset from its complementary half by 128. User code needs to remap each character in a text string to ensure that the correct half of the font is used for each row. This restricts the number of displayable characters to 128 but uses less memory for the font files.
Most of the examples in the Parola library use the second scheme to save memory.
Finally, how the software is set up is influenced by the hardware and the font setup.
Common for all modules types is that each display row should be set up as a separate zone. Separating the display simplifies management to achieve the desired animation.
Another in-common requirement is the synchronization of the zones comprising the two halves of the display to make the displays move together. In technical terms, they need to use the same animation time base. The method synchZoneStart(), used between displayReset() and the first call to displayAnimate(), ensures that all the zones in the display are synchronized to zone 0.
User code also needs to provide the right support for the font definition scheme used:
- If two font files are used, each zone is configured with its own font definition (top and bottom half) and the same text used for display.
- If a single font file is used, the same font file is configured for each zone, but a second text string needs to be created with each character offset by 128. Each zone displays its own version of the text.
Display modules in a zig-zag arrangement are the easiest to handle as the same animation is used for the top and bottom half. User code needs to repeat the same animation setup and sequence for each of the top and bottom zones.
Display modules in snaking arrangement need software compensation for this altered arrangement. The method setZoneEffect() is used to flip the zone’s display coordinates top to bottom and left to right. Additionally, for some animations (technically the frame-by-frame type described here) the alignment and direction may need to be reversed.
Double height display sample code illustrating how the software should be set up can be found in the examples folder for the Parola library.