74HC595, an interesting problem

Hello,

To make it quick, I designed a PCB with 4 74hc595s daisy chained. I made an other one with 3 and works vanilla. PCB got optoisolators, and 595 outputs are buffered with ulns. Got several big caps and little ones as close as possible. And 7805 regulator is used.

The thing is, I use 4 lines os shiftOut to run all ics. However, the problem is whenever I set a pin, the pin before also act. How?

set pin 5 and pin 4 is high with 5, set pin 4 and pin 3 is high with 4. goes on.

What on earth does make this? Older pcb got closer "opto to port" lines, and new one a bit longer. Other thing, arduino has a resistor to run opto, and opto uses two resistor, one for pulldown and other to port on each output (data, clock and latch pins flow thru optos)

Schematic and sketch please!

SoftwareSerial blutut(8, 9);

char den = 0;
byte led = 255;
byte role = 0;
byte led2 = 0;
byte izole = 0;
char select = 0;
byte i = 0;

void setup()
{
  blutut.begin(38400);
  pinMode(latchPin, HIGH);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  digitalWrite(clockPin, LOW);
  
  digitalWrite(latchPin, LOW);
  //shiftOut(dataPin, clockPin, MSBFIRST, role);
  //shiftOut(dataPin, clockPin, MSBFIRST, izole);
  //shiftOut(dataPin, clockPin, MSBFIRST, led);
  //shiftOut(dataPin, clockPin, MSBFIRST, led2);
  shiftOut(dataPin, clockPin, LSBFIRST, 0);
  shiftOut(dataPin, clockPin, LSBFIRST, 0);
  shiftOut(dataPin, clockPin, LSBFIRST, 0);
  shiftOut(dataPin, clockPin, LSBFIRST, 16);
  digitalWrite(latchPin, HIGH);
}

bu.PNG

A schematic is easier to read than a pcb layout ;)

Possibly not the cause of your problem but why do you have two pinMode statements for the latch pin? Maybe the first one should be a digitalWrite?

Schematic is trashy, I didnt care when wiring. I wired them up as fast as possible to implement in pcb design. Even I cannot read where the pins are. It was a typo I guess. Changed it to digitalWrite and still problem occurs

https://www.arduino.cc/en/uploads/Tutorial/ShftOut_Schm2.gif

I used this diagram

OP's schermatic

|392x500

the thing is, when I short optos and connect arduino directly, it works. However, I'm not sure if this is safe. What I'm trying to say is, it works, yes, but whenever I disconnect pcb power, leds still run with lower brightness. Also if I don't misheard, relays are still working. Won't this cause my arduino to fry? At the latest build, I will control over 30 relays and 60 leds with seperated 4 pcbs, each has 3~6 shift registers. This leakage current (only latch pin is HIGH, others LOW) may damage everything, am I wrong? I really wish I'm wrong btw.

Maybe I selected the wrong resistors for optos, but I tried different values and no luck (10k to 330). What you may offer, suggest?

sterretje: OP's schermatic

|392x500

I REALLY don't hope OP put the 1uF capacitor on the ST_CP-line - it's wrong in every single way, and i have been baching the Arduino-people like forever to get that picture changed, but no one wants to change it. Shitty :/

// Per.

I removed the cap at latch line but still got the error. I removed the optoisolators and put 330ohm serial resistors and 10k pulldowns for all three lines.
Now when I don’t power up the ics, latch pin feeds around 10mA leakage to circuit. When fired up, lowers to 5mA. Without the serial resistor I read 50 to 70mA btw.