Shift Register Power Problem

So I'm making a 16 x 6 LED matrix and I'm having a couple issues with the registers. When I originally built the matrix I planned to use a current sink driver so I made it correspondingly. Now I'm using regular registers so its reversed. To deal with this I just switched things around in the code. What I mean is instead of writing B00000000 and B00000000 to turn everything off I use B11111111 and B11111111. For testing purposes I'm just using the first row of LEDs so I'm not getting into the more tricky coding of multiplexing with registers. So far there are 3 problems.

First of all I'm having power problems, what I mean by that is that when I have a few LEDs on they are all pretty bright but the more I turn on the dimmer it is. I'm not sure how to get around this other than using 16 small transistors (one for each column) but that seems a bit much. Luckily I started off on a breadboard so its still pretty easy to change things.

Second when I turn on all of the LED's (write B00000000 and B00000000) none turn on, but if I turn all but 1 on it works (write B00000000 and B00000001) my only idea on this one is that its some sort of feature of the registers as in when all of the LEDs are supposed to be off it automatically just goes to high impedance or something which is a problem for my setup. If that is the problem then maybe using transistors for each column would be good because I could run it as a flip flop so that the code would be normal again.

Thirdly the 8th output pin on my first register doesn't seem to work like it should. I think this might be the ic itself or just some problem with the temporary circuit I made but I don't see a problem. Its weird though because its not like it never works because it sort of flashes really fast every time it gets rewritten to. To my surprise when i was just messing with the code and wrote a program that just went through each LED one at a time and ran it so that it only turned on each one for 1 ms (making a multiplexing type always on effect) it was just as bright as all of the others. Thats what leads me to suspect the actual IC but I don't know.

Any input would be helpful! Thanks in advance

Alright its the exact circuit that is in the shift register tutorial, with the same 595 register. The only difference is that I have both of the OEs going directly to PWM pin 10 so that in the future I can attempt to control brightness, but for testing purposes I just pull it low. The resistors I’m using are 150 ohm. The cathode of the LEDs go to the shift register output pins. I have 6 rows but for now I’m only using 1 of them just to get it up and running. The ceramic capacitor I used had a 103 on it. I think thats it on the hardware side. The arduino is a duemilanove but thats not too relevant.

The code is pretty simple just testing type of stuff. I’ll include a few things I was using.

//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;

const int outputEnable = 10;

char inputString[2];

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  pinMode(outputEnable, OUTPUT);
  Serial.begin(9600);
  Serial.println("reset");
}

void loop() {
  digitalWrite(outputEnable,LOW);
  
  for (int i = 0; i < 16; i++){
   unsigned int bitsToSend = 65535;
   bitWrite(bitsToSend,15-i,0);

    
  byte registerOne = highByte(bitsToSend);
  byte registerTwo = lowByte(bitsToSend);*/
  
  digitalWrite(latchPin, LOW);
  // shift the bytes out:
  shiftOut(dataPin, clockPin, LSBFIRST, registerTwo);
  shiftOut(dataPin, clockPin, LSBFIRST, registerOne);
  digitalWrite(latchPin, HIGH);
  delayMicroseconds(100);
  }
 }

This one worked with all of the LEDs strangely. Even the one that wasn’t working with the other code. Of course they were all pretty dim considering that it was at a bit less than a 16th of a duty cycle.

//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;

const int outputEnable = 10;

char inputString[2];

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  pinMode(outputEnable, OUTPUT);
  Serial.begin(9600);
  Serial.println("reset");
}

void loop() {
  digitalWrite(outputEnable,LOW);
  
  byte registerOne = B00000000;
  byte registerTwo = B11111111;
  
  digitalWrite(latchPin, LOW);
  // shift the bytes out:
  shiftOut(dataPin, clockPin, LSBFIRST, registerTwo);
  shiftOut(dataPin, clockPin, LSBFIRST, registerOne);
  digitalWrite(latchPin, HIGH);
  
}

This one I was just testing everything by manually entering which ones I wanted on. It is the one that had the problems with when all of the LEDs should have been on none were and the 8th LED on the first register not working

Let me know if you need anything else

I'm not sure how to get around this other than using 16 small transistors (one for each column) but that seems a bit much

But you need that or some other form of driver if you are going to have more than one LED on at any one time. Even with multiplexing you need something to source or sink current.

It is fine describing the circuit but it dons't help much in visualising it, rather like dancing about architecture. Can you draw it, pencil and paper then photograph it will be fine.

I just started to draw the schematic and when I was checking where the power was being supplied from I found the problem in about 5 seconds weirdly enough. When I put the wire into the breadboard there was a bunch of the wires in the way so I had to do it from a few inches above the board and it turns out I missed the hole I intended and used the wrong row. So it was just pulling power through the IC somehow. Im sure if I looked at the internal schematic I could see exactly where its coming from but no need. I plugged it in the right spot and now it works perfectly with all of the problems resolved. Now I just need to wire up the last 5 rows and get coding. Thanks for the help anyways though, that was the reason I looked at that part of the circuit

Well it helped for sure. I've got a couple sample programs done already. Now I just need to finish the circuit and code it all, which is the most fun I think. I'll post a video on youtube when I'm done incase anyones interested. I love when a plan comes together

I have a much more basic question on shift registers: when controlling 8 LED (20mA each) with a 595 shift register do you need to use an external power source, or is the arduino power enough? I can't see how the arduino pins are going to give that much current, and yet when I look at the tutorial I see no external power source: http://www.arduino.cc/en/Tutorial/ShiftOut

thanks

The 595 is connected to the +5V line, that provides the power not the arduino's pins. This line is good for about 500mA if powered from the USB and a touch more if powered via the jack barrel socket.

Excellent Grumpy_Mike - thanks for the clarification!

Oh cool I was wondering how you would control a much larger matrix and I guess you would just hook up a 5+ higher amperage source to the register and then tie the grounds of the power source and arduino together. Some day I'm going to have to try that approach and see how big I can make it before having speed issues

For anyone who is interested I just posted a quick video on youtube. Heres the link

http://www.youtube.com/user/kctess5?feature=mhee