Troubleshooting 74hc595

I am using three SMD 74hc595 shift registers on a circuit board I etched myself. I did a test SMD board to be sure I could manage soldering them and that board works perfectly fine but I am getting strange behavior from the actual project I’m working on and I’ve run out of ideas for troubleshooting. I have verified that none of the pins are bridged with solder and that all of the appropriate pins are connected to their arduino outputs. Also that all of the pins are actually connected to the traces. I can communicate to the atmega328 through serial and read pots and buttons just fine. Just to be safe I have connected the shift register board directly to my arduino so it has to be something on that board (a ribbon cable connects the atmega board to this one). All of the 5v pins are receiving 5v and all of the ground pins are grounded. I set the clock, data and latch pins high individually and verified that the 5v makes it all the way to the corresponding pins.

I am using this program:

//Pin connected to ST_CP of 74HC595
int latchPin = 12;
//Pin connected to SH_CP of 74HC595
int clockPin = 13;
////Pin connected to DS of 74HC595
int dataPin = 11;
void setup(){
   pinMode(latchPin, OUTPUT);

void loop(){
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
  digitalWrite(latchPin, HIGH);


It simply turns the latch on and off. Each time it does this shift out too because depending on what I do it does not seem to “take” the entire shift and only some go high.

When everything is hooked up right they all go high and stay high. The latch never goes low unless I poke and prod the board, it will randomly change. No where on the board in particular causes it though. If I disconnect the 5v and GND from the 595’s(the LEDs are powered separately) the latch DOES go high and low like it should, but the LEDs light up randomly, the entire shift isn’t being read or something. And of course the LEDs are much dimmer.

I forgot to put .1uF caps on each of the 595s. However this has not ever caused me any problems before. Just to be safe I put two .1uF caps as close as I could on the back side of the board and opposite ends. I also tried holding a 10uF cap to the traces. Neither of these changed anything.

I know it’s pretty much impossible to know what could be wrong based off of this post, but I’m just hoping I can get some good troubleshooting tips to figure out what the issue is.


Those decoupling capacitors are never optional with fast logic chips, and should always be as close to the chips as possible - however I think what you have is OK.

Perhaps the ribbon cable is too long - 6 inches would be the limit I would trust unless you run a ground wire between every pair of signal wires, in which case maybe a few feet if lucky. With those ribbon connectors its common practice to put signals on pins 1,3,5, etc, and ground all the even pins. There should be at the very least one ground pin in the ribbon or all bets are off.

If poking the board seems to trigger misfunction perhaps a dry solder joint? Worth resoldering any joint that doesn’t look shiny and perfect.

BTW the “latch” on a 595 is an edge triggered clock, you only need to pulse it after shifting all the bits - the code seems to be written as if its a transparent latch.

[edit - after reexamining your layout I suspect the problem is running the two clock lines along the ribbon with no ground in-between - you may be getting crosstalk between them and prematurely triggering the RCLK line. Hack solution might be to add 20pF or so on the RCLK (latch) line to ground to attentuate glitch spikes.]

I hadn't really considered that they would be so sensitive. Is there any way to test to see if this is the issue? I've tested an re-soldered everything so I don't think it's that, but there's a lot going on so I could be wrong. The cable that actually goes in the device is only an inch or two but it give me the same issues.

I'll try adding that cap soon.


I should also add that it does definitely react to poking and prodding. Not every time but if I squeeze around enough it will flip on or off whereas if I don't do anything it just sits there doing nothing for quite some time. Also, when I remove the ground and 5v from the ICs they seem to act very different, like I said before. Could that say anything about the likelihood of crosstalk?

I'm really hoping that I will not have to redo this board again, or even worse, both of them.

Looks like a lot of cold solder, places where you didn't get good flow, icicles, blobs, and that like. With bare copper traces, such as you have, board cleanliness is important. They should get shined up good before you start (as in "immediately prior"). So, flux it up!

From the documentation of shiftOut:

"The dataPin and clockPin must already be configured as outputs by a call to pinMode().".

I don't see that in your code, and that is enough to prevent your system working as intended.

[quote author=Runaway Pancake link=topic=117198.msg881976#msg881976 date=1344084267] Looks like a lot of cold solder, places where you didn't get good flow, icicles, blobs, and that like. With bare copper traces, such as you have, board cleanliness is important. They should get shined up good before you start (as in "immediately prior"). So, flux it up!


If the ribbon cable's very short then I'd agree that a dry-solder joint it the likely cause. But remember logic signal runs are best limited to the size of a PCB and with accompanying ground wire or plane. Best preparation I've found before soldering a board is good scrub with steel wool to get rid of the oxide film (you need to do this on the same day really). Carefully wipe away all remnants of the wire wool with an old cloth.

It is considered in the Engineering business bad practice to assume anything including code... That having been said... again and again. Local pull-ups and local pull downs solve many mysterious problems and while I agree in theory with the comment about interleaving ground and signal lines. "Cross-Talk" CAN be HELD to A Minimum by the proper choice of technique and actual practice. Obviously a 1M ohm resistor is a "Token" terminator... However since any digital output can easily supply 1/2 of the Max rated current/pin (Ipin)... A good value for a "Token" terminator. Might well be ??? 20% ??? of that Max Current (Ipin). So MAX Ipin = 40 mA /2 = 20 mA X .2 (20%) = 4 Ma and assuming (For a WORST CASE) Vcc is = 4V ( for those who Still want to use 9V batts for an 8X8 Led Cube ) Therefore since R = E/I Rterminator = 1K ohms and in so doing we have 90% of the Available Max Ipin available for a "Rainy Day"... In My Direct Experience. Further the place where the Rterminator belongs is at the End of the Wire... and NOT the Driven End. IMNSHO (It has worked well for me for well over 40 years)


In this project of mine

there’s an Arduino Nano pushing data, clock and latch over a cable about 12 inches long to a “vectorboard” stuffed with daisy-chained 595’s and as many 2803’s updating a display board.
[All I did was connect everything right.]

Truly Cool DISPLAY… Terminated Properly there’s no reason why the cable couldn’t be 1 meter instead of 30cm. IMO… Of Course…