The MAX7219 is a Integrated Circuit that can drive 64 individual LED's or up to 8 digits of 7-segment display's or a LED matrix of 8x8. The driver implements a SPI interface that can be controlled from a microcontroller using only three I/O pins.
The IC itself has 24 pins. An extensive datasheet for the IC is available from the Maxim homepage. The IC in this project is used to drive a 4 digit 7-segment display to show the time. The display is of the common caythode type. The ATMega328 microcontroller is used to control the 3 pin SPI interface.
Below is the schematic that shows how the IC is wired to the ATMEGA328 microcontroller and the 4 digit 7-segment display with comon cathode.
Besides the MAX7219 you need only three other external components: two capacitors and one resistor.
The capacitors are here to reduce noise signals and cannot be ommited.
The resistor is used to set the limit for the LED's current. It should be at least 10kohm. The MAX7219 has to be powered with 5VDC. It is possible to use the +5V of the ATMEGA328 boerd. Both the ground pins of the MAX7219 have to be connected to the ATMEGA328 board.
The three signal lines (DIn,CLK,Load(/CS)) have to be connected to three digital outputs on the ATMEGA328 board.
The code is written in C with the WinAVR compiler.
// program name: LED driver MAX7219 - clock
#define F_CPU = 8000000UL
#define clk_low 0b11111110
/// Timer 0 overflow interrupt service routine
void send_bits(unsigned char data)
void send_data(unsigned char adress, unsigned char data)
int main (void)
char hour = 11;
//set timer 0 prescaler to clk/256*/