LED Matrix Multi-Display with Arduino

An Open Source library to easily control multiple IDM-LMX3208 series 32x8 LED matrix display boards with simple printf like functions.  Features accented fonts, left, center, right justification, blinking and intensity control.  Can combine multiple displays boards into single text line or separate them into multilines.  The library has an object wrapper class for C++ applications.  See demo video bellow showing different usage combinations of the displays.  The hardware supported by this library are shown at the bottom of this page.

The Software

API functions

void LedMxBlink(LEDMXDEV *pDev, int OnOff);
void LedMxInit(LEDMXDEV *pDev, LEDMXCFG *pCfg);
void LedMxIntensity(LEDMXDEV *pDev, int Level);
void LedMxPrintAt(LEDMXDEV *pDev, int col, const char *pStr);
void LedMxPrintCenter(LEDMXDEV *pDev, const char *pStr);
void LedMxPrintf(LEDMXDEV *pDev, LEDMXPRTMODE Mode, const char *pFormat, ...);
void LedMxvPrintf(LEDMXDEV *pDev, LEDMXPRTMODE Mode, const char *pFormat, va_list vl);
void LedMxPrintLeft(LEDMXDEV *pDev, const char *pStr);
void LedMxPrintRight(LEDMXDEV *pDev, const char *pStr);
void LedMxSetRam(LEDMXDEV *pDev, unsigned RamAddr, char Data, int Len, int PanelNo);
void LedMxWriteRam(LEDMXDEV *pDev, unsigned Addr, uint8_t const *pData, int Len, int DevNo);

Switch settings

There is a 4 positions DIP switch at the back of the IDM-LMX3208-30R board.  This DIP switch is set to make the board responds to the corresponding CS lines on the connector.   This is to allows 4 boards to be daisy-chained together.  In a 2 displays chain, one must be set to CS1 and the others CS2.

There is no require fixed physical order in which the board must be placed in the chain.  The software will order the displays accordingly based on the configuration settings.


Configuration data can be defined statically or dynamically in the code.   Shown bellow is a static configuration settings.  This configuration bellow is for one channel with 2 display boards.  The two display boards are daisy-chaned on channel 1 (i.e. connected to P1 on the LMXSHIELD).

#include "ardledmxio.h"

// The LEDMXIOCFG is the configuration of I/O interface to the display.
// In this case, it is the LMXSHIELD for Aduino Uno
// Arduino Digital I/O pin mapping for the LMXSHIELD

  LMXSHIELD_WR,    // WR pin 
  LMXSHIELD_RD,    // RD pin
  LMXSHIELD_DATA,  // Data pin
  LMXSHIELD_EN,    // Enable pin
  { LMXSHIELD_AD0, LMXSHIELD_AD1, LMXSHIELD_AD2, -1,}, // The LMXSHIELD uses 3 digital pins to address 8 Displays
  3, // Number of CS pins 
  LMXSHIELD_CSTYPE, // Type of addressing for access to display

// LED matrix display configuration
LEDMXCFG g_Cfg = {
  2,  // Number of display board in connected, max 8 boards 
  {0, 1, 2, 3, 4, 5, 6, 7}, // display board ordering, 0-1 are on connector P1, 4-7 are on P2

// This is the data instance require by all LMX C functions.  
// It is initialized bit LedMxInit.  
LEDMXDEV g_LmxDev;   

// for C++ program use the LedMx class instead of LEDMXDEV
// LedMx g_LmxDev;  


Before any display functions can be used.  The library and display need to be initialized with the previously defined configuration.  This is done by calling LedMxInit() function.  This is only need to be done once, unless we want to change configuration.  This function ensure that the digital pins are initialized properly, the fonts are set and the displays are energized

  LedMxInit(&g_LmxDev, &g_Cfg);

Using C++ class, the initialization is



Now that the display is initialized, let show something on the display.

To display a text string on the left side:

  LedMxPrintLeft(&g_LmxDev, "Text Left");


  LedMxPrintf(&g_LmxDev, LEDMXPRTMODE_JLEFT, "Text Left");

To display a text string on the right side:

  LedMxPrintRight(&g_LmxDev, "Text Right");


  LedMxPrintf(&g_LmxDev, LEDMXPRTMODE_JRIGHT, "Text Left");

Let make a text entering from the right and scrolls off to the left side.

  static char text[] = {"Scrolling Text"};
  int col = g_LmxDev.NbPanel;
  int i = col;
  int pixlen;

  pixlen = LedMxPixStrLen(&g_LmxDev, text);
  for (i = col; i + pixlen > 0; i-= 1)
    LedMxPrintAt(&g_LmxDev, i, text);

    // Adjust delay for faster or slower scrolling speed

Configuring for 2 independent channels

Configuring for two channels is very simple.  All we need to do is to add another config data.  From the same IO config already defined above.  Let add a new display configuration and let call them config2.

// LED matrix display configuration
LEDMXCFG g_Cfg2 = {
  1,  // Number of display board in connected, max 8 boards 
  {4, 5, 6, 70, 1, 2, 3}, // display board ordering, here we use channel 2

// This is the data instance require by all LMX C functions.  
// It is initialized bit LedMxInit.  
LEDMXDEV g_LmxDev2;   

Same as before, we need initialize the config2.


Now to display on the new display configuration all we need to do is to use the config2 instead of the previous one.

To display a text string on the left side on both display:

  LedMxPrintLeft(&g_LmxDev, "Text Left"); // display 1 (on channel 1)
  LedMxPrintLeft(&g_LmxDev2, "Text Left"); // display 2 (on channel 2)

Combining 2 channels into one display line

Previously, we have configured the library to use one channel with two displays boards.  Then we added an other channel with one display board.  Now let combine both channels into one big display of 96x8 pixels.  Here is the new configuration data.

// LED matrix display configuration
LEDMXCFG g_Cfg = {
  3,  // Number of display board in connected, max 8 boards 
  {0, 1, 4,}, // display board ordering, 0-1 are on connector P1, 4-7 are on P2


We have the display board CS1 and CS2 on channel 1 combined with display board CS1 on channel 2.

Library source code :
For other platform, see my EHAL page for general embedded software development.  Currently available for Bluetooth nRF51 series processor.

The hardware

The hardware supported by this library are listed bellow.  You buy them via Buy Now button or from eBay by searching for IDM-LMX3208.

The shield

LMXSHIELD - Shield for Arduino to interface with the IDM-LMX3208 series displays.
Control up to 8 display boards

IBB-LMXBLUE - Shield for Arduino to control up to 16 IDM-LMX3208 series display boards with on board DC switching regulator.  Enough to power both the displays and Arduino.
Available now on tindie

The LMXSHIELD a display interface for Arduino Uno.  It has 2 channels where each channel can daisy-chained 4 display modules.  Digital output 2-8 of the Arduino are used by the shield to interface with the 8 display modules.

The display

32x8 LED matrix, dot size 3mm, pitch 4mm.
IDM-LMX3208-30R - Red LED.
IDM-LMX3208-30G - Green LED

LED color option
32x8 LED matrix, dot size 5mm, pitch 7.62mm.
IDM-LMX3208-50R - Red LED.
IDM-LMX3208-50G - Green LED

LED color option

The display module is the IDM-LMX3208 series,  32x8 LED matrix.  Available in 2 LED dot size, 3mm (IDM-LMX3208-30) and 5mm (IDM-LMX3208-50) with LED in Red or Green color.

Features :
  • 16 levels PWM brightness control
  • Support Synchronized blinking in daisy chained configuration
  • Up to 4 boards can be daisychained together for a total of 128x8
  • Serial interface to microcontroller requires only 3 GPIOs
  • Dimension : 128x52mm (5.04" x 2.05"), 241x80mm (9.5" x 3.15")
  • Operating voltage 5V @165mA full on.
  • Wavelength 625-640 nm (Red color)
  • Wavelength 565-575 nm (Green color)

The kit

Kit containing one LMXSHIELD and two IDM-LMX3208 series display boards

Display Color & Size
Other hardware

UART to RS-232 breakout board

No comments:

Post a Comment