Noise on SRCLK wire with 74HC595N

Hi, I use 4x 74HC595N shift registers with seeduino xiao for a small lamp with 24 leds (every 74HC595N drives 6 LED). I use OE pin of 74HC595N with seeduino PWM to fade LEDS. All is powered with 6xAA and 5V stabilizer. The problem is, all works if I touch the SRCLK wire from shift register with a finger (some noises??). I try to connect capacitor 0,1uF to this wire, but it doesn't works.
Could you help?

To get help, you need to post your code and a schematic of the wiring of your project.

Doesn't work if you don't touch the wire?
What happens if you don't touch the wire?

To post code click the <CODE/> button

Have you connected 0.1uF ceramic bypass caps for each shift register? If not, do that first. They should be connected closer to each chip from Vcc to ground.

I'll try to draw a circuit and paste it here. Code is max simple.

#define LED1 7
#define LED2 8

int brightness1 = 0;
int brightness2 = 255;
int fadeAmount1 = 2;
int fadeAmount2 = -2;


void setup() {

  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
}

void loop() {
  analogWrite(LED1, brightness1);
  analogWrite(LED2, brightness2);

  brightness1 = brightness1 + fadeAmount1;
  brightness2 = brightness2 + fadeAmount2;

  if (brightness1 == 0 || brightness1 == 255) {
    fadeAmount1 = -fadeAmount1;
  }

  if (brightness2 == 0 || brightness2 == 255) {
    fadeAmount2 = -fadeAmount2;
  }
  
  delay(30);
}

I work with one shift register right now. Other are disconnected.
I tried to connect 0.1uf cap with pins 10 (SRCLR is like pin 16 – VCC) and 8 – GND.
That didn't work (no changes – still have to touch) so I tried to connect pin 11 (SRCLK) where is the noise with GND – also not good. In this option that doesn't work at all.

Nice SN74HC595 Pinout Picture

This is how I wanted to connect it. The difference is, the OE at mine is another arduino/seeduino pin with PWM to fade the LEDs.

and about ?

This code never work with 74HC595.

This code simply adjusts the brightness of 2 LEDs.

It doesn't work at the start. If I touch the SRCLK wire for a moment, it start to fading (from 100% ON – 255 to OFF – 0). It not fade back to 255. Just immediatly go to 255 (full light). If I touch the wire again, it starts to blink randomly.

The code is ok. This is because I don't need to change anything with clock or other wires. The only wire/pin I use is OE to fade all LEDs.

We need to see your actual schematic and wiring, not a picture of "how I wanted to connect it".

Even using that picture, you have only set pins 7 and 8 as outputs, any other pin is still in input mode and floating, so when you touch the clock wire you are shifting random data into the shift register.

Why are you even using a shift register, when you are not going to output any data to it????

Guys, you made my day!
It was all about output/input mode for data transfer pins.
I wrote better code and it works like a charm:

#define LED1 7

int latchPin = 5;
int clockPin = 6;
int dataPin = 4;

int brightness1 = 0;
int fadeAmount1 = 5;

byte leds = 0;

void setup() 
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  pinMode(LED1, OUTPUT);

  for (int i = 0; i < 8; i++)
  {
    bitSet(leds, i);
    updateShiftRegister();
  }
}

void loop() 
{
  analogWrite(LED1, brightness1);

  brightness1 = brightness1 + fadeAmount1;

  if (brightness1 == 0 || brightness1 == 255) {
    fadeAmount1 = -fadeAmount1;
  }

  delay(30);
}

void updateShiftRegister()
{
   digitalWrite(latchPin, LOW);
   shiftOut(dataPin, clockPin, LSBFIRST, leds);
   digitalWrite(latchPin, HIGH);
}

The question is, why previous code works when I tested it on breadboard?! It shouldn't.
Thanks for your hints!

David, I will use shift and send data. I am not using it just right now, for a test.
I want to light up all LEDs, and fade them in groups or one by one like a stars.

Not what I said. Bypass caps go from Vcc to Gnd (pins 16 & 8 on 74hc595) and should be as close to the chip as you can get them.

How much current are you drawing from the 595's output pins? Sounds like a job for tpic6B595 power shift register.

https://www.ti.com/lit/ds/symlink/tpic6b595.pdf

A 74HC595 powered from 5volt will never work reliably on a 3.3volt-logic Seeeduino xiao.
It needs at least 3.5volt-HIGH when powered from 5volt power.
The TPIC is worse, at 4.25volt.
You need some luck for it to work. Or level shifters.
Leo..

I have connected serial data pins from seeduino to shift register and it works. I don't know if it will work stable in future or it will damage microcontroller, but maybe I should use level logic converter?

SRCLR is the asynchronous "clear all outputs" signal, right?
For normal operation, shouldn't it be pulled high? (Tied to Vcc, usually.)
"real" TTL logic floats high by default, but I think you need to pull it up explicitly for HC CMOS.

Yes, SRCLR is usually connected with VCC as I know and I have.
I hade a problem with SRCLK, but changes in code made it work.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.