The Arduino platform is great for making LEDs blink and driving small displays, but what happens when you need to display more complex information? For Project ColorTyme, I need to drive 6x 14-segment “starburst” style alphanumeric LED displays, but pins are at a premium. To solve the problem, we’ll incorporate the MAX7219 LED display driver; however, it’s an imperfect solution: The displays I’m using are common-anode while the MAX7219 is a common-cathode driver. In this video, we’ll walk through wiring a 14-segment display to the Arduino, then wiring the MAX7219 to drive in common-anode mode while adjusting the code so everything comes out correctly.
PARTS/TOOLS:
(Most of these can be found in the Arduino Starter Kit available here)
RESOURCES:
LedControl Arduino Library (patched for common-anode displays)
THE CIRCUIT:
The main thing to remember when wiring in this inverse method is that the segment pins correspond to individual digits while the digit pins correspond to individual segments. This illustration is also limited to a single 14-segment digit, but the pinout for a dual display is what is wired.
THE SKETCH:
//Project ColorTyme
//MAX7219x14-segment Display Proof of Concept
//CC-BY-SA Matthew Eargle
//element14 Presents http://element14.com/presents
//AirborneSurfer Productions http://airbornesurfer.com
#include "LedControl.h"
/*
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(12,11,10,1);
unsigned long delaytime=100;
byte numbers[16] = {
B11111100, B01100000, B11011010, B11110010,
B01100110, B10110110, B10111110, B11100000,
B11111110, B11110110, B11101110, B11110011,
B10011100, B11110001, B10011110, B10001110
};
int ones = 0;
int twos = 0;
void setup() {
/*
MAX72XX wakeup call
/
lc.shutdown(0,false);
/ set the brightness /
lc.setIntensity(0,1);
/ clear the display */
lc.clearDisplay(0);
int counter = 0;
}
void loop() {
lc.setColumn(0,2,numbers[twos]);
while(ones <= 15) {
lc.setColumn(0,1,numbers[ones]);
delay(1000);
ones++;
};
ones = 0;
twos++;
}