Arduino + Max7219 only works if...

So I programmed a 6 digit display using a MAX7219. Everything works great until I get it off my bench and into the project. Quick setup, when powered on the display starts scrolling numbers. Problem, when power is applied, nothing happens. Until I press the reset button on the board, then it works great. Thought it might need a delay for the max7219 to power up, went as high as delay(2000); no dice.

Any help would be appreciated.

Thank you, Travis

How is the stand-alone circuit powered - and how is the reset line connected?

What about your code ? Can you please post it.

I did a simple test code to test one of the 70 chips I order. I was using 8 digit commun cathode display. The MAX7219 as to be initialize properly to make it work. And also the proper Rset to limit the current into the segments.

Stand alone, was as follows: (2) 9v batteries in parallel fed into the 2.1mm Jack on an Arduino Uno, Pin12->DIN, Pin11->CLK, Pin10->Load, Pin7->1k Pull-up & Latching SW to GND. Reset Pins untouched, we were pressing the reset button on the uno.

With the RSET on the Max7219, we tried both a 10k and a 22k ohm resistor. Both worked, same problem.

//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn 
 pin 11 is connected to the CLK 
 pin 10 is connected to LOAD 
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);
int varMega = 0;
int varMicro = 0;
int iLoop = 0;
/* we always wait a bit between updates of the display */
unsigned long delaytime=125;

void setup() {
  delay(500);
  Serial.begin(9600);
  pinMode(7, INPUT);

  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,15);
  /* and clear the display */
  lc.clearDisplay(0);
  lc.setScanLimit(0,5);
}

void loop() 
{
      for (int x = iLoop; x < 999; x++)
    {
      if(digitalRead(7) == LOW)
       {
       break;
       } 
      setMega(x);
      setMicro(random(0,999));
      delay(50);
      if (random(0,400) < 20){
        delay(1000);
      }
      iLoop = x;
      if (iLoop == 998)
      {
        iLoop = 0;}
    }
}

void setFull(long num)
{
  int digit1 = num / 100000;
    long newNum = num - (digit1 * 100000);
  int digit2 = newNum / 10000;
    newNum = newNum - (digit2 * 10000);
  int digit3 = newNum / 1000;
      newNum = newNum - (digit3 * 1000);
  int digit4 = newNum / 100;
        newNum = newNum - (digit4 * 100);
  int digit5 = newNum / 10;
        newNum = newNum - (digit5 * 10);
  int digit6 = newNum;
  
//  int digit3 = (num - (digit1 * 100)) - (digit2 * 10);
  lc.setDigit(0,0,digit1,false);
  lc.setDigit(0,1,digit2,false);
  lc.setDigit(0,2,digit3,true);
  lc.setDigit(0,3,digit4,false);
  lc.setDigit(0,4,digit5,false);
  lc.setDigit(0,5,digit6,false);
}

void setMega(int num)
{
  int digit1 = num / 100;
  int digit2 = (num - (digit1 * 100))/10;
  int digit3 = (num - (digit1 * 100)) - (digit2 * 10);
  lc.setDigit(0,0,digit1,false);
  lc.setDigit(0,1,digit2,false);
  lc.setDigit(0,2,digit3,true);
}
void setMicro(int num)
{
  int digit1 = num / 100;
  int digit2 = (num - (digit1 * 100))/10;
  int digit3 = (num - (digit1 * 100)) - (digit2 * 10);
  lc.setDigit(0,3,digit1,false);
  lc.setDigit(0,4,digit2,false);
  lc.setDigit(0,5,digit3,false);
}

Rset is a bit high in my opinion. Choose a 62 K and see what happen.

In the void setup(), the MAX7219 is not properly setup in my opinion. It is missing a few init line. Check the datasheet of the MAX7219 if you have question.

If your setup was working connect to the PC, and connect to the 9V battery is not, too much current is being use. ( Over 100 mA ). To confirm it, measured the current going into the 2.1 mm jack.

I'm having a very similar problem to Nexnox. I have a circuit that has three MAX7219's chained together, using a 24K resistor as RSET. I'm testing with an Arduino Pro Mini and a Sparkfun Pro Micro, with power coming from a 7805 regulator. Everything works great when using the Sparkfun Pro Micro (which takes a couple of seconds to initially boot up), but with the Arduino Pro Mini (which boots up instantly) only the third MAX7219 fires up. When I press the reset button on the Pro Mini everything works fine.

I will try increasing the RSET resistor to see if it makes a difference. Are there any other suggestions?

Do you have pin 2 & pin 3 on the atmega pulled to ground through 10K resistors? I had a similar problem with a stand alone atmega8 and it was floating RX/TX pins causing the bootloader to think it was being talked to and not allowing program to run.

Only Rx would need to be 'terminated', Tx could be left to float.

I’ve tried terminating the Pro Mini’s RX pin to ground, and increased the RSET resistor from 28K to 33K, but neither makes a difference. I replaced the MAX7219 chips again; this time the chips have a different batch number, and they work perfectly every time now.
That’s what I get for using cheap knockoff chips from eBay. :blush: