MAX7219 Issues (Newbie)

I got my Arduino Demuilove set just a couple weeks ago. I had gone through some of the basic projects (blinking LEDs, piezeo buzzer, dimming LEDs with a pot, etc). I eventually have a plan of hooking up a series of LED Matrices to create sort of a display, but that’s far off. In the mean time, I had ordered a dual-color medium (R/Y) 8x8 matrix from SparkFun, and two MAX7219’s from Tayga Electronics. I eventually got those in, and wanted to try out a bare-bones test of the chips and matrix.

My hookup image is in a followup message, since this is my first post on the boards, I can’t post images.

Which essentially connects just one LED in the matrix. My intention was to get it working with one LED before I go and wire up the entire board. The one LED turns on all right, but it doesn’t blink as I was expecting it to. See my code below:

#include "LedControl.h"
LedControl lc1=LedControl(9,10,11,1);  //set DATA, CLOCK, and CS Pins, and indicate number of MAX7219's
int ledPin =  13;    // LED connected to digital pin 13

void setup() {
  for(int index=0;index<lc1.getDeviceCount();index++) {
      lc1.shutdown(index,false);
  }
  pinMode(ledPin, OUTPUT);     
}

void loop() {
  digitalWrite(ledPin, HIGH);   // blink two long blinks to indicate start of loop
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(100);
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(100);
  for(int i=0;i<8;i++) {
  lc1.setRow(0,i,B00000000); // Go through and set all rows to be off
}
delay(1000);
  digitalWrite(ledPin, HIGH);  //blink three short blinks to indicate middle of loop
  delay(100);
  digitalWrite(ledPin, LOW);
  delay(100);
    digitalWrite(ledPin, HIGH);
  delay(100);
  digitalWrite(ledPin, LOW);
  delay(100);
    digitalWrite(ledPin, HIGH);
  delay(100);
  digitalWrite(ledPin, LOW);
  delay(100);
for(int i=0;i<8;i++) {
  lc1.setRow(0,i,B11111111); // Go through and turn on all rows.
}
  delay(1000);
}

The built-in led blinks as expected, at the expected times, but the matrix LED stays on. Now, I put this together at 3am out of boredom and perverse interest, one thing I know I messed up was that I didn’t have the ISET connected when I first attempted to use the MAX7219. I added in the ~30kOhm resistor after reading that part of the instructions. Clearly an oversight, but I’m not sure if it would lead to the IC not working. Any ideas? Should I go out and order more of these ICs because I noobishly fried my current ones? I’m reading up on the basics of hobbyist electronics, so I know I have a long way to go to understanding everything!

LED Matrix Wiring Diagram: http://www.glowseed.com/mindmash/wp-content/uploads/2009/05/pins-led-matrix-dual-color-medium.pdf LED Matrix Spec Sheet: http://www.sparkfun.com/datasheets/Components/SanYoung-Medium-RG.pdf MAX7219 Spec Sheet: http://datasheets.maxim-ic.com/en/ds/MAX7219-MAX7221.pdf

in your code, you are turning the built-in led on, off, on, off, with a delay between each change. Then, you are turning each row of the matrix off. Then, you turn the built-in led on, off, on, off, with a delay in between. Finally, you turn the each row of the matrix on.

After 1 second, you repeat the while process.

Does the matrix stay on, once it is turned on, or does it go on for one second and off for half a second?

Hi, maybe you should go through the Documentation of the LedControl again. http://www.arduino.cc/playground/Main/LedControl

In setup() you correctly wakeup the Display from shutdown, but it will be set to minimum brightness, which may is so dim on your case that you see no light at all. See here : http://www.arduino.cc/playground/Main/LedControl#SetupDefault for some standard initilization.

You can use the setRow() command to turn the whole row on and off but there is a special command "setLed" to turn inidividual led's on or off. http://www.arduino.cc/playground/Main/LedControl#SingleMatrixControl#SingleMatrixControl For the Led between DIG0 and SegDP the call should be setLed(0,0,0,HIGH) to turn it on setLed(0,0,0,LOW) to turn it off.

Eberhard

Does the matrix stay on, once it is turned on, or does it go on for one second and off for half a second?

The matrix stays on, while the built-in LED flashes as expected.

Hi, maybe you should go through the Documentation of the LedControl again. http://www.arduino.cc/playground/Main/LedControl ... For the Led between DIG0 and SegDP the call should be setLed(0,0,0,HIGH) to turn it on setLed(0,0,0,LOW) to turn it off.

Thanks for taking a look! I had tried setLed before, but wasn't sure if I had wired stuff correctly, so I figured it was easier (and more re-usable) to turn off every row, and then turn it on, hoping that it would affect my one currently wired LED. I just tried using setLed again, and it had the same result, the one wired LED stays solidly on. I also tried adding the setIntensity to my setup, but that didn't make a difference either.

I'm guessing I somehow either fried the chip, or it came to me as a dud. I'm just surprised that it would turn on any LEDs if that were the case.

Anyone have a preferred supplier for these chips? I picked my last two up from Tayda Electronics (http://www.taydaelectronics.com/servlet/the-788/Display-Drivers-serially-interfaced/Detail), which seemed like a pretty decent price in comparison to other places I found the chip.

If leds are constantly ON or OFF in a combination with the 7219 the usual fault is that tthe leds are wired the wrong way round (which doesn't do any harm to them besides not working).

Do you have a datasheet link for the led-matrix you connected? Eberhard

Woo, that gives me some hope! Here are the links I have for the matrix:

LED Matrix Wiring Diagram: http://www.glowseed.com/mindmash/wp-content/uploads/2009/05/pins-led-matrix-dual... LED Matrix Spec Sheet: http://www.sparkfun.com/datasheets/Components/SanYoung-Medium-RG.pdf

The wiring diagram is what one person found through trial and error, and uploaded on the sparkfun product page.

Heck, I must be reading the diagrams wrong, because I just reversed the wiring and it's working now! Dig0 to Pin1, SegDP to Pin5 blinks LED 0,0 as I want it to.

I'm not sure I quite get the Max's pins, are the Dig's 5v, and the Seg's GND? I have a multimeter on order that would clarify that, but alas, it isn't here quite yet.

Hi, great its working.

Heck, I must be reading the diagrams wrong, because I just reversed the wiring and it's working now! Dig0 to Pin1, SegDP to Pin5 blinks LED 0,0 as I want it to.

I'm not sure I quite get the Max's pins, are the Dig's 5v, and the Seg's GND?

Just the other way round anodes of the leds goes to the SegA B C.. pins, and the cathodes to the DIG0 1 2 3 ... pins.

But you can't do much with a multimeter here because all the pins are multiplexed (switched on/off very fast) Eberhard