trouble with more than 2 of 74HC595

I've been working my way up (breadboarding and coding - newbie) for sometime with respect to using 74HC595s. One, with 8 LED's, are working fine. Two 595's seem to work. I've got issues with 3 and 4 ICs. Just can't get them to work. Attached is the schematic I made. "Sorry, first go at Fritzing."

The code is short. I just want to shift in enough data to change a few of the LEDs.

const int SER   =12;
const int LATCH =9;
const int CLK   =11;

void setup() {
  // Set pinmodes as outputs
  
  pinMode (SER, OUTPUT);
  pinMode (LATCH, OUTPUT);
  pinMode (CLK, OUTPUT);



digitalWrite(LATCH, LOW);
    shiftOut(SER, CLK, MSBFIRST, B10101010);
    shiftOut(SER, CLK, MSBFIRST, B00001111);
    shiftOut(SER, CLK, MSBFIRST, B11110000); 
    shiftOut(SER, CLK, MSBFIRST, B00111000);
    digitalWrite(LATCH, HIGH);
delay(1000);


}

void loop() 
{



  }/code]




Any help would be great.

Best,


Tony


No bypass caps. Add 0.1uF accross the 5V & GND pins of each chip, as close as you reasonably can.

Next, increase the series resistors. Red LEDs can have a forward voltage of as little as 1.8V, so with 220R resistors, each pin could be sinking almost 15mA, or 120mA per chip. 74hc595 is rated for a max of 70mA.

Hang on, you seem to have all the Q7' outputs connected together, which could certainly damage the chips. And the data input pins of most of the chips are not connected.

You said you had it working with 2 chips. Are you sure they really worked? Did you draw that schematic wrong? There's no way even 2 chips would have worked if connected like that.

Well I think i got it. It took some time, two weeks of assembling, analyzing, and disassembling. I think I now have 4 74HC595 ICs working. See photo below. May help someone. Now onto the code. I'd like to send out a digit (1) o a certain location and I have no idea where to start. The idea being that I want to trip solenoids one at a time, in a certain pattern. Once the pin has been set high on the first solenoid, I'd like to trip, then I need to make sure the rest of the digitis shifted in are zeros.

Below is my code, or something that used to look like what someone already posted before I butchered it.

const int SER   =11;
const int LATCH =9;
const int CLK   =12;

void setup() {
  // Set pinmodes as outputs
  
  pinMode (SER, OUTPUT);
  pinMode (LATCH, OUTPUT);
  pinMode (CLK, OUTPUT);
 
    digitalWrite(LATCH, HIGH);

    digitalWrite(LATCH, LOW);
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      shiftOut(SER, CLK, MSBFIRST, B11111111);     
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      digitalWrite(LATCH, HIGH);
    
      delay(250);


  digitalWrite(LATCH, LOW);
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    shiftOut(SER, CLK, MSBFIRST, B00000000);     
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    digitalWrite(LATCH, HIGH);
    
    delay(250);




    digitalWrite(LATCH, LOW);
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      shiftOut(SER, CLK, MSBFIRST, B11111111);     
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      digitalWrite(LATCH, HIGH);
    
      delay(250);




  digitalWrite(LATCH, LOW);
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    shiftOut(SER, CLK, MSBFIRST, B00000000);     
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    digitalWrite(LATCH, HIGH);
    
    delay(250);


    digitalWrite(LATCH, LOW);
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      shiftOut(SER, CLK, MSBFIRST, B11111111);     
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      shiftOut(SER, CLK, MSBFIRST, B11111111);
      digitalWrite(LATCH, HIGH);
    
      delay(250);


  digitalWrite(LATCH, LOW);
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    shiftOut(SER, CLK, MSBFIRST, B00000000);     
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    shiftOut(SER, CLK, MSBFIRST, B00000000);
    digitalWrite(LATCH, HIGH);
    
    delay(250);
  
}

void loop() 
{



  }

The above is more of a proof of concept. Getting in data to the shift registers.

This took so long to accomplish. What a tedious business this electronics business!

Best,

Tony

Well I think i got it.

I don't think you have, Tony. Try making just 1 led light up. You won't be able to because your wiring is still wrong. You are not chaining the shift registers. To do that, you need to connect LATCH and CLK in parallel to all shift registers, as you have done. But not SER, that's different. You've connected it in parallel to all shift registers, just like you did for LATCH & CLK. The result will be that all shift registers receive the same data, so if you try to set just one led lit, you will get 4. To fix this, connect SER from the Uno to the first shift register only. Connect SER of the second register to Q7' of the first register, SER on the third register to Q7' on the second and so on.

This is what I have now. I think it's working.

This took me two or three weeks. The coding will bring me to tears.


tperry724:
This took me two or three weeks. The coding will bring me to tears.

Baby steps.

Run the sketch below to see what it does (open the serial monitor). Incorporate the code into your own sketch and substitute count for one of the Bxx values you're using to drive the SRs - in each section where it appears, all the first ones, all the last ones, whatever. You should see the corresponding LED group putting out a binary representation of count.

//  simple count display

byte count;

void setup() {
  Serial.begin(115200);
}

void loop() {

  delay(2000);
  Serial.println(count);
  count++;
}

Don't fall in love with delay(), more useful projects require the use of millis() for timing.

Karma++ for perseverance.

tperry724:
I think it's working.

The problem with the code you posted in post #4 is that it sends the same data to all 4 shift registers, so it won't reveal the wiring mistake I have pointed out. Go back to the code you posted in the original post. That sends a different pattern to each register. If I'm right, you will see the same pattern on all 4 registers.

Paul RB,

The wiring changed worked. The connections you mentioned now allow each bank of LED's to show the same pattern. I'd take a pic, resize and attach but it's a pain in the butt with this forum.

Thanks,

Tony

One more question. I can't get the TCIP6C595s to work at all. Nothing. Not a blink from the LEDs. I'll post the schematic. I've only got one chip and 8 LEDs. Keeping it small for now.

This is the schematic I'm using for the TPIC6C595 as a one IC breadboard test. The sucker just won't work.

Try connecting the anodes of the LEDs to Vcc and cathodes to the 595.


Try Doug's suggestion. The reason is that, unlike 74hc595, the tpic chip's outputs can only sink current. Sinking is where current flows from +V through the "load" (in this case LEDs + series resistors) into the pin of the chip to reach ground. Sourcing current is where current flows from +V through the chip, out from its pins and through the load to ground. Sinking may sound perverse to a beginner, but in electronics, either is equally normal. In fact, for larger currents and voltages, sinking is far more common than sourcing.

It worked! Thanks all.

Hang on a moment, I've got 24 more to get lit.

We are getting lit LEDs, now. Thank goodness.

I'm working on a breadboard version with additional chips.

Very humbling hobby.

Thanks!

tperry724:
Very humbling hobby.

tperry724:
I've been working my way up (breadboarding and coding - newbie) for sometime with respect to using 74HC595s. One, with 8 LED's, are working fine. Two 595's seem to work.

As in many things, attention to detail.

tpic6c595.pdf datasheet.

:slight_smile:


So, why the switch to tpic chips?

tperry724:
I've got 24 more to get lit.

You might run into a problem with that many chips. The CLK and LATCH signals from the Arduino will have to connect to many inputs. All those inputs, and all that wire, can degrade the signals to the point where the chips further down the line might stop working. It might not happen, but if it does, the solution is simple. A buffer chip can be used to "boost" the CLK & LATCH signals, cleaning up the signals for the more remote chips, and taking some of the load from the Arduino pins. Many basic 7400 series chips can be used for this, even 74hc00, although because 74hc00's outputs are inverted, pairs of gates in series would need to be used to prevent inverting the signals.

Crossroads, suggested the TPIC6C595 chips. I think. So I went with them. I can go back to the 74HC595s, it does not matter to me. The overall outcome of the project matters. What are your thoughts? I realize there might not be a right or wrong answer. All they have to power is a logic level, 5V, relay - which they have done in some experiments. And, only one pin needs to go high each day for 10-20 milliseconds - just enough time to have the latch open. I respect everyone's opinion and knowledge. It's just some folks are coming at this challenge from differing directions. If there is one thing I've learned about electronics, most hobbyists like me spend a decent portion of eternity part swapping.

What did you mean by "logic level, 5V, relay"? If you mean relay modules sold for use with Arduino, these contain driver transistors. 74hc595 would be fine to control these, tpic chips would be unnecessary. Crossroads would know this, so I think he must have assumed you were going to drive bare relays, in which case the tpic chips would be needed.

go high for 10-20 milliseconds

Many relays will not trigger if the signal goes high for such a short time. Relays are mechanical and slow.

Why did you start this new thread instead of continuing in your other one? I had mentioned there the need to connect the LED anodes to +5, the LEDs being flipped on the right hand side of your chips.

I hope this schematic make the the connections clearer.

Connect the output of the shift register to the relay card inputs. A low turns on the LED in the optoisolator input to energize the relay.