Why does 74hc595 work "better" without GRND (pin 8) grounded?

Thanks. I still don't know why it worked, though. Dumb luck is something I'd run with. :smiley:
Still up for an answer if anyone knows.

Sorry for not explaining well, I'm a complete noob with hardware.

I was considering adding resistors, but browsing images on google, there's several diagrams using LED matrixes without them. I'd add 8x220 resistors, but I'm not sure I want to sacrifice them for this project.
What'll happen without them? LEDs dying earlier?
I guess I should go do some current measurements through the whole thing to see how much above I am.

Without something to limit the current, you will shorten the life of the LEDs and the shift registers. Just because you see something done on the web does not mean it's ok. There are as many bad circuits as good ones out there.

220R will not be high enough to prevent damage. Assuming your leds are red and have a Vf of around 1.8V, the 220R will limit the led current to around 15mA. So the LEDs are protected. But the 595s are not. If all 8 LEDs in a row/column are lit, that's 120mA. The max current a 595 can handle is 70mA across all 8 outputs, so that's almost double the max. The max current a single 595 output can handle is 35mA if I remember correctly. So that's 3~4 times over the limit.

So to save the chips from damage, you need to limit each led's current to around 4mA, which means series resistors of around 800R.

Do you have an oscilloscope? You won't be able to measure the peak current with a multimeter, only the average. The peak will be at least 8 times the average. It's the peak current that does the damage.

The fact is, 595 does not make a good driver for led matrices. It was never designed for that. Get a max7219.

Or use TPIC6C595 or TPIC6B595 to sink current.

CrossRoads:
Or use TPIC6C595 or TPIC6B595 to sink current.

That would be an improvement, but you would still not be able to drive the LEDs to their maximum brightness. You would still need to limit the total row/column current to the 70mA limit of the remaining 595, so maybe 8mA per led. That would probably be enough except for outdoor use.

You could replace the other 595 with a mic5891. Then you could use your 220R series resistors.

But the max chip is still a better choice. One chip instead of two, no series resistors required (the chip has constant current drivers). Just one resistor and a couple of caps is all you need. And the Arduino is relieved of the burden of performing the multiplexing.

(This advice is aimed at the OP. I know you know all this stuff, Bob!)

Thanks for all the advice guys. I've scrapped the prototype for now as I'm really working on some other things, but I measured the current and I actually had two resistors in the circuit.

What the resistors did I'm more unsure of. I actually added them as an experiment to dim the leds, but I don't think I did it right. I just added one 1K res. between ground and the OE pin of each 595. Didn't seem to help. I was considering trying to run them to Vcc instead, but again, this is not my target project.

I learned a lot about the led matrix and shift registers though, and I'll make sure to do the math next time I try something at that (cable) scale.

However, the current from the second 595 and ground when running was fluctuating between 13 and 22 mA. In hindsight, I'm also pretty sure I drew it wrong - I used the 3.3V output. So it seemed safe, albeit only due to noob luck. :wink:

I was mostly curious about why it worked without grounding them. Here's a reply I got in a PM which makes enough sense:

Since you omitted the essential current limiting resistors, you have placed a 1.6 V "crowbar" between the outputs of the two 595s. With the ground connection missing, you have turned the Arduino outputs - when held LOW - into your current limiting resistors - but are likely overloading them in the process.

I actually added them as an experiment to dim the leds, but I don't think I did it right. I just added one 1K res. between ground and the OE pin of each 595. Didn't seem to help.

No surprise, that will do nothing at all to effect the LEDs.

I was mostly curious about why it worked without grounding them. Here's a reply I got in a PM which makes enough sense:

Yes that is the reason.
This is known as parasitic powering and is normally associated with current being sourced through input pins, but in this case it is current being sunk through the pins.

Hi again, everyone.

I'm back at the led matrix trying my luck with a MAX 7219, but I can't seem to make it respond to commands.

I'm 100% confident I've wired it correctly with regards to anodes and cathodes. I've verified it for hours with a multimeter, fixed a missing anode wiring etc. It's not inverted.

I've got the following wiring from an Arduino Uno:
Data: D4 - Max DIN 01
Clock: D3 - Max CLK 13
Load: D2 - Max LS 12

For hours, I've had it set up with a 10K resistor from Max pin 19 to 18. Whenever I upload a program, it scans the rows for a second or two, then it "dies". No command I send do squat.

I researched for a bit and found I should add some caps (for unknown reasons), so I added a 0.1u and a 10u polarized from the same breadboard row as max pin 19 (V+) to ground. No noticeable change.

Then I figured I should probably see if I was overloading the stuff, so I swapped out the resistor with a 47K one. And what do you know? All the LEDs are constantly on. Still, no matter what I send the MAX, nothing happens.

I'm now running with a 100K resisitor and a 47u polarized cap. The LEDs are still on, and the following program does noting. (I'd expect it to blink the entire display at 1 Hz)

Any hints appreciated. :slight_smile:

byte data = 4;
byte clk = 3;
byte latch = 2;

byte max_noop = 0x00;
byte max_d0 = 0x01;
byte max_d1 = 0x02;
byte max_d2 = 0x03;
byte max_d3 = 0x04;
byte max_d4 = 0x05;
byte max_d5 = 0x06;
byte max_d6 = 0x07;
byte max_d7 = 0x08;
byte max_decode_mode = 0x09;
byte max_intensity = 0x0A;
byte max_scan_limit = 0x0B;
byte max_shutdown = 0x0C;
byte max_test = 0x0F;

void output(byte address, byte data) {
  digitalWrite(latch, LOW);
  shiftOut(data, clk, MSBFIRST, address);
  shiftOut(data, clk, MSBFIRST, data);
  digitalWrite(latch, HIGH);
}

void setup() {
  Serial.begin(9600);

  pinMode(data, OUTPUT);
  pinMode(clk, OUTPUT);
  pinMode(latch, OUTPUT);

  digitalWrite(data, LOW);
  digitalWrite(clk, LOW);
  digitalWrite(latch, LOW);

  output(max_shutdown, 0x00);
}


void loop() {
  output(max_shutdown, 0x00);
  delay(1000);
  output(max_shutdown, 0x01);
  delay(1000);
}

Have a look at my code here. In particular look how I initialised the max chip in setup(), and how I controlled the latch when sending data to the chip.

Thanks Paul,

I'll try tweaking a bit more. I've tried all kinds of setup and row, but not all latching permutations.

But your code uses lsbfirst. Datasheet says msbfirst, no? Will try to flip for good measure.

Lars-Erik

lars-erik:
But your code uses lsbfirst.

No, it uses msbfirst.

I must have read it wrong. You're right. Never mind. :slight_smile:

In any case, I've fiddled a bit more, but the max either locks itself to all on or all off. It seems to happen randomly if I remove the data wire.

I've done some measurements with a constant output in loop with no delay. The clock pin has a "constant" voltage of around 1.5V. The load pin has 70 mV. However, the data pin seems completely silent. It shows 1.5 mV. If I turn all communication down, all the pins has 1.5 mV, so I guess that's the relative low.

Here's the code I run now:

byte data = 12;
byte clk = 11;
byte latch = 10;
byte status = 13;

byte max_noop = 0x00;
byte max_d0 = 0x01;
byte max_d1 = 0x02;
byte max_d2 = 0x03;
byte max_d3 = 0x04;
byte max_d4 = 0x05;
byte max_d5 = 0x06;
byte max_d6 = 0x07;
byte max_d7 = 0x08;
byte max_decode_mode = 0x09;
byte max_intensity = 0x0A;
byte max_scan_limit = 0x0B;
byte max_shutdown = 0x0C;
byte max_test = 0x0F;

void output(byte address, byte data) {
  digitalWrite(clk, LOW);
  shiftOut(data, clk, MSBFIRST, address);
  shiftOut(data, clk, MSBFIRST, data);
  digitalWrite(latch, HIGH);
  digitalWrite(latch, LOW);
}

void setup() {
  Serial.begin(9600);

  pinMode(data, OUTPUT);
  pinMode(clk, OUTPUT);
  pinMode(latch, OUTPUT);
  pinMode(status, OUTPUT);

  digitalWrite(data, LOW);
  digitalWrite(clk, LOW);
  digitalWrite(latch, LOW);

  output(max_shutdown, 0x01);
  output(max_decode_mode, 0x00);
  output(max_scan_limit, 0x07);
}


void loop() {
  for(byte i = 0; i<8; i++){
    output(i+1, 0x00);
  }
  digitalWrite(status, LOW);
  delay(100);
  for(byte i = 0; i<8; i++){
    output(i+1, 0xFF);
  }
  digitalWrite(status, HIGH);
  delay(100);
}

Code looks ok now. Sounds like hardware issues. So try different Arduino pins in case some are damaged. Post pics of the circuit and a schematic diagram (using Fritzing schematic view, not breadboard view, no need to show all 64 LEDs).

I switched to another Arduino, and I still don't get any response.

Attached schematic and a picture of the chip w/wires.

I'm waiting for 10 more 7219s from China, but this one's the only one I have for a few more days. :confused:

Could you not get that photograph angle any better, just a small move and you could obscure a lot more wiring than you have.


Yeah, it's impossible to trace your wiring in that pic. But it does look a bit of a jumbled mess, I'm not surprised that the circuit does not work. Get more breadboards, clip them together and neaten-up your wiring. Try to keep wires flat on the breadboard and straight. Like I mostly did here:

Of course I wish I had more breadboards and better skill at wiring up a generic led matrix, but well, it's what I have. I'll wait for the new maxes and see if this one is broken. Soz for not being ace at this and delivering perfect material. Would probably not need the help if I was already good at it...

for not being ace at this and delivering perfect material. Would probably not need the help if I was already good at it..

Being able to take a decent photograph of what you have is not a transferable skill with wiring up. My wife could take a photo but have no chance of wiring up a matrix.

I am not sure what sort of help anyone could offer if you hide most of the facts from them. We can't read minds you know.

Don't worry about it, just aim to get better. Like all this stuff, using breadboards is a skill that you're not born with, you have to learn it. I learned at University. Before that, my breadboards probably looked like yours. It was not something that was taught in lectures, I picked it up working in the lab, from other students and post-grad teaching assistants.

Mike does not like breadboards, but I'm sure he'll be pleased to reflect that I would have learned this while I studied at Manchester, in the late '80s.

but I'm sure he'll be pleased to reflect that I would have learned this while I studied at Manchester, in the late '80s.

Not off me I hope :fearful: :slight_smile: