Should this shift register work?

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using this shift register (http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf) to turn on 8 triacs that are triggered with internal opto-isolated inputs.

It's all powered with 5VDC and I'm using 470ohm resistors to limit the current going through the input LEDs of the triacs. Ohm's law tells me that that results in about 10mA of current out of the shift register for each output.

The spec sheet for the shift register states that the "output diode current" and the "output source or sink current" is between 20mA and 35mA (not sure which applies here but they're both over my 10mA need).

What's odd is that when I shift 0xff into the shift register, the 5.00VDC comes out the output pins as 4.6VDC. This still turns the triac on just fine but I don't understand why that happens.

I have a test program that shifts 0xff into the shift register, waits five seconds, and then shifts 0x00 into the register and waits five more seconds and repeats. I'm also doing the clock pulses and strobe and so forth as needed (like I said, this works most of the time).

The triac turns on and off just fine but every 10 or so firings, it pulses on and off instead of staying on for the 5 seconds.

I thought it was a triac problem at first but I traced the problem to the shift register. With a scope, I was able to see that it's output line that I was using to drive the triac would, every now and then, go high as requested but then drop back down to 0V after 17mS instead of waiting five seconds before dropping back down.

If it helps, I've attached a pic of the pulse. You can see the compressed clock signals in red before the strobe pulse (not shown). The strobe then happens and the blue output goes high for 17ms and then comes back down. This happens about 10% of the time. The rest of the time, the blue stays up where I want it.

So, two odd behaviors:
1. 4.7V output out of the shift register.
2. Every now and then the shift register comes prematurely back to 0VDC causing a pulse.

Anyone have a clue why?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After re-reading the spec sheet, the 4.7V output seems to be ok since I see that a 6V power supply into it can yield a drop from 0.2V to 0.7V. That solves that mystery.

Just need to figure now why it sometimes drops.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Figured it out. I forgot to put a small cap next to the shift registers to filter the power supply to them. They were being starved during the turn on to all the LED's.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I thought I fixed the problem by putting a 47uF cap across the power pins of each of the two shift registers but I still get the problem. Guess it took a little longer to show the problem than usual. Grr.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I put the scope on the DC supply to the shift registers and I see there is no dip at any time.

Out of ideas.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OMG you need to see a doctor when you talk AND ANSWER to yourself. :)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Problem is I didn't answer it. It's still a mystery.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Continuing the diagnosis...

So I'm using the shift register to drive a triac that, in turn, drives a large AC-coil relay. For fun, I've connected a 60W light to the large relay so it turns on and off as the relay turns on and off.

Anyhow, that's when the trouble started. When I plug the source of AC for the light into the same power strip that is supplying AC to my DC power supply, I have the problem I've described in previous posts.

If I unplug the light cord from the wall so the relay isn't switching anything. No problems.

If I plug the light into an outlet far away (different circuit than the circuit feeding the DC power supply and the triac 120VAC) no problems.

So. This would seem to me to indicate that the light is starving something on the board. Trouble is, I can't find anywhere where the 5V supply is dipping during the trouble times.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 595's are fairly high speed devices, therefore it doesn't take much of a glitch to clock them. Can you tell us about the circuit layout? Is there flat cable involved? Do you have current limiting resistors on the outputs of the 595?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The circuit layout is pretty straightforward. Each output from the 595 goes directly into the LED that is part of the input side of the triac. The current then travels through the current limiting resistor (470ohms) and then to ground. That's it!

That covers the triac opto-isolated input side. The output side of the triac simply bridges 120VAC to a relay coil. The other side of the relay coil goes to neutral.

Right now I have four wires that connect the 595 control lines (clk, strobe, etc...) to another board that has my mega644 on it.

There's a 5VDC power supply that supplies 5V to the mega644 board and 5V to the 595 board.

I've scoped all 595 control pins during a problem time (when it pulses back down) and haven't seen ANY noise at all on the lines.

Please let me know if there are any more details you need. This all seems so cut and dry that I can't believe that this is happening.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try replacing the 47uF caps with 0.1uF ceramic caps. There is probably some very fast transients on the +5v power that the '595s will respond to, but that won't show up on a scope unless you look very carefully. 47uF capacitors are probably electrolytic caps that have way too much internal inductance to be useful with very fast transients.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

fizgig wrote:
It's all powered with 5VDC and I'm using 470ohm resistors to limit the current going through the input LEDs of the triacs. Ohm's law tells me that that results in about 10mA of current out of the shift register for each output.
Just started to read your odyssey ... the above is wrong because you have not accounted for the voltage drop across the led. If the Vled is say 1.8 volts, a current of (5-1.8)/470 = 6.8 mA would be closer to it.

Back to reading ...

Cheers,

Ross

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@valuesoft: good point!

@Chris-Mouse: Very interesting. Will try that out and report back.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Crap. I added a 0.1uF ceramic to each shift register (across the 5V and GND pins) but still get the problem.

To make sure I did it right I measured the capacitance across the pins directly and measured about 0.13uF for each so I soldered it right.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Added a huge electrolytic to the DC power supply output as well (2200uF). Still have the same problem.

The width of the pulse is always between 16 and 20ms.

Does that mean anything? Shouldn't any transient voltage brownouts be well before 16ms?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it always the same triac channel? Does Canada have 50 or 60 Hz mains supply? Your 16 milliseconds looks like 60 Hz to me. Just think out aloud ...

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If there is nothing to suppress any transients caused by switching inductive loads on and off then they might cause trouble.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
What's odd is that when I shift 0xff into the shift register, the 5.00VDC comes out the output pins as 4.6VDC.

That is very odd, because volts cannot come out( or go in for that matter). They do not move!
Any difference between voltage is due to a voltage drop by current(which does move).
Seriously, I don't think you can come to a accurate diagnosis if you have the idea that volts move!
Quote:
So, odd behaviors:
1. 4.7V output out of the shift register.

If you look at the data sheet for VOH, 4.7 is within spec considering the IOH.

You do have a good common/earth for the shift registers don't you. No stray AC current loops?

I believe fizgig is in the US Ross, so I think you could be right with the the 60Hz.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@LDEVRIES: Sigh. Yes, I'm aware that voltage is the existence of an electrical potential difference between two points and doesn't represent actual flow. Didn't realize that things were so formal here.

You can see in a later post that I realize the voltage drop is within spec. This is a long thread now so easy to miss things.

@valusoft: Good point that 60Hz (I live in California) is about 16ms of period time. Guess that means that the triac turns on for one entire cycle before the shift register drops. I would have expected to see the shift register drop sooner - say slightly after a quarter cycle when the full, lagged peak inrush current occurs which would then cause the triac to turn off as a consequence.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another thing may be how you have connected the shift register reset and enable inputs. Are they floating in thin air or have solid connections to ground / 5V?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pin 13 of the shift register is the output enable line which is active low. I have that pulled up with a 10k resistor for safety and my mega644 essentially keeps that at 0V during operation. The only time it brings it high is if it senses a fault elsewhere in the system. I disabled that part of my code though as part of this debugging (commented it out) but I still have the issue. I also have scoped this line anyway and it's rock solid 5V during the glitch times.

Pin 10 is the clear line which I think you might call the reset pin. It's active low as well and I just have that pin tied permanently to 5V since I never need to clear the shift register - I just shift 0's into it to clear it. Since I'm scoping the 5V line and not seeing any dips, I'm assuming the voltage on this pin is also not dipping.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wouldn't mind seeing a diagram if the project is not top secret. That could have been posted instead on the 1000's of words. :)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sure thing. Here's a schematic of the board. Didn't expect the thread to go on this long.

C1 and C2 are 0.1uF caps located next to each shift register respectively.

The resistors are 470ohms.

The microcontroller (not shown on the schematic) is on the stk500 and connects to the pins of the shift register via four wires.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What kind of oscilloscope you have and where do you connect the oscilloscope ground lead, shift register board ground, or AVR STK board ground?

And actually, what kind of grounding you have between shift register and AVR STK board? Both boards are just connected to the board that supplies 5V & GND?

I am just thinking if turning the contactors on and off result in some radiated disturbance that gets coupled to data pins somehow, so better grounding between the boards could solve the problem. For instance, a flat cable with every other wire is signal and every other wire is ground. On the other hand, if disturbance is radiated, maybe you should try to suppress it by putting a snubber over the triac or contactor.. Which triac is that, any datasheet link you could give us?

Also are you sure the AVR IO pins are set to outputs, so that you are just not toggling the weak pull-up on and off.. And in what state the AVR pins normally are, because the shift register data clock and load clock strobes are sensitive to rising edge.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Jepael: I think you nailed it.

While debugging this problem, I feared the circuit board I had made that had the uC on it had some sort of flaw causing the problem so I used the STK500 to supply signals to the shift registers. After a day or two of still seeing the problem, I moved back to the original circuit board with the uC on it. In both scenarios, the signal lines between the uC and the shift register board were wires. The return path required going back to the shared 5VDC power supply instead of one more wire directly connecting the two commons of the boards together.

When I designed the two boards, I had a 16-pin ribbon connector with alternating common wires to connect the two together (only 4 of the 8 available data pins of the ribbon were being used).

The problem was, I had forgotten to order ribbon connectors from digikey so I soldered temporary wires to bridge the two boards while I waited for the connectors to arrive. No wire was installed for a direct return path.

All my problems happened while using those four wires with the round-about return path. Your post motivated me to make a ribbon cable from the parts that arrived last night and try it out. With the ribbon cable installed, I now have 8 common wires shared directly between the two boards.

I've been busy helping with the kids this morning but I've managed to sneak a combined 15 minutes of observation and haven't seen a misfire yet so I'm cautiously optimistic. It would usually take as long as 3 minutes previously to see a failure so we're looking good.

Thank you Jepael for your suggestion! Thank you everyone for your help!