Two Serialized TPIC6B595 Shift Registers behaving oddly with PWM

I have two TPIC6B595 Shift Register serialized and the output from the second register is behaving oddly when I'm trying to adjust the intensity of the output through the G pin. When I have only 1 shift register, everything works fine. When I have two and don't adjust the intensity, everything also works alright. But when I have two shift registers serialized and try adjusting the intensity of the output, then the second shift register just "blinks" for a few ms (as shown in the video). Is there something wrong with my code or wiring? I can't find the problem.

// Pin to clear the register
const int clearPin = 7;
// Pin connected to latch pin (RCK) of TPIC6B595
const int latchPin = 8;
// Pin connected to clock pin (SRCK) of TPIC6B595
const int clockPin = 6;
// Pin connected to Data in (SER IN) of TPIC6B595
const int dataPin = 9;
// Pin connected to G in of TPIC6B595
const int GPin = 11; 

const byte lightsUp = B11111111;

const byte lightsDown = B00000000;

void setup() {
  pinMode(clearPin, OUTPUT);
  pinMode(latchPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(GPin, OUTPUT);
  digitalWrite( clearPin, HIGH);
}



void loop() {
      analogWrite(GPin, 10);
      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, MSBFIRST, lightsUp);
      digitalWrite(latchPin, HIGH);
      delay(2000);
      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, MSBFIRST, lightsDown);
      digitalWrite(latchPin, HIGH);
      delay(2000);
}

Hi,
Can we please have a circuit diagram?
An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.

Cut and paste and crossed coloured wires make reading a circuit diagram very hard.

Drawing by hand, or CAD, will let you spread out your components and label them and their pins.

You only need to show two or three of your LED circuits and the rest can be taken as being in circuit.

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

Hi Tom,

I tried my best to draw a diagram. However, I've never drawn such a diagram before so sorry if it's confusing. :smiley:

Cheers,
Martin

Thanks mate, that will do nicely. :+1:
Lets us see the control wiring a lot clearer.

Have you got 0.1uF bypass capacitors across the power supply pins of each of the 595's?
Place them as close as possible to each 595, it helps to filter out switching glitches that may appear on the power supply.

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

Can be in setup() (last line) if you don't change it in loop().

Plan seems ok.
What is the actual LED current.
Show use a picture of the actual setup.
Leo..

I added capacitors just in front of the G input but it had no impact, unfortunately. If I have the analog input from pin 11 connected to the G pin on the second shift register, it just blinks, instead of changing the intensity. If I don't have it connected, it lights up the LED for the desired time. I can't change the intensity of the light, however. On the first shift register, with the same wiring, everything works fine.

I actually would like to be able to change it in the loop later.

The power supply for the LEDs is 12v 5A

Sure, here it is! Sorry for not having the cables organized by the color :sweat_smile:


The input for G, SRCLR, SRCK, and RCK are connected and lead to the same pin for both shift registers. SER OUT of the first shift register leads to the SER IN of the second register. All GND pins are connected to the GND of Arduino, VCC to 5v. The odd behavior is happening only with the second shift register. The first one is behaving correctly. Also, not having the resistors connected for the second shift register doesn't change much. I don't have them to be able even to see the blink. I tried it both with and without them - it makes no difference in the behavior.

But that is not where Tom told you to add them.
Also they have to be ceramic capacitors for this decoupling to work.

You're correct! I'm sorry, it's my first project and I'm still quite lost. :sweat_smile: If I add these capacitors in front of the VCC pin of the shift registers, then it won't work at all. I believe that I use the correct capacitor. But please correct me, if I'm wrong.

That's pretty clear. In my opinion, your prototype has a very low chance of working because mistakes are inevitable, and spotting mistakes is nearly impossible if you build your prototype like this. Your circuit looks like a bird's nest or spaghetti.

I would recommend:

  1. Using a breadboard compatible Arduino like classic Nano, and plug it into the breadboard.
  2. Avoid using Dupont wires unless you have no other choice because you need to connect a component that is not breadboard compatible. Dupont wires are fragile and unreliable.
  3. Use solid core wire to connect components on your breadboard. Cut the wire to the correct length and lay it flat on the breadboard.
  4. Be consistent with the colours of the wires you use. Black for ground, always, and for no other purpose. Red for 5V, always, and for no other purpose. Other colours as you choose but be consistent and logical with their use. For example orange for 12V, blue for the data signal, etc.
  5. Use the bus-bars along the long edges of the breadboards as much as possible, and always use the bar with the black line for ground. In your case, you can use one red bus bar for 5V and another for 12V.

Here's an example of how I like to build prototype circuits on breadboard, to give you an idea:

1 Like

Yes because that is not where you were told to put them.

Put one end to the supply voltage of the chip. Put the other end to the ground connection of the chip.

If you want to know the why of it then have a read of this, although you might not be able to understand it all yet, until you know a bit more.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

1 Like

Sorry for my rookie questions and thank you for the article! I read that through and I see where the problem was! Nevertheless, now when I connected the capacitor correctly, it works as expected!
Therefore the very first response from @TomGeorge was the solution to the problem already!

Good to hear it's working, despite my doubts it ever would!

Questions:

  1. Why do 8 of your LEDs have a series resistor but the other 8 do not?
  2. What are those grey plastic things between the Uno and the breadboard?
  3. Do you need help changing your code to update both shift registers together? You need to output 16 bits before making the latch pin HIGH. The binary notation you have been using, for example "B11111111" will only work with 8 bits. For 16 bits, use "0b1111111111111111". This notation is preferred because it works for 8, 16, 32 and even 64 bit binary numbers. Also have a look at the highByte() and lowByte() functions for splitting a 16 bit number into 2 chunks of 8 bits when you use shiftOut().
1 Like

Was it not post 4 from Tom that first talked of decoupling capacitors, not post #2?

1 Like

If those are COB/LED bulbs (as they look to be) - no series resistor is warranted.

1 Like
  1. With the resistors attached to the LEDs from the second register, it was impossible to see the blink (in other words, to see the incorrect behavior)
  2. Those are just these quick wire connectors
    image
  3. Thank you very much, but I'm fine. As a software engineer, this is actually the easy part for me. :smile: I'm fighting with the hardware part, as I have just basic knowledge and zero experience in this field. :sweat_smile:

I didn't ask what the supply was capable of.

So what is the current draw of those LEDs.
Note that the TPIC5B595 has a current limit of 150mA per LED whan all outputs are active.
The blinking could be from an overheating chip.
Leo..

Good point, Leo.
They look a lot like these --

or maybe these --

Both 2watt (167mA) and 3watt (250mA) bulbs are drawing more than the absolute max current a TIP6B595 can handle (with all outputs active).
The first TPIC has (unspecified) CL resistors, so should be ok.
Leo..

In the youtube it was blue LEDs and then the project changed to LED bulbs.