Noisy latch line on 74HC595?

Hi, I am following this guide:

with a Nano & the 74HC595.

However, to get the circuit to behave, I seem to need to rest my finger (some sort of capactitive problem?) on the latch line wire. :o

If I do that, it works fine. The capacitor on the latch line seems to make things worse.

If I don't do it, the sequence of LEDs will pause.

I have also included a decoupling capacitor (1uF, 10uF) across GND and VCC, but no joy. I have also tried shortening the wires.

Google suggests that other people have had a very similar issue. I read that the latch line can instead be connected to the CLK line ('latchless mode' or something) and this indeed is stable however it doesn't work as expected (Q7 doesn't seem to work properly).

I have read that these are known to be sensitive to noise. Perhaps there are alternative ICs that are more robust?

Any suggestions for how to fix or alternatives would be greatly appreciated

Thanks

Welcome,

What is this capacitor between latch and gnd ? Try without it :stuck_out_tongue:

This is a well known shit tutorial which for some unknown reason they refuse to fix.
That capacitor should be connected between the Vcc pin and ground, NOT the latch pin.

I have read that these are known to be sensitive to noise.

People write all sorts of incorrect crap.

Perhaps there are alternative ICs that are more robust?

That chip is as robust as any other chip, it is just that they have not applied correct decoupling.

Read De-coupling

These are the correct diagrams:-
ShftOut_Schm1.gif
ShftOutExmp1_3.gif

The capacitor used should also be a 0.1uF to 1uF Ceramic capacitor. It is vital to use the ceramic type.

Grumpy_Mike:
This is a well known shit tutorial which for some unknown reason they refuse to fix.

It's pretty bad when you cannot trust information on the main Arduino site, isn't it? :astonished:

Unfortunately, this is the case.

And it is not the only problem with the tutorials, but perhaps the worst blunder, or among the worst. :roll_eyes:

Thanks everyone. I have put two 50nF capacitors in parallel across Vcc (pin 16) and /OE (pin 13, also connected to GND).

The situation has improved however I am still getting errors seemingly linked to the handling of the wires connecting the Nano to the IC.

The capacitors I am using are similar to these in appearance:

I want to eventually run this from a bare atmega328 on a PCB, are there any other fixes I can try now on the breadboard and what considerations should I make for when I put it on the PCB?

Could it be a bad IC?

Thanks very much

Probably a wiring/breadboard error.
Post a picture of your setup.
Leo..

Update: so now I have found a 100nF ceramic capacitor, have shortened the leads again, and it's now seeming to work.

So that's great, except I want to now bring it into my main project where I have a bare atmega328.

I simply transferred the leads from the Nano to the atmega328. Now it is back to its old tricks of throwing up errors unless I touch the leads. It definitely seems to be related to the latch lead.

I would post a photo of the bigger project with the bare atmega328 but when I tried, it's a complex mass of wires, components etc and you can't really see (which is why I tested it on its own board first). The atmega328 has all the prescribed capacitors on its end and it's being powered by a 5V ftdi module.

Pulling my hair out. What could be wrong? Is there a more reliable way of bitshifting/latching etc. - it doesn't need to be fast at all for my purposes, it just needs to work every time! I was initially going to use a 74HC259 decoder but I can't spare 5 pins (3 address, 1 data, 1 enable) to manipulate 8 LEDs (unless there is a clever way of using less pins?).

Thanks for all the help

Let's see it.

.

OK, for what it's worth!

(please note - LEDs are on despite no USB to the FTDI, this is because I had the USBasp plugged in)

and /OE (pin 13, also connected to GND).

Do not connect any capacitor to the /OE line.

Could it be a bad IC?

No.

Where are your decoupling capacitors on your stand alone board?

The atmega328 has all the prescribed capacitors on its end

And who prescribed them? Another crap tutorial?

Solderless breadboard is crap for anything none trivial, the connections are not reliable enough. That layout is a mess.

OK, for what it's worth!

I've never used a breadboard without at least a 47-100µF cap and 0.1µF ceramic cap across the ground bus and power bus. I would suggest using just two side by side power rails near the middle, then run separate power and ground connections where needed from there.

Darn it ... Grumpy was quicker.

I see why you didn't want to post this before :slight_smile:

Pin14 of the Atmega chip (D8) should not be sensitive, because it's an output (low impedance).
If the green wire to the latch pin is sensitive, pin 14 of the MCU could make bad contact with the breadboard.

Can't you move the MCU one or two holes to the left, and fit the 595 next to the MCU.
And only have the LEDs on that second breadboard.
Leo..

Will you verify the 22pf capacitors have one end going to GND?

I would add some 10 and .1 uF capacitors at several places on all power rails.

Shortening wires to a minimum will help in reduction of noise interference.

See this for making small jumpers. (use solid wire #24AWG)
https://forum.arduino.cc/index.php?topic=353064.0

Hard to see decoupling on the controller and the wiring of the reset circuit.

.

dlloyd:
I've never used a breadboard without at least a 47-100µF cap and 0.1µF ceramic cap across the ground bus and power bus. I would suggest using just two side by side power rails near the middle, then run separate power and ground connections where needed from there.

Darn it ... Grumpy was quicker.

I have a big electrolytic capacitor (1000uF) across the power and gnd lines elsewhere in the circuit. As I am sure is clear, I'm pretty unsure of what I'm doing with laying out capacitors! The logic is all a bit murky to me. Keen to learn though!

LarryD:
Will you verify the 22pf capacitors have one end going to GND?

I would add some 10 and .1 uF capacitors at several places on all power rails.

Shortening wires to a minimum will help in reduction of noise interference.

See this for making small jumpers. (use solid wire #24AWG)
FYI, wire stripping trick - General Electronics - Arduino Forum

Hard to see decoupling on the controller and the wiring of the reset circuit.

Yes there is a black jumper going from the 22pf to GND. Can shorten wires, however I'm a bit worried that if it's so sensitive to this kind of thing, then maybe i should look for other solutions. What are your suggestions on value/location of capacitors?

Wawa:
I see why you didn't want to post this before :slight_smile:

Pin14 of the Atmega chip (D8) should not be sensitive, because it's an output (low impedance).
If the green wire to the latch pin is sensitive, pin 14 of the MCU could make bad contact with the breadboard.

Can't you move the MCU one or two holes to the left, and fit the 595 next to the MCU.
And only have the LEDs on that second breadboard.
Leo..

I have tried using different pins for the latch, doesn't make a difference. Will try moving the 595 right next to the MCU.

Grumpy_Mike:
Do not connect any capacitor to the /OE line.
No.

Where are your decoupling capacitors on your stand alone board?
And who prescribed them? Another crap tutorial?

Solderless breadboard is crap for anything none trivial, the connections are not reliable enough. That layout is a mess.

Can you suggest a better tutorial for capacitors on a standalone atmega328?

I connected it to the /OE because that is going to ground and I can't stretch the capacitor from Vcc to GND (opposite ends of IC)

The decoupling ceramic capacitors on the atmega328 are across pin 22 (Vcc) and pin 20 (GND), also across pin 7 (Vcc) and pin 8 (GND).

I get that it might be more reliable on a PCB, with shorter connections etc. but I want to get something as robust as possible before I commit to that.

Is the shift register my only option? (compared to the decoder where I think I need 5 pins to control 8 LEDs - is that right?)

Thanks everyone

I have a big electrolytic capacitor (1000uF) across the power and gnd lines elsewhere in the circuit.

Location is important.

It's also advantageous to avoid ground loops.

I connected it to the /OE because that is going to ground and I can't stretch the capacitor from Vcc to GND (opposite ends of IC)

Well that's fine then isn't it. Physics is well known for being forgiving about that sort of thing.

Seriously do not connect a capacitor to the OE line. It will damage your Arduino and maybe the chip. You have been told this several times and if you persist on doing it you will never get anything to work.

Grumpy_Mike:
Well that's fine then isn't it. Physics is well known for being forgiving about that sort of thing.

Seriously do not connect a capacitor to the OE line. It will damage your Arduino and maybe the chip. You have been told this several times and if you persist on doing it you will never get anything to work.

OK, I guess there is a big big gap in my understanding then - I thought it would be OK because as on your schematic, the /OE is connected to ground. What is the difference? (I am not trying to be difficult, I just obviously need to understand this so I don't make similar mistakes in the future!)

Also you should measure the value of capacitor, because sometimes their real value is very different than the marked value! I bought a cheap set of those capacitors on ebay, many small values are completely wrong. This, or my Extech multimeter is wrong on measuring small capacitors..

rj77:
OK, I guess there is a big big gap in my understanding then - I thought it would be OK because as on your schematic, the /OE is connected to ground. What is the difference? (I am not trying to be difficult, I just obviously need to understand this so I don't make similar mistakes in the future!)

Sorry, you have confused poor old Mike. /OE absolutely should be connected to ground.

We are just getting touchy about that stupid tutorial recommending a capacitor - any capacitor at all - on the "ST_CP" (STore Clock Pulse) or latch line.

Bypass capacitors do need to be wired as close to the Vcc and ground pins as humanly possible. The best solution is of course, four layer board where the middle two layers (predominantly) carry Vcc and ground and themselves form a bypass capacitor.

The most important capacitors are the 22 pF loading capacitors on the crystal - on a breadboard, they need to be bridged adjacent to the chip, directly to the ground pin, not via the busses or long wires. However sometimes 22 pF capacitors fail to work because the breadboard itself adds substantial (pF) capacitance.


And while I am at it, I seriously think it is absurd to the point of foolishness to construct a "breadboard" arrangement for anything short of commercial production in excess of 100, as (Chinese) Nanos are dead cheap and that only if you need the USB interface, Pro Minis being the "production" module that you can mount to your own PCB or protoboard.

You avoid all these "breadboard" problems too - even insofar as you use these modules on a breadboard.

Sorry, you have confused poor old Mike.

Yes, I'll get my coat.