Pages: [1]   Go Down
Author Topic: Why use a capacitor on the 5v pin with a 74HC595  (Read 1094 times)
0 Members and 1 Guest are viewing this topic.
Boston, MA
Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was looking at one of the schematics for the ShiftPWM library and they use a 100nF for each shift register. This is the first time I've seen this and I've never encountered any problems by not using this capacitor.

In which cases is it useful? 
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Not only is it useful it is vital.
If you have never encounters a problem then you have not done much.
Just google
Decoupling myzen
To see my page on it, on my phone so haven't got access to the link.

Edit - here it is
  http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
« Last Edit: September 11, 2013, 02:11:36 am by Grumpy_Mike » Logged

Boston, MA
Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mike,

I've only used shift registers to drive some LEDs, that's all. Also, I've never daisy chained more than 4. So it's true that I haven't done much.

I went over quickly through your link and a lot of it is over my head so I bookmarked it for reading tomorrow with a little more detail.

Thanks for the info!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

About 90% of the " it operates intermittently"  problems on this forum are down to lack of decoupling capacitors.
Even four shift registers with LEDs can give you problems, you must have been very lucky or not done much with them if you found they worked fine.
By the way there should be no capacitors on any of the signal lines like is shown on some tutorials.
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 329
KC4MM
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem is this - when digital gates in the chips change from 1 to 0 or the other way around they draw a healthy amount of current from the power supply for a very short time.

The traces on a PWB or lengths of wire have inductance which opposes quick current changes and the result is that the voltage on the IC's power pin dips during the switching time which often can cause erratic operation of the chip. A small capacitor placed very close to the IC's power pin can supply enough current for just long enough to keep the voltage from dropping very much.

That's why it is standard practice to place small decoupling capacitors between power and ground as close to each chip as possible.

The capacitor type should be rated for high frequency (e.g. disk ceramic) and it's leads need to be kept very short to reduce their inductance. The value isn't critical and is usually in the range of .02uf to .1uf
« Last Edit: September 11, 2013, 05:35:04 am by RoyK » Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 154
Posts: 2263
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
About 90% of the " it operates intermittently"  problems on this forum are down to lack of decoupling capacitors.

This bears repeating.
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

LEDs  can take quite large currents directly from high-speed logic chips (10mA from each output
of a 74HC595 whose outputs transition in a couple of ns means the current is switched at around
40MA/s  (mega amps per second).

A 0.1uF decoupling cap will be able to provide that sudden demand for 80mA for 1.25us before
the supply droops below 4V, assuming a lot of inductance between the chip and supply.
With normal amounts of inductance between chip and supply that capacitor only needs to work for
100ns or so, but we play safe as other devices on the same supply may be switching
current simultaneouly.

By supply we normally mean the combination of the voltage regulator and its output capacitor (which
is also decoupling on a longer timescale)

Incidentally with 74HC logic and LEDs as loads without decoupling what happens in practice is that the
supply voltage immediately drops to the forward voltage of the LEDs and then ramps up as the supply
and ground wiring inductance current starts to rise in response to the dV across it.  Since 74HC series
work down to 2V this means the chips may not lose state, but their inputs will suddenly be _way outside_
the supply range of the chip (probably +1.5V and +3.5V) and significant pulse currents flow through the
protection diodes (which help to decouple the chip at the risk of damaging the diodes or more importantly
pushing the chip into CMOS latch-up state (capable of frying the whole device).

So we always decouple every digital logic chip without exception.
Logged

[ I won't respond to messages, use the forum please ]

Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1643
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

More: "Things the elders knew".

Even in 1967, when DTL and TTL Logic was rather new, designers understood the benefits and proper placement of  bypass capacitors.  Note: all those nice disc capacitors in this M706 board from Digital Equipment.

Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's a great picture.  I'd hang that above my bed.
Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 154
Posts: 2263
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For quite a while, you could buy IC sockets with bypass capacitors built into them.
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

Boston, MA
Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all the info. I've spent a little time reading about capacitors so I think I understand a little bit more what the idea behind using them is.

I have a couple more related questions:

Quote
The capacitor type should be rated for high frequency (e.g. disk ceramic) and it's leads need to be kept very short to reduce their inductance.

1) Will electrolytic capacitors work for this purpose?

Quote
The value isn't critical and is usually in the range of .02uf to .1uf

2) If I understood correctly (what I read today about capacitors) there is an important factor which is the capacitor's charge/discharge time (I'm sure it's called something else but that's how I understood it). If we don't have the right capacitor available and wanted to err on the side of caution, we'd use a "bigger" capacitor, right? For example 10µF, or even 100µF. My understanding is that a "small" capacitor might not have enough charge to "hold" during the needed amount of time.
Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You use both, in a way.

Electrolytic caps are capable of considerable capacity in a small space, and that is about the only good thing going for them.  They have (relatively) high series resistance, which means they can't deliver current instantaneously (no cap can, but there are degrees of fail).  This makes them OK for smoothing out voltage fluctuation over time, but not so good at damping high-frequency noise, or preventing digital switching noise.

Ceramic caps are much "faster", but their capacity is limited.  So the best approach is to use an electrolytic for bulk storage, then locally decouple with ceramics.

Since the laws of physics like to watch us suffer, as you go up in capacity, you tend to find higher ESR ratings.  Yet another reason why an electrolytic + 100nF ceramic is a winning combo.
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 329
KC4MM
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Electrolytic capacitors are fine for power supply filtering but absolutely not suitable for glitch decoupling.

It's easy to think bigger is better but actually that isn't so for decoupling. Best to have the right type on hand. Disk electrolytics can be purchased on ebay for a cent or two each if you buy a hundred so money shouldn't be a problem. Stock up on some 100nf caps and you'll be good to go.
Logged

Boston, MA
Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great, I just bough myself some 80 capacitors on eBay for $8. For the kind of stuff I'm doing it looks like I'll be using it everywhere!
Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 154
Posts: 2263
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No, bigger is not better for decoupling capacitors. Decoupling caps are meant to prevent dips caused by those very short nanosecond pulses of current caused as logic gates switch, not to smooth voltage drops caused by long term loads like relays and high current loads.

Grumpy_Mike edited his post and added a link to the website he mentioned about decoupling caps, here it is again:

http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Notice in the first graph, those large electrolytic caps go from being primarily capacitive (impedance goes down with frequency) to primarily inductive (impedance goes up with frequency) at only 10kHz! Aluminum electrolytics are long pieces of foil wound into a cylinder, so they have a relatively high self-inductance.

Note the 2nd graph, where the frequencies are much higher at the inflection point. It is not uncommon to combine bypass capacitors to get the desired bypass characteristics. For a system with a 16MHz clock like an Arduino, it is not uncommon to shoot for an impecance that is still low at 100MHz or better. So you may find circuits with 0.1uF combined with 1nF. Or as described lower on that page, larger 100uF or higher electrolytics to filter lower frequency noise caused by the rotational speed of a brushed DC motor, combined with 0.1uF or 10nF capacitor to filter the RF hash caused by the commutation switching in the same motor.

Same for a relay coil. While a diode can absorb the flyback current and so prevent a voltage peak, there is a fast voltage change from Vcc to -0.7V when the relay driver transistor is switched off that can cause RF radiation, causing clicks or pops to be capacitively or radiatively coupled to sensitive parts of the circuit.

Can you see why Grumpy_Mike asserts that up to 90% of problems seen here could be attributed to poor or no bypassing?
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

Pages: [1]   Go Up
Jump to: