Go Down

Topic: Max 7219 Daisy chain sketch (Read 198 times) previous topic - next topic

AllenPitts

Hello Arduino forum,

Using Arduino and Max 7219 to control 256 LEDs in a linear display.
The desired effect is indicated in this animated GIF.


(The animated GIF show 157 green LEDs. The complete 256 were not
animated in the interest of time because this indicates the idea.)



A Max 7219 controls 64 LEDs on a PCB. Four boards are planned.

Have successfully connected two PCBs and have 128 light working
correctly.

The problem came when connecting the third board. Have connected the first
eight LEDs on the third board. They will not come on.

Checked the software and hardware over and over. Finally went back to the software
and found in the code when the line
LedControl lc=LedControl(12,11,10,3);
is changed to
LedControl lc=LedControl(12,11,10,2);
(more complete copy of sketch listed herewith below)
the LEDs on the third board light simultaneously
with first eight LEDs on the second board.

The fourth value in the LEDControl argument according to
https://playground.arduino.cc/Main/LedControl/#SingleMatrixControl
controls the number of Maxim 7219s in the daisy chain.

When the value is changes from 3 to 2 the ICs think there are
two ICs and turns on the LEDs on the third board. This proves
that the voltage the Clock and the Load are correct.

But can't figure out if there are three boards why, when
the third board is connected the third board will not working.

When connecting the second board had trouble because it was not realized that
lc.shutdown(1,false); line had to be added. Also it is believed
that the setIntensity values has to be set for each board
although there is not much literature on these values.

Any idea why the third board LEDs won't go positive?

Thanks.

Allen in Dallas

//Sketch begin third board
#include "LedControl.h"

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

unsigned long delaytime=500;
unsigned long delaytime2=70;

void setup() {

lc.shutdown(0,false);
lc.shutdown(1,false); //second board
lc.shutdown(2,false); //third board
/* Set the brightness to a medium values */
lc.setIntensity(0,6);
lc.setIntensity(1,6);
lc.setIntensity(2,6);
/* and clear the display */
lc.clearDisplay(0);
lc.clearDisplay(1);
lc.clearDisplay(2);
}

void loop() {

lc.setLed(0,0,0,true); //first octect 
    delay(delaytime2);
lc.setLed(0,0,1,true);
    delay(delaytime2); 
.....

SteveMann

#1
Sep 16, 2019, 10:10 pm Last Edit: Sep 16, 2019, 10:28 pm by SteveMann
Read How to use this forum, post your sketch- all of it. And a functional drawing of what you have.

I've never used the 7219, but it looks trivial to daisy-chain them together.  Have you tried swapping your modules to make sure they are all good?

6v6gt

You may have such problems with cheap MAX7219 clones. See this thread:
https://forum.arduino.cc/index.php?topic=629538.0

AllenPitts

Hello SteveMann, 6v6gt and the Arduino forum,

Getting my Max7219 from Mouser in Fort Worth TX. No imitation chips there.
Have swapped ICs and checked the voltages.

Beginning to think the Arduino is fried. I don't have the schematic here will try to post when I get home. But the concept is the system is powered by a 5V 10amp regulated power supply. But when I was loading the sketches I think the voltage would be the addition of the 5V from the power supply and the voltage from the
USB connector.

I have been going out online to research what it takes to overload voltage or current to UNO rev2.

Also since the system is ruined will reconnect the two voltages and see if it is 10 volts (5 from power supply and 5 plus or minus 1 from the USB connector) which would be consistent with the idea that ten or eleven volts would not fry the Arduino immediately would damage it over the two weeks it took for it to fail.

Also had it to four 1.5 volt C batteries in lieu of the regulated power supply.

Will advise.

If you or anyone else on over voltage damage to the Arduino Uno R2 it would be most helpful.

Thanks.

Allen in Dallas

CrossRoads

"But when I was loading the sketches I think the voltage would be the addition of the 5V from the power supply and the voltage from the USB connector."

The USB voltage is connected in parallel to the 5V from the regulator on the Uno.
The USB Gnd connects to the Gnd from the barrel jack and to the power header.
There is no way to get 10V into the board unless you really messed up your external wiring, and I can't envision a way to do that.

10 or 11V on the VCC pin would fry the board immediately.
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.

6v6gt

You have currently 3 max7219 circuit boards. Any combination of two in a daisy chain works. Adding the third breaks it. Is that it ?
It seams unlikely that there is a hardware fault with the Arduino.
You now have to post a schematic and the full code.

AllenPitts

Hello SteveMann, 6v6gt CrossRoads and the Arduino forum,

You have currently 3 max7219 circuit boards. Any combination of two in a daisy chain works. Adding the third breaks it. Is that it ?
It seams unlikely that there is a hardware fault with the Arduino.
You now have to post a schematic and the full code.
This assessment is correct. Working on drawing schematic. Will post.

Allen

AllenPitts

Hello SteveMann, 6v6gt CrossRoads and the Arduino forum,

Here is the schematic:
ard


The connection from the power source to the 5v pin may be unnecessary when the USB is connected to the Uno but it is needed when the USB is disconnected or there would be no power to the Arduino.

So the only thing I can figure when I daisy chained the third board that was the what it over the edge.

Also I wonder if the current is frying either the Arduino or the ICs and if so how to limit the current going to the microcontroller. Eight LEDs were hooked up on the third board for a total of 136 LEDs . The LEDs draw about 20 mA. So that's 2.7 amps.
But I don't think that goes thru the Arduino. Right?

I do think the power is blowing either the Uno or the 7219s because now when I turn on the power all 136 LEDs come on.

Got another couple Ardunos coming so can test w substitution but if over voltage is the problem would like to figure it out so I don't burn up more components.

Thanks.

Allen in Dallas





CrossRoads

#8
Sep 19, 2019, 02:08 am Last Edit: Sep 19, 2019, 02:09 am by CrossRoads
Each MAX7219 only turns on 8 LEDs at a time, so 160mA/MAX7219, so even 3 from an Arduino powered from 7.5V at the barrel to 5V from the regulator would be okay. That'd be 480mA, + 50 or so for the Arduino.
Here are 4 for example, running from 7.5V at the barrel jack. Not sure it's set for 20mA, had 10K resistors for Iset.

https://www.youtube.com/watch?v=hwYqgyMc5S4
(forum seems to add some extra characters to the start and end of links)

You can try putting a diode on the Arduino from 5V (anode) back to Vin (cathode) so the regulator is not reverse driven, some regulators are sensitive to that.
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.

6v6gt

Can you also measure the current being drawn at pins 10, 11 and 12 of you Arduino by the attached circuit to see if it is abnormally high?

Go Up