MAX7219 Acting As Though Disconnected?

I'm trying to build a 2-digit 7-segment LED display using a MAX7219 driver, to display some information on my model railroad. I built it with digits 0 and 1 wired, and CLK, DIN and LOAD lines going to the Arduino, as well as +5v and GND. Following this, I tested it on my workbench with a simple count up sketch (below), and it worked. However, I then made the mistake of soldering some additional wires to the Arduino connection, to extend the wires to reach the location it is to be installed. In order to do this, I extended the 5 wires to the Arduino with some CAT5 cable, using 2.5 pairs. A push button was connected to a 6th wire in this cable, with the other side of it going to the GND connection.

Following this, I tested the LED display again, expecting the same result. After all, I haven't added any components. However, at best, all it would do was flicker upon startup, then show blank. Since then, I have taken the following troubleshooting steps:

  • Mapped out the wires from the end of the CAT5 cable to the connections to the IC socket - confirmed them correct.
  • Tried 3 different MAX7219 chips - all of them brand-new until I put them into the IC socket.
  • Tried multiple pins on my test Arduino, and have even soldered wires directly to the pins in order to eliminate a loose contact as a source of the issues. (My particular Arduino had solder pads for this purpose.)
  • Tried a second Arduino.

None of the above have produced any result - it just flickers on startup and that's it. Given that I have only added less than 1m of wire, and no other components, between the working and non-working state, I am baffled as to why it is not working. The only change was extending the control wires. Can anyone shed any light on why this may be happening?

I should also mention that the Arduino and MAX7219 are both being driven by a 5V regulated power supply - they have a common ground.

The test sketch is below:

#include <LedControl.h>

/* This is a simple sketch to test a 2-digit LED display driven
 *  by a MAXX 7219 or 7221 chip. 
 */

#define LEDData 3
#define LEDClk 4
#define LEDLoad 5

int counter = 80; //Counter that counts up
LedControl testLED = LedControl(LEDData, LEDClk, LEDLoad, 1);
//Create LedControl object with defined pins.

void setup() {
  // put your setup code here, to run once:
  testLED.shutdown(0, false);
  //Is in power-saving mode on startup - this wakes it up
  testLED.setIntensity(0, 8);
  //Sets brightness of display to middle of range (0-15)
  testLED.clearDisplay(0);
}

void loop() {
  // put your main code here, to run repeatedly:
  disNumLed(counter); //Update Display
  delay(500); //Wait half a second
  counter++; //Increment counter
  //if (counter > 99){
    //counter = 0; //Reset if above 99
  //}
}

void disNumLed (int disNum) {
  //Takes an integer and displays it on the 2-digit LED display.  Will ignore values above 99.
  int firstDigit;
  int secondDigit;

  testLED.clearDisplay(0);
  firstDigit = disNum % 10; //Return remainder of division operation (modulus)
  testLED.setDigit(0, 0, firstDigit, false);

  if (disNum > 9) {
    //If int is still greater than 9, then there should be another digit (base 10)
    disNum /= 10; //Move to next digit
    secondDigit = disNum % 10;
    testLED.setDigit(0, 1, secondDigit, false);
  }
}

(I've been using different values for the LED pins while doing point 3 of the troubleshooting above - all with the same result.)

Have you got a 'scope, or access to one? With the test sketch running, take a look at each of the signals as they emerge from the Arduino pin compared to the signal arriving at the max7219 pin, using 2 of the 'scope channels. See any differences? For example is one of the signals a nice neat square wave with sharp vertical edges, but at the destination has become an ugly triangle pattern, or is there an extra signal imposed on it such as a 50/60Hz sine wave? If you see differences, some 'scopes let you snap the screen to a usb memory stick, or you can snap them on your phone and post here?

I don't have a scope, but I do have additional information. After posting my initial message last night, I cut off the Cat 5 cable and tested it with just the original control wires. I ended up getting the same results. At this point, the only point of failure that I haven't replaced is the IC socket itself. So I'm going to desolder that, and solder the MAX7219 chip directly to the board. Either it'll work or I'll need to re-connect the LEDs to a new socket.

I was mostly baffled as this is the third time I've done such a setup, with the Cat 5 cable and everything (it's a useful way to keep things organised).

Cool, let us know what you find.

Tbdanny:
I should also mention that the Arduino and MAX7219 are both being driven by a 5V regulated power supply - they have a common ground.

Connected of course, to the "5V" pin on the Arduino.

I doubt the socket is the problem. Something is broken. Perhaps a picture (taken in daylight, not a dark room) to see whether you did anything unconventional?

And you say this is not the first time you have assembled this particular setup with the same components including Cat 5 cable? If there is a concern about cable capacitance affecting the control signals, the "trick" is to use your own software shift register routine so that the transfer is slower and the latching sequence is well defined.

I think I've found the cause of the problem, but I have no idea why it's happening or how to fix it.

I removed the IC socket, and soldered the MAX7219 chip directly to the board. Following this, I got the same results when testing with the Cat 5 cable attached. However, when I cut off the Cat 5 and tested with the original control wires, then it worked. I then tried connecting the MAX7219 to the Arduino with alligator leads, approximately 1' long (shorter than the Cat 5). It didn't work.

It appears that if the MAX7219 is connected to the Arduino by wires that are longer than the original control wires (appox 4"), then it does not work. I even replaced the original control wires to the chip with larger gauge ones, but this still did not resolve the issue.

In my previous installs, I've installed the MAX7219 3-4 feet away from the Arduino without any issue. In this case, it does not appear to work if connected by more than a few inches of wire. What is happening and how can I fix this? I'd like to be able to install this on my layout fascia, which is a few feet away from the Arduino.

Here are the photos of the current setup. The red dot indicates pin 1. Control wires are as follows:

  • Red = +5v
  • Red with white = GND
  • Brown = DIN
  • Blue = CLK
  • Blue with white = Load

(The thick blue wire up next to the red & white wire is the GND connection to the pushbutton. The white wire with heatshrink passes through that hole in the board without being connected - it was cut too short and I had to re-route it.) Also, the MAX7219 is not powered from the Arduino - both it and the Arduino are drawing power from the regulated power supply.

This arrangement works with the short control cables, but fails as soon as they're lengthened. At this point, I've replaced everything save the LEDs themselves, and I don't think they need to be replaced as they're downstream of the problem.

Update:
I've found one of those pre-made 8x8 LED matrix displays with a MAX7221 built into it, with four matrixes in a row, amongst my Arduino bits & pieces. I've decided to use one of these matrixes instead, as it will allow me to display the numbers 1-15. It's also more flexible than the 7-segment display in that I can display letters, too.

I've already tested this, and it works over a 3-foot cable. So no issues with distance. As such, I'll be following this plan instead.

You should have 2 caps attached to the max7219. A 0.1uF ceramic bypass cap close to the power pins and a 10uF electrolytic cap also. These are shown in the max7219 data sheet and are not optional.

Thank-you. That would do it. But I'm looking at the datasheet, and I can only see the 0.1uF one in place, straddling the +5v and GND on pin 19. Is this also where the other one is supposed to go?

Edit: Never mind, found mention of it in the text. "To minimize power-supply ripple due to the peak digit driver currents, connect a 10μF electrolytic and a 0.1μF ceramic capacitor between V+ and GND as close to the device as possible." I'll give that a try and see how it goes.

Tbdanny:
Edit: Never mind, found mention of it in the text. "To minimize power-supply ripple due to the peak digit driver currents, connect a 10μF electrolytic and a 0.1μF ceramic capacitor between V+ and GND as close to the device as possible." I'll give that a try and see how it goes.

The positions of the said capacitors do matter. I faced similar problems and solved it by soldering them with the IC pins (4 and 19) by riding over the chip.

I was lucky enough to have the correct capacitors in my bits box. I've put them in place and tested it over a 3-foot cable, and it works without any problems. It also doesn't flicker on startup. So that was what I was missing.

Thanks to everyone who suggested solutions.

Thanks for replying back on the solution, it may help others in the future.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.