Controlling 22 Shift Registers with Arduino - Gone Wrong

Hi Everyone!

I hope you're doing well.

I have a project in which I am trying to control 121 LEDs with Arduino. The LEDs are arranged in a 11x11 setup (11 rows and 11 columns). Each row (consisting of 11 LEDs) is controlled by 2 Shift Registers of type 74HC595. The first shift register of each row controls 6 LEDs and the other one controls the remaining 5.

The 22 Shift Registers are all daisy chained, meaning the output (Qh') of the first shift register is connected to the SER pin of the second one. Similarly, the output (Qh') of the second shift register is connected to the SER pin of the third shift register. And so on... (Please find attached the PCB layout of my project, both top and bottom layers :slight_smile: )

Concerning the Arduino Code, I am using the "MultiShiftRegister" library that can be found on GitHub to control my LEDs.

The problem is the following: I am able to successfully control the LEDs connected to the very first shift register. But then, when I want to control any of the LEDs connected to the second shift register (or any other one really) things get weird and I get some random LEDs lighting up (Some in the 3rd row sometimes).

Here's my (simple?) Arduino code:


#include <MultiShiftRegister.h>

//Pin connected to ST_CP of 74HC595 (RCLK)
int latchPin = 8;
//Pin connected to SH_CP of 74HC595 (SRCLK)
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;


// How many 8 bit shift registers we're talking to.
// Two 8 bit registers can host 16 individually
// addressable binary outputs.
int numberOfRegisters = 22;

MultiShiftRegister msr (numberOfRegisters , latchPin, clockPin, dataPin); 

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

void loop() {
  // Prepare to turn on pin 5.
  // Pin 6 is still low/off.
  msr.set(6);

  // Shift data out, with appropriate latches.
  // Pin 6 is now high/on.
  msr.shift();

  delay(1000);

  // Turn pin 6 back off.
  msr.clear(6);
  msr.shift();

  delay(1000);
}

PCB_PCB_FYP_Control_Layout_6_2023-07-09.pdf (813.0 KB)
PCB_PCB_FYP_Control_Layout_6_2023-07-09 (2).pdf (695.7 KB)

Can you please help me in figuring out the problem?

Your help is much appreciated! Thank you!!

This does not match your PCB.

Your wiring may be wrong, in addition to above problem.

Hi DrDiettrich,

Thank you so much for your answer.

My rows are in series (I suppose, since all my shift registers are daisy chained).

I am already using transistors to fix the voltage issue, thanks for pointing it out :slight_smile: .

As for the wiring, can you please give a quick look at the PCB layouts attached to the question?

Thank you so much again!

Very pretty. But please post the schematic.

Hi Paul,

Thank you for your answer.

Here's the schematic :slight_smile:

Hope it can help,
Thanks!

Schematic_FYP_Control_Layout_2023-07-09.pdf (628.2 KB)

A circuit diagram were nice, for one shift register. I guess that you missed capacitors and power the LEDs and registers from the same lane?

Yes, the NPN transistors and all of the 22 Shift Registers are powered from the same 6V DC source.

Hi,
@kwh05 PCB patterns.


Tom... :smiley: :+1: :coffee: :australia:

Separate the LED and logic power lines and add enough stabilizing capacitors.

A scope were helpful in spotting problems.

No bypass caps. They are not optional. Use 0.1uF ceramic, close to the Vcc & ground pins of each chip.

No current limiting resistors for the LEDs.

No resistor values shown on the schematic.

No part numbers for the transistors shown.

Fan-out to 22 inputs for the clock & latch lines may be too much, you may need some buffers.

But the thing that most surprised me: this isn't how you wire a matrix. For that you might only need 4 shift registers, 22 NPN transistors and 11 PNP transistors.

1 Like

do you mean the 4 shift registers ?

why shift registers at all? if there are only 121 LEDs (which ones?) - one HT16K33 could drive all plus 7 more...

hi man, did you solved the issue? I'm also PhD student, who works in RIS.

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