Arduino to Maxim7219 Breakout Board

Thread Starter

allenpitts

Joined Feb 26, 2011
121
Working on using an Arduino and a Maxim7219 to control 292 LEDs in a display.

All of the literature on the Maxim7219 seems to be for controlling a matrix or a seven segment LED display.

The LEDs displayed in the project are in a curvilinear line.

Have worked out a PCB that breaks out the LEDs into a linear display.


But have a bit of rat's nest in construction because the anode from any one
LED is connected to cathode on a different group of connections.
This PCB is based on a schematic (for a matrix display) from the Arduino forum at
http://playground.arduino.cc/Main/MAX72XXHardware

That is, in the diagram of the PCB marked 'MAXIM 7219 Breakout
171230', above, sixteen groups of eight connections are shown. The first LED 000,
cathode is in the group marked 2 and the anode to the same LED is going to cathode group 22.
The second anode is in group 14 and the cathode group 22.
And so on thru 64 LEDs until the PCB that looks like this in the beginning

looks but like this when complete.

A real headache for construction and a nightmare for troubleshooting.

So began looking at a way to use PCB traces to simplify the construction. Because the PCB
is four layers the voltage source, ground, Clock, Load and DIN are in one plane and
the anodes and cathodes are in the remaining three planes.

In this diagram of the anode/cathode planes of the PCB just the first sixteen LEDS are traced w/o
the voltage source, ground, Clock, Load and DIN.
The LEDs are numbered
000, 001, 002,...007, 010, 011, 012, ...017.
This is to align with Arduino sketch:
lc.setLed(0,0,0,true);
delay(delaytime2);
lc.setLed(0,0,1,true);
delay(delaytime2);
lc.setLed(0,0,2,true);
(Complete sketch copied to this post at end.)

This arrangement would put the LED anode/cathode pairs next to each other, a marked improvement.

As I worked thru the traces for another $400 PCB order I wondered if there was away to
do, programatically, what the traces on the improved PCB would do electronicly.

To this end some research was conducted and a sketch was found that uses what seems to be
binary code to control a 7-segment.

The code can be found at
http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display-driver-ic/
but part of it is

void loop(){
scrollMessage(scrollText);
scrollFont();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
prog_uchar font5x7 [] PROGMEM = { //Numeric Font Matrix (Arranged as 7x font data + 1x kerning data)
B00000000, //Space (Char 0x20)
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
6,

Have done Javascript and C# programming but cannot make
heads or tails of it. Is the 'B' for binary?
The comment says '7x font data + 1x kerning data'
but it looks like nine characters to me , not 8.

So that's the question: Does anyone know how the sketch now
being used could be adapted to address the LEDs so that
the connections are parallel to each other as on the PCB marked
Maxim 7219 Breakout. That is, the anode and cathode can
be deployed shoulder to shoulder in a more orderly fashion?

It would save me a fistfull of cash if programmatic solution
over an electronic one could be developed. Not asking for
a complete solution just some thing to get me going.

Thanks

Allen in Dallas

C:
#include "LedControl.h"

LedControl lc=LedControl(12,11,10,1);

unsigned long delaytime=500;
unsigned long delaytime2=100;

void setup() {

lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}

void loop() {

lc.setLed(0,0,0,true);
    delay(delaytime2);
lc.setLed(0,0,1,true);
    delay(delaytime2);
lc.setLed(0,0,2,true);
    delay(delaytime2);
lc.setLed(0,0,3,true);
    delay(delaytime2);
lc.setLed(0,0,4,true);
    delay(delaytime2);
lc.setLed(0,0,5,true);
    delay(delaytime2);
lc.setLed(0,0,6,true);
    delay(delaytime2);
lc.setLed(0,0,7,true);
    delay(delaytime2);  

lc.setLed(0,0,0,false);
    delay(delaytime2);
lc.setLed(0,0,1,false);
    delay(delaytime2);
lc.setLed(0,0,2,false);
    delay(delaytime2);
lc.setLed(0,0,3,false);
    delay(delaytime2);
lc.setLed(0,0,4,false);
    delay(delaytime2);
lc.setLed(0,0,5,false);
    delay(delaytime2);
lc.setLed(0,0,6,false);
    delay(delaytime2);
lc.setLed(0,0,7,false);
    delay(delaytime2);

lc.setLed(0,1,0,true);
    delay(delaytime2);
lc.setLed(0,1,1,true);
   delay(delaytime2);
lc.setLed(0,1,2,true);
    delay(delaytime2);
lc.setLed(0,1,3,true);
    delay(delaytime2);
lc.setLed(0,1,4,true);
    delay(delaytime2);
lc.setLed(0,1,5,true);
    delay(delaytime2);
lc.setLed(0,1,6,true);
    delay(delaytime2);
lc.setLed(0,1,7,true);
    delay(delaytime2);
  
lc.setLed(0,1,0,false);
    delay(delaytime2);
lc.setLed(0,1,1,false);
    delay(delaytime2);
lc.setLed(0,1,2,false);
    delay(delaytime2);
lc.setLed(0,1,3,false);
    delay(delaytime2);
lc.setLed(0,1,4,false);
    delay(delaytime2);
lc.setLed(0,1,5,false);
    delay(delaytime2);
lc.setLed(0,1,6,false);
    delay(delaytime2);
lc.setLed(0,1,7,false);
    delay(delaytime2);

lc.setLed(0,2,0,true);
    delay(delaytime2);
lc.setLed(0,2,1,true);
    delay(delaytime2);
lc.setLed(0,2,2,true);
    delay(delaytime2);
lc.setLed(0,2,3,true);
    delay(delaytime2);
lc.setLed(0,2,4,true);
    delay(delaytime2);
lc.setLed(0,2,5,true);
    delay(delaytime2);
lc.setLed(0,2,6,true);
    delay(delaytime2);
lc.setLed(0,2,7,true);
    delay(delaytime2);
  
lc.setLed(0,2,0,false);
    delay(delaytime2);
lc.setLed(0,2,1,false);
    delay(delaytime2);
lc.setLed(0,2,2,false);
    delay(delaytime2);
lc.setLed(0,2,3,false);
    delay(delaytime2);
lc.setLed(0,2,4,false);
    delay(delaytime2);
lc.setLed(0,2,5,false);
    delay(delaytime2);
lc.setLed(0,2,6,false);
    delay(delaytime2);
lc.setLed(0,2,7,false);
    delay(delaytime2);

lc.setLed(0,3,0,true);
    delay(delaytime2);
lc.setLed(0,3,1,true);
    delay(delaytime2);
lc.setLed(0,3,2,true);
    delay(delaytime2);
lc.setLed(0,3,3,true);
    delay(delaytime2);
lc.setLed(0,3,4,true);
    delay(delaytime2);
lc.setLed(0,3,5,true);
    delay(delaytime2);
lc.setLed(0,3,6,true);
    delay(delaytime2);
lc.setLed(0,3,7,true);
    delay(delaytime2);
  
lc.setLed(0,3,0,false);
    delay(delaytime2);
lc.setLed(0,3,1,false);
    delay(delaytime2);
lc.setLed(0,3,2,false);
    delay(delaytime2);
lc.setLed(0,3,3,false);
    delay(delaytime2);
lc.setLed(0,3,4,false);
    delay(delaytime2);
lc.setLed(0,3,5,false);
    delay(delaytime2);
lc.setLed(0,3,6,false);
    delay(delaytime2);
lc.setLed(0,3,7,false);
    delay(delaytime2);

lc.setLed(0,4,0,true);
    delay(delaytime2);
lc.setLed(0,4,1,true);
    delay(delaytime2);
lc.setLed(0,4,2,true);
    delay(delaytime2);
lc.setLed(0,4,3,true);
    delay(delaytime2);
lc.setLed(0,4,4,true);
    delay(delaytime2);
lc.setLed(0,4,5,true);
    delay(delaytime2);
lc.setLed(0,4,6,true);
    delay(delaytime2);
lc.setLed(0,4,7,true);
    delay(delaytime2);
  
lc.setLed(0,4,0,false);
    delay(delaytime2);
lc.setLed(0,4,1,false);
    delay(delaytime2);
lc.setLed(0,4,2,false);
    delay(delaytime2);
lc.setLed(0,4,3,false);
    delay(delaytime2);
lc.setLed(0,4,4,false);
    delay(delaytime2);
lc.setLed(0,4,5,false);
    delay(delaytime2);
lc.setLed(0,4,6,false);
    delay(delaytime2);
lc.setLed(0,4,7,false);
    delay(delaytime2);

lc.setLed(0,5,0,true);
    delay(delaytime2);
lc.setLed(0,5,1,true);
    delay(delaytime2);
lc.setLed(0,5,2,true);
    delay(delaytime2);
lc.setLed(0,5,3,true);
    delay(delaytime2);
lc.setLed(0,5,4,true);
    delay(delaytime2);
lc.setLed(0,5,5,true);
    delay(delaytime2);
lc.setLed(0,5,6,true);
    delay(delaytime2);
lc.setLed(0,5,7,true);
    delay(delaytime2);
  
lc.setLed(0,5,0,false);
    delay(delaytime2);
lc.setLed(0,5,1,false);
    delay(delaytime2);
lc.setLed(0,5,2,false);
    delay(delaytime2);
lc.setLed(0,5,3,false);
    delay(delaytime2);
lc.setLed(0,5,4,false);
    delay(delaytime2);
lc.setLed(0,5,5,false);
    delay(delaytime2);
lc.setLed(0,5,6,false);
    delay(delaytime2);
lc.setLed(0,5,7,false);
    delay(delaytime2);

lc.setLed(0,6,0,true);
    delay(delaytime2);
lc.setLed(0,6,1,true);
    delay(delaytime2);
lc.setLed(0,6,2,true);
    delay(delaytime2);
lc.setLed(0,6,3,true);
    delay(delaytime2);
lc.setLed(0,6,4,true);
    delay(delaytime2);
lc.setLed(0,6,5,true);
    delay(delaytime2);
lc.setLed(0,6,6,true);
    delay(delaytime2);
lc.setLed(0,6,7,true);
    delay(delaytime2);
  
lc.setLed(0,6,0,false);
    delay(delaytime2);
lc.setLed(0,6,1,false);
    delay(delaytime2);
lc.setLed(0,6,2,false);
    delay(delaytime2);
lc.setLed(0,6,3,false);
    delay(delaytime2);
lc.setLed(0,6,4,false);
    delay(delaytime2);
lc.setLed(0,6,5,false);
    delay(delaytime2);
lc.setLed(0,6,6,false);
    delay(delaytime2);
lc.setLed(0,6,7,false);
    delay(delaytime2);

lc.setLed(0,7,0,true);
    delay(delaytime2);
lc.setLed(0,7,1,true);
    delay(delaytime2);
lc.setLed(0,7,2,true);
    delay(delaytime2);
lc.setLed(0,7,3,true);
    delay(delaytime2);
lc.setLed(0,7,4,true);
    delay(delaytime2);
lc.setLed(0,7,5,true);
    delay(delaytime2);
lc.setLed(0,7,6,true);
    delay(delaytime2);
lc.setLed(0,7,7,true);
    delay(delaytime2);
  
lc.setLed(0,7,0,false);
    delay(delaytime2);
lc.setLed(0,7,1,false);
    delay(delaytime2);
lc.setLed(0,7,2,false);
    delay(delaytime2);
lc.setLed(0,7,3,false);
    delay(delaytime2);
lc.setLed(0,7,4,false);
    delay(delaytime2);
lc.setLed(0,7,5,false);
    delay(delaytime2);
lc.setLed(0,7,6,false);
    delay(delaytime2);
lc.setLed(0,7,7,false);
    delay(delaytime2);

}
 
Last edited by a moderator:

philba

Joined Aug 17, 2017
960
The MAXIM 7219 is designed to drive 64 unique LEDs. Either as an 8 digit 7 segment display (plus decimal points) or as an 8x8 array. I'm not sure how you're going to get 292 individually addressable LEDs out of one chip. 292 isn't a multiple of 64 so I'm a bit confused.

How will the LEDs be mounted for display? It seems to me that you made your problem a lot harder by having to wire individual LEDs. If the LEDs go into a set pattern, why not just lay out a board that puts the LEDs in that pattern.

But to your question - kerning is the space between characters. That software looks like code for a rolling display based on multiple 8x8 LED arrays.

There are much, much easier ways to control long strings of LEDs. My current favorite approach is to use WS2812B addressable LEDs in a string. One pin is used to control up to thousands of LEDs. They are about 10 cents each off ebay/aliexpress. The software is relatively simple. You can get them on tape but not sure it would meet your format. You could make smaller PCBs that holds your segments that you would then piece together into the final sequence. Here's a shot of an 8 LED board I did. One pin on an ATTiny 85 drives all 8. The pattern in the picture is actually a rolling Red, Green, Blue, black/off pattern. I'm certain you could do this for well less than $400. Probably less than $100.
P1050022.jpg
 

Thread Starter

allenpitts

Joined Feb 26, 2011
121
Hello Philba and the AAC forum,

Thanks for your reply in the photo of the PCB above it may be noticed that on the sides of the boards are right angle male/female connectors marked 'DIN, GRND, LOAD CLOCK V++. These allow the boards to be daisy chained. Five boards will do 320 LEDs.

The WS2812B is a great solution. The display envisioned is to write a fixed script using 3mm LEDS.

This animated GIF show the first four characters of the project's eight characters.

Allen in Dallas
 

philba

Joined Aug 17, 2017
960
Do you want:
- multiple colors or not?
- all on at once or sequenced?
- flashing/chasing/...?

How big an area? HxW?

What kind of mounting?
 

Thread Starter

allenpitts

Joined Feb 26, 2011
121
Hello Philba and the AAC forum,

The display is a 28" x17" piece of 1/8 inch of plexiglas set in a black wooden frame. The letters 'Matt' in the animated GIF above, is four letters of an eight character phrase measuring 3" high and 16' long.
It is activated by a passive infrared sensor (PIR), a motion detector.


The letters, like the ani GIF, would display in sequence until all the letters are lit. The overall effect should be as if one were seeing the characters written in script on a wall.

The display was attempted for nine months using 74HC595 and a Sparkfun BOB 10860. But that is eight LEDs to an IC which required a daisy chain of 37 modules and provided unpredictable results. 7219 will require five chips and, hopefully, a better end product.

This is the third design of this project (first using Maxim7219, then 75HC595 and now back to 7219) in both
previous attempts power has been an issue. Hell, I may just go ahead and build the rats nests and live with the construction nightmare, but the power issue still concerns me.

If one of the diagrams or photos of the PCB above is examined, just to the left of the five IC inputs (V++, ground, Clock, Load and DIN) are two thru hole pads for V++ and ground. This is because the Arduino only sources half an amp and each LED requires 20ma. So 292 LEDs on all at the same time would want 5,840 milliamps or about 6 amps.
The Arduino won't get there. So the power terminal pads are designed to allow a connection to ten amp, five volt power supply. But if my Physics 101 is remembered when the 5v .5 amp at the Arduino is connected to 5v 10 amp wall wart, in parallel, the voltages are additive and the result will be ten volts. And I think if I connect the 10 amp source at the PCB there will be enough energy to make a second power source to the Arduino unnecessary.

Or the power to the Arduino could remain and the V++ from microcontroller to 7219 cut. But all of the schematics for the 7219 say that if an external power source is used to drive the LEDs then the ground from the external source should be grounded to the Arduino. So maybe one should use two power supplies but not connect the V++ of the Arduino to the V++ of the IC/LEDs.

This is where my ignorance of EE fails me.

Oh well. It is written: The recognition of ignorance is the beginning of knowledge.

Allen in Dallas
 

philba

Joined Aug 17, 2017
960
Hello Philba and the AAC forum,

If one of the diagrams or photos of the PCB above is examined, just to the left of the five IC inputs (V++, ground, Clock, Load and DIN) are two thru hole pads for V++ and ground. This is because the Arduino only sources half an amp and each LED requires 20ma. So 292 LEDs on all at the same time would want 5,840 milliamps or about 6 amps.
The Arduino won't get there. So the power terminal pads are designed to allow a connection to ten amp, five volt power supply. But if my Physics 101 is remembered when the 5v .5 amp at the Arduino is connected to 5v 10 amp wall wart, in parallel, the voltages are additive and the result will be ten volts. And I think if I connect the 10 amp source at the PCB there will be enough energy to make a second power source to the Arduino unnecessary.
If you connect them in parallel, it will only be 5V. However you really only need the 10A supply feeding both the arduino and the LED array. I'd include a switch to turn off 5V to the arduino when using it with USB as that supplies power to the arduino. More a precaution but worth doing.

And yes, all the grounds need to be connected together.
 
Top