#479 LedControl MAX7219 7-Segment LED Driver
Driving a series of 7-segment LED displays with the MAX7219 and the LedControl library.
The MAX7219 is a popular serially Interfaced, 8-Digit, LED Display Driver.
It is often used in LED display modules such as this 8 Digit Module from a seller on aliexpress.
The MAX7219 can drive up to 8 common-cathode LED 7-segment units, and can be cascaded to support more digits. The 8x8 outputs can actually be used for any kind of LED display, not just 7-segment displays.
Only one external resistor is required to set the segment current for all LEDs. Current per segment is approximately 100 times the current at pin ISET i.e. ISET is pulled high with an appropriate resistor for the desired current. The current will however also depend on the forward voltage of the LEDs.
MAX7219 Serial Connection
The MAX7219 is connected to the Arduino with three pins as follows. The actual Arduino pin used is not significant, although in this example I have used the conventional SPI pins.
|Connection||Arduino Pin||MAX7219 Pin|
The MAX7219 multiplexes the output for up to 8 digits. The scan-limit register sets how many digits are connected, so that the scan can avoid looping through digits that are not conencted.
Decode Mode Register
The MAX7219 allows digits and segments to be addressed individually. This is the “no decode” mode, and requires the host controller to figure out how to draw digits on the LED display.
A “Code-B” mode can be enabled, that allows the digits 0-9 and a small set of characters to be displayed, per the following table. The decimal point is enabled for any of these characters by setting the high bit. Unfortunately, the code set does not include A-F for hexadecimal number display.
|Display||Input Value||Display||Input Value|
The Decode Mode register is set as follows:
|No decode for all digits 0-7||0x00|
|Code-B decode for digit 0 only||0x01|
|Code-B decode for digits 0-3 only||0x0F|
|Code-B decode for all digits 0-7||0xFF|
LED 7-Segment Components
The 7-segment components I’m using here are similar to the SC56-11.
|Segment||SC56-11 pin||MAX7219 pin|