0% found this document useful (0 votes)
256 views

Tutorial - Arduino and The MAX7219 LED Display Driver IC

The document provides a tutorial on using the MAX7219 LED display driver IC with an Arduino board to control LED displays. It describes the hardware setup, which involves connecting the MAX7219 pins to an LED matrix or 7-segment display and adding a resistor. The Arduino communicates with the MAX7219 over 3 pins. Software code examples are given to initialize the LED display, set the brightness, and control individual LEDs in a matrix. Multiple MAX7219 chips can be chained to drive more LEDs from a single Arduino.

Uploaded by

game andi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
256 views

Tutorial - Arduino and The MAX7219 LED Display Driver IC

The document provides a tutorial on using the MAX7219 LED display driver IC with an Arduino board to control LED displays. It describes the hardware setup, which involves connecting the MAX7219 pins to an LED matrix or 7-segment display and adding a resistor. The Arduino communicates with the MAX7219 over 3 pins. Software code examples are given to initialize the LED display, set the brightness, and control individual LEDs in a matrix. Multiple MAX7219 chips can be chained to drive more LEDs from a single Arduino.

Uploaded by

game andi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Tutorial - Arduino and the MAX7219 LED Display Driver IC http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display...

tronixstuff fun and learning with electronics

China PCB1-3
10pcs
days onlyRegister
shipping, $10
now!
Home
Tronixlabs
Kit Reviews
Reviews
About
Contact Us

Categorized | arduino, as1107, COM-09622, LED matrix, lesson, max7219, part


review, tronixlabs, tronixstuff, tutorial

Tutorial Arduino and the MAX7219 LED Display Driver IC


Posted on 11 October 2013. Tags: arduino, AS1107, austria, circuit, COM-09622, compatible, display,
equivalent, example, guide, guides, LED, LED matrix, lesson, lessons, MAX7219, Maxim 7219, micro,
microsystems, part review, review, tronixlabs, tronixstuff, tutorial

Use the Maxim MAX7219 LED display driver with Arduino in Chapter 56 of our Arduino Tutorials. The
first chapter is here, the complete series is detailed here.

Introduction

Sooner or later Arduino enthusiasts and beginners alike will come across the MAX7219 IC. And for good
reason, its a simple and somewhat inexpensive method of controlling 64 LEDs in either matrix or numeric
display form. Furthermore they can be chained together to control two or more units for even more LEDs.
Overall theyre a lot of fun and can also be quite useful, so lets get started.

Heres an example of a MAX7219 and another IC which is a functional equivalent, the AS1107 from
Austria Microsystems. You might not see the AS1107 around much, but it can be cheaper so dont be
afraid to use that instead:

1 of 29 2/23/2017 8:25 AM
Tutorial - Arduino and the MAX7219 LED Display Driver IC http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display...

At first glance you may think that it takes a lot of real estate, but it saves some as well. As mentioned
earlier, the MAX7219 can completely control 64 individual LEDs including maintaining equal
brightness, and allowing you to adjust the brightness of the LEDs either with hardware or software (or
both). It can refresh the LEDs at around 800 Hz, so no more flickering, uneven LED displays.

You can even switch the display off for power saving mode, and still send it data while it is off. And
another good thing when powered up, it keeps the LEDs off, so no wacky displays for the first seconds
of operation. For more technical information, here is the data sheet: MAX7219.pdf. Now to put it to work
for us well demonstrate using one or more 8 x 8 LED matrix displays, as well as 8 digits of 7-segment
LED numbers.

Before continuing, download and install the LedControl Arduino library as it is essential for using the
MAX7219.

Controlling LED matrix displays with the MAX7219

First of all, lets examine the hardware side of things. Here is the pinout diagram for the MAX7219:

2 of 29 2/23/2017 8:25 AM
Tutorial - Arduino and the MAX7219 LED Display Driver IC http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display...

The MAX7219 drives eight LEDs at a time, and by rapidly switching banks of eight your eyes dont see
the changes. Wiring up a matrix is very simple if you have a common matrix with the following
schematic:

connect the MAX7219 pins

3 of 29 2/23/2017 8:25 AM
Tutorial - Arduino and the MAX7219 LED Display Driver IC http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display...

labelled DP, A~F to the row pins respectively, and the MAX7219 pins labelled DIG0~7 to the column pins
respectively. A total example circuit with the above matrix is as follows:

The circuit is quite straight forward, except we have a resistor between 5V and MAX7219 pin 18. The
MAX7219 is a constant-current LED driver, and the value of the resistor is used to set the current flow to
the LEDs. Have a look at table eleven on page eleven of the data sheet:

Youll need to know the


voltage and forward current for your LED matrix or numeric display, then match the value on the table.
E.g. if you have a 2V 20 mA LED, your resistor value will be 28k (the values are in k). Finally, the
MAX7219 serial in, load and clock pins will go to Arduino digital pins which are specified in the sketch.
Well get to that in the moment, but before that lets return to the matrix modules.

In the last few months there has been a proliferation of inexpensive kits that contain a MAX7219 or
equivalent, and an LED matrix. These are great for experimenting with and can save you a lot of work
some examples of which are shown below:

4 of 29 2/23/2017 8:25 AM
Tutorial - Arduino and the MAX7219 LED Display Driver IC http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display...

At the top is an example from tronixlabs.com, and the pair on the bottom are the units from a recent kit
review. Well use these for our demonstrations as well.

Now for the sketch. You need the following two lines at the beginning of the sketch:

The first pulls in the library, and the second line sets up an instance to control. The four parameters are as
follows:

1. the digital pin connected to pin 1 of the MAX7219 (data in)


2. the digital pin connected to pin 13 of the MAX7219 (CLK or clock)
3. the digital pin connected to pin 12 of the MAX7219 (LOAD)
4. The number of MAX7219s connected.

If you have more than one MAX7219, connect the DOUT (data out) pin of the first MAX7219 to pin 1
of the second, and so on. However the CLK and LOAD pins are all connected in parallel and then back to
the Arduino.

Next, two more vital functions that youd normally put in void setup():

The first line above turns the LEDs connected to the MAX7219 on. If you set TRUE, you can send data
to the MAX7219 but the LEDs will stay off. The second line adjusts the brightness of the LEDs in sixteen
stages. For both of those functions (and all others from the LedControl) the first parameter is the number
of the MAX7219 connected. If you have one, the parameter is zero for two MAX7219s, its 1 and so
on.

5 of 29 2/23/2017 8:25 AM

You might also like