Go Down

Topic: MAX7219 and Common Anode displays with LedControl (Read 6128 times) previous topic - next topic

CrossRoads

Yes, the Arduino can supply current for 2 matrixes. I have powered four, with 9V source. 12V was too much, the regulator would over heat and shutdown.

Theoretically, to have two MAX7219 driving a dual color common cathode matrix one would wire it like this, and multiplex the outputs by alternately putting each part in shutdown mode:

"When the MAX7219 is in shutdown mode, the scan oscillator is halted, all segment current sources are pulled to ground, and all digit drivers are pulled to V+, thereby blanking the display."

The diodes isolate each part from the common cathode so the MAX7219s do not interfere with each other when sinking cathode current.

As a hardware engineer, I would use SPI.transfer()s to communicate to each part, with a seperate ssPin to each part so that you could update one or the other.
SCK - to MAX7219 CLK pin 13
MOSI - MAX7219 DIN pin 1
ssPin - to MAX7219 LOAD pin 12

Or, daisy chain them and write a loop that updated the 8 registers on each one every so many mS for animations.
I don't follow this fascinintion with using the equivalent of shiftout() for sending data to the parts:

Arduino pin 12 is connected to MAX7219 DIN pin 1
Arduino pin 11 is connected to MAX7219 CLK pin 13
Arduino pin 10 is connected to MAX7219 LOAD pin 12
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

rhawbert

Hi d82k,

If I'd wire your matrix I'd make it like this (I changed the SEG connections only):
This way I think the multiplex would be better handled by the driver (and the LedControl library, I think).
Lines would be lines and cols=cols... easier to address them individually.

Code: [Select]

Col Pin _______ Pin Row
DIN    1|o |24 DOUT
1 23 DIG 0  2| |23 SEG D 13   4
5 2 DIG 4  3|   M |22 SEG DP 12   8
GND    4|   A |21 SEG E 3   5
7 8 DIG 6  5|   X |20 SEG C 16   3
3 17 DIG 2  6|   7 |19 V+
4 14 DIG 3  7|   2 |18 ISET
8 11 DIG 7  8|   1 |17 SEG G 9   7
GND    9|   9 |16 SEG B 19   2
6 5 DIG 5 10| |15 SEG F 6   6
2 20 DIG 1 11|  RED |14 SEG A 22   1
LOAD  12|_______|13 CLK



I'm also using a 22kOhm resistor... I think the leds will just light up a bit brighter... but I guess the extra current wont harm them, as per the info in the datasheet.

I'm a also a novice so... I'm still figuring it out too but from what I've read the capacitors' function is to smooth the current drops and stabilise it since the MAX7219 seems to be quite sensible.

Other heads up when connecting more than one matrix is to loop through all of then in the setup function:

Code: [Select]

void setup() {
  for(int index=0;index<lc.getDeviceCount();index++) {
      lc.shutdown(index,false);
  }
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}

--
Rhawbert Costa

spencer2004

Hi, sorry for my ignorence but how do I patch the origional ledControl libary with the common-anode patch? I tried to find out how to do it on Google but I couldn't find anything.

CrossRoads

Are you driving a matrix, or 7-segment displays?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

spencer2004

I need to drive an 8 digit common anode 7 seg display.

I have sort of figured out how to patch it but I can't get it to work; I patched the source file with GnuWin32 and it almost works but it says that hunk #4 failed at 219 whereas hunk 1, 2, 3 and 5 are successful. It says that I should use the -p or --strip option but I don't know how they work.

Would it be possible for somebody to upload the patched source file? It would be of great help.

spencer2004

Never mind I finally got it to work. It literally took me the whole day to figure it out!

spencer2004

#21
May 03, 2013, 08:42 pm Last Edit: May 03, 2013, 08:51 pm by spencer2004 Reason: 1
ok I have got it working perfectly but I am having some confusion with the value for the ISET resistor; I origionally used a 28k ohm resistor which is what the data sheet recommends but the 7 segment display was fairly dim so I tested it with a multimeter and each segment was drawing only 2 mA so I played around with the resistance value and I finally got each segment to run at 10 mA with a value of 2.2k which is much lower than it should be. Is it possible that using the MAX7219 as a common anode display driver drasticaly changes the value required for the ISET resistor?

I made sure that the software brightness control was at the maximum value of 15 and I have no resistors between the IC and the 7 segment display by the way.

Edit: Each segment draws 10mA only when 1 digit is activated, they progressively draw less current and get dimmer as more digits are activated until they only draw 4.25mA with all 8 digits activated, strangely the current draw per segment is unaffected if other segments on the same digit are activated (e.g. displaying a number 1 draws 20mA, a number 8 draws 70mA).

luponero76


ok I have got it working perfectly


hi
can you help me how to applicate de patch without hunk error?
i work under mac with unix
thank you
dd.

spencer2004



hi
can you help me how to applicate de patch without hunk error?
i work under mac with unix
thank you
dd.


I forgot how I did it but here are the patched files. Just extract it in to your LedControl folder.

Go Up