Electronic – Arduino + Max7221 + Common anode 4-digit 7-seg LED array

7segmentdisplayarduinoled

I'm trying to hookup a common anode 4-digit 7-segment LED array to my Arduino via a Max7221 IC.

Here's a hard-to-see (sorry!) pinout for my LED array (my LED array is the bottom common anode one, LFC0566XXX)

Here's the datasheet for the Max7221 IC that I'm using.

I was following a tutorial on the Arduino Wiki and it said that the Max7221 will not work with common anode LED arrays like the one I have. However, the comments on the Max7221 Sparkfun product page say that it is possible to use it:

You can drive common anode displays with this chip just fine. It has 8
cathode outputs and 8 anode outputs. The only thing you lose is the
BCD-7 segment decoder, which would work strangely hooked up to a
common anode 7 segment display. But if you’re just telling the chip
which segments to light directly, it’ll work just fine either way.

How can I connect my LED array to the Max7221?

Best Answer

I do not believe you can reasonably run your display (or any multi-digit common anode display) using this chip. You may be able to finagle it to drive a single digit display through some creativity by hard-wiring the common anode to VCC and not connecting any of the DIG pins of the chip.

The way the chip works is that the SEG* pins "source current to the display" and the DIG* pins "sink current from the display common cathode". The way it's meant to be wired is that the common cathode of each digit on the 7SD is wired to a corresponding DIG pin and the SEG pins are wired to the corresponding anode segment pins of the 7SD. You serially load up "what should be displayed" into the memory of the chip and some configuration settings and it takes it from there.

The chip "scans" the 7-segment display for you and does this by, for each digit N:

  • switching the DIG N pin to GND (and all other DIG pins to high-impedance).
  • setting all the SEG pins to what is stored in its memory (optionally decoding the stored value as BCD first)
  • then moving on to digit N+1 modulo the number of digits its scanning...

There's just no way you are going to be able to take advantage of the chip's multiplexing algorithm because it relies on the DIG pins driving the common cathode to GND to "enable" each digit in turn.

You could insert an inverting buffer between all the SEG and DIG pins of the chip and the display and then you would communicate with the chip and wire it up "normally" as though it was a common cathode display. Not worth it if you ask me...