Introducing a new serial (SPI) 8-digit seven segment LED display module using MAX7219



Seven segment LED displays are brighter, more attractive and provide a far viewing distance as well as a wider viewing angle as compared to LCD displays. The major drawback of using seven segment LEDs is they are resource-hungry. Time-division multiplexing is the most common technique of interfacing 7-segment LEDs to microcontrollers. With this technique, an 8-digit seven segment LED display with the decimal point requires at list 16 I/O pins of the microcontroller, which is quite a lot. Consequently, their use with low pin-count microcontrollers (such as PIC12F series) is not practically feasible. Here’s our latest version of the MAX7219 based serial seven segment LED display module (SPI7SEGDISP8.56) that will allow you to add 8 digits of seven segment LED displays to your project using only 3 I/O pins, and provides full control of all the digit segments including decimal points. You can even cascade two or more of these modules together without sacrificing any extra I/O pin. SPI7SEGDISP8.56 display kit is also available for purchase on Tindie for $12.99.

SPI7SEGDISP8.56: 8-digit serial seven segment LED display

Circuit diagram

The SPI7SEGDISP8.56 display module is based on MAXIM’s MAX7219 display driver chip that provides a 3-wire serial (SPI) interface to drive 7-segment LED displays (common-cathode type) up to 8 digits. Included on-chip are a BCD decoder, multiplex scan circuitry, segment and digit drivers, and an 8×8 static RAM to store the digit values. The segment current for all LEDs is set through an external resistor. However, the device is also capable of providing a software control of the display brightness (16 steps from minimum to maximum) through an internal pulse-width modulator. For more details on the internal block diagram and operation of MAX7219, read my earlier project Serial 4-digit LED display and the product datasheet.

The circuit diagram of the SPI7SEGDISP8.56 display is pretty straightforward and follows the guidelines described in the datasheet. Two 4-digit CC LED displays (0.56″) are used in SPI7SEGDISP8.56 to form a joint 8-digit display. JP1 header provides access to power supply, DIN, LOAD, and CLK signal lines. Similarly JP2 contains the same signal lines except DIN is replaced by DOUT pin. This allows easy cascading of multiple displays. For cascading, DOUT from one MAX7219 goes into DIN of another. C1 and C2 are decoupling capacitors and R1 set the maximum current value per segment. Read the MAX7219 datasheet for more details on selecting the value of R1.

Circuit

Interfacing examples

The SPI7SEGDISP8.56 module can be interfaced with any microcontroller that has 3 I/O pins available. If the microcontroller features a built-in hardware SPI, then the display module can be interfaced as a SPI slave device. In that case the SPI signal lines SDO (serial data out), SCLK (serial clock), and SS (slave select) from the microcontroller can be directly connected to the DIN, CLK, and LOAD pins of MAX7219. The LOAD signal is active low.

In case the host microcontroller doesn’t have a hardware SPI module, the interface can be implemented in software. In my previous project (Serial 4-digit LED display) I have described how to write a software SPI routine to drive the MAX7219 based LED display module using three general purpose I/O pins of the PIC12F683 microcontroller. Same guidelines can be followed to write display routines for the SPI7SEGDISP8.56 module.

SPI7SEGDISP8.56 and Arduino

The LedControl library allows you to easily interface MAX7219-driven seven segment LED displays to Arduino. The library also supports cascading of multiple MAX7219 devices (maximum 8 devices). The following Arduino sketch is an example of interfacing one SPI7SEGDISP8.56 module. It displays numbers 1 through 8 on the eight 7-segment LED displays of SPI7SEGDISP8.56.

#include "LedControl.h"
// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1
LedControl lc=LedControl(7,6,5,1);
void setup()
{
 // Initialize the MAX7219 device
  lc.shutdown(0,false);   // Enable display
  lc.setIntensity(0,10);  // Set brightness level (0 is min, 15 is max)
  lc.clearDisplay(0);     // Clear display register
}
void loop()
{
  for(int i=0; i<8; i++){
   lc.setDigit(0,i,i+1,false);
  }  
  delay(1000);
}

Interfacing the SPI LED display module with Arduino

For cascading a second MAX7219 device, the DOUT pin of first device should be connected to DIN pin of other, and corresponding CLK and LOAD pins must be tied together. In SPI7SEGDISP8.56, DOUT pin is accessible through JP2 header. JP2 and JP1 header pins are compatible for direct cascading (see the picture below) by plugging them together.

Cascading two SPI7SEGDISP8.56 modules

The following Arduino sketch illustrates daisy-chaining three SPI7SEGDISP8.56 modules using the LedControl library.

#include "LedControl.h"
// Pin 7 to Data In, 6 to Clk, 5 to LOAD, number of devices is 3
LedControl lc=LedControl(7,6,5,3);
void setup()
{
  // Initialize the 3 MAX7219 devices
  for(int k=0; k<3; k++){
    lc.shutdown(k,false);  // Enable display
    lc.setIntensity(k,15); // Set brightness level (0 is min, 15 is max)
    lc.clearDisplay(k);    // Clear display register
  }
}
void loop()
{
  int count = 0;
  for(int j=0; j<3; j++){
    for(int i=0; i<8; i++){
     lc.setDigit(j,7-i,count, true);  // Decimal point enabled
     count ++;
     if(count == 16) count=0;
    }  
    delay(1000);
  }
}

Three SPI7SEGDISP8.56 modules in cascade configuration driven by 3 I/O pins of Arduino

SPI7SEGDISP8.56 display kit is available on Tindie for $12.00.

SPI7SEGDISP8.56 display kit for $12.00

Soldering parts is pretty easy. The MAX7219 chip, resistor, and capacitors are soldered on the bottom side whereas the LED displays go to top side of PCB. The PCB size is approximately 4.8″ x 1.1″ (12.3cm x 2.8cm). Detail assembly instructions are available here.

Top and Bottom views of SPI7SEGDISP8.56 PCB

Assembled board top and bottom view

Tindie buying links:

SPI7SEGDISP8.56 buying link – Red color

SPI7SEGDISP8.56 buying link – Yellow color

SPI7SEGDISP8.56 buying link – Green color

SPI7SEGDISP8.56 buying link – Blue color

Buyers from countries other than USA can also use following links for lower shipping cost

SPI7SEGDISP8.56 buying link – Red color

SPI7SEGDISP8.56 buying link – Yellow color

SPI7SEGDISP8.56 buying link – Blue color

6 comments

Leave a Reply

Your email address will not be published. Required fields are marked *