These two integrated circuits from Maxim are for driving either 64 individual Led’s, or up to 8 digits of 7-segment displays. The drivers implement a SPI compatible slave interface that can be controlled from the Arduino using only 3 of the digital output pins. An extensive datasheet for the IC’s is available from the Maxim homepage. Since both chips are very similar, I will use the term
MAX72XX for both the
MAX7221 and the
I will focus on building the Led driver hardware, so this article should be considered as only a supplement to the original datasheet.
In other words : First read the original datasheet, then read this article for some extra Arduino-info.
Table of contents
- Wiring and schematics
MAX7221what makes them different?
- Selecting a value for
- Power supply issues
Here is a basic schematic for a
MAX72XX, showing the data signals coming from the Arduino.
There are not yet any Leds in the schematic. There will be an extra section on Led wiring.
MAX72XX itself and the Leds you need only 3 external components: two capacitors (
C2) and a resistor (
The capacitors are there to supress noise signals introduced through the power-supply lines. By no means these 2 capacitors can be ommitted, as it might lead to sporadic or permanent malfunctions. These types of errors are really hard to track down. Both capacitors must be placed as near as possible to the
V+ and the
Gnd pins of the
RSet is responsible for setting an upper limit on the current that is fed into the Leds. Selecting the correct resistor value might not be trivial. There is an in-depth discussion on this later.
MAX72XX has to be powered with
+5V. For a single Led-matrix it is possible to use the
+5V supply from the Arduino-board. If you add more than one matrix to the Arduino you will probably need an external power-supply. More on this in section Power supply issues.
Gnd-Pins of the
MAX72XX have to be connected to one of the
Gnd-Pins on the Arduino board. That makes both circuits work on the same voltage-level. The positive power-supply pins (
+5V/Vcc) can be connected to the Arduino-board for a limited number of Led’s.(See Power supply issues for details.)
The three signal lines (
DIn,CLK,Load(/CS)) have to be connected to three digital outputs on the Arduino board. It depends on the software which Arduino pins have to be used. For the exact pin-numbers you have to refer to the documentation of the library or the example code on which you build your project. With most of the libraries for the
MAX72XX you are free to choose any pins you like.
If you read the datasheet for the
MAX72XX you know that the drivers can be cascaded by simply connecting the signal
DOut from one chip to
DIn on the next chip. The signals
Load(/CS) have to be connected in parallel to each
MAX72XX. There is no strict limit as to how many drivers can be cascaded that way. But the SPI-interface is not capable of any error checking on the transmitted data, so you are already limited with the length of the cables that run from one
MAX72XX to the next one. If your cables get longer than 10cm between each
MAX72XX you might already run into trouble.
For more detail: The MAX7219 and MAX7221 Led drivers