# Comprehension: Assumptions involving capacitors and diode with the LM317

#### Binary Buddha

Joined Sep 24, 2016
40
Newbie to electronics working on my comprehension of the LM317. Please feel free to quote and correct me where I'm not accurate.

So, I often hear that the "capacitors" should be placed as close to the LM317 as possible. I'm assuming they mean a "decoupling capacitor". The rest of my assumptions will be based on the ceramic "coin" type of capacitor using the attached schematic. I'm also assuming that a decoupling capacitor is the capacitor that connects the Vin to GND before the LM317; see C1 in schematic. Some post also mention a second decoupling capacitor connecting Vout to GND; see C2 in schematic, and that it is; under some circumstances, optional. The second capacitor should also be larger due to load variance on Vout.

The intent of decoupling capacitors is prevent oscillation. Oscillation from my comprehension is the fluctuation of Voltage and Current. So, the result in it's use with an LM317 is to aid in providing steady or "smooth" voltage and current. How it does this is analogous with an overflow gutter for a pool. When the circuit is powered the capacitors charge to it's rating. When voltage fluctuates up the capacitors discharge the "extra" voltage/energy to GND. When the voltage fluctuates down the capacitors discharge it's "stored" voltage/energy to the line it's adjacent/tapped into; i.e. Vin or Vout.

When soldering the capacitors for the through-hole type, it's best to have leads as long as possible. Something to do with the lead attributing to capacitance.

Also in the schematic 1N4007 is what they refer to as a "Protection Diode". And it's purpose is to prevent some type of current backflow from going into Vout which would damage the LM317.

#### Papabravo

Joined Feb 24, 2006
12,767
The purpose of the diode is to discharge the output voltage "Variable" when +12V goes away. This might happen with a high impedance load; C2 would retain a noticeable voltage for a very long time.

#### Binary Buddha

Joined Sep 24, 2016
40
...C2 would retain a noticeable voltage for a very long time.
So, C2 would retain the voltage if the diode wasn't there?

#### ericgibbs

Joined Jan 29, 2010
9,342
When soldering the capacitors for the through-hole type, it's best to have leads as long as possible. Something to do with the lead attributing to capacitance.
hi,
I have never heard that explanation, I keep the LM317 legs as long as possible in order to provide a little extra cooling of the main body.
Using 10nF thru 100nF caps close to the LM317 will prevent oscillation of the LM317, which they tend to do without these caps.

The reverse diode across the LM317 is explained the attached image.

E

#### Attachments

• 19.9 KB Views: 5

#### Papabravo

Joined Feb 24, 2006
12,767
So, C2 would retain the voltage if the diode wasn't there?
Assuming that the load is a high impedance, the low current that it would draw would cause C2 to discharge very slowly. For example, with C2 @ 1μF and the resistance of the load @ 100K Ω the RC time constant would be would be 100 msec and after 5 time constants or 500 msec the capacitor would be mostly discharged.

#### KeepItSimpleStupid

Joined Mar 4, 2014
3,825
The intent of decoupling capacitors is prevent oscillation. Oscillation from my comprehension is the fluctuation of Voltage and Current. So, the result in it's use with an LM317 is to aid in providing steady or "smooth" voltage and current. How it does this is analogous with an overflow gutter for a pool. When the circuit is powered the capacitors charge to it's rating. When voltage fluctuates up the capacitors discharge the "extra" voltage/energy to GND. When the voltage fluctuates down the capacitors discharge it's "stored" voltage/energy to the line it's adjacent/tapped into; i.e. Vin or Vout.

When soldering the capacitors for the through-hole type, it's best to have leads as long as possible. Something to do with the lead attributing to capacitance.
A PCB trace has "inductance" and the bypass cap sort of compensates for that. Two little rules: voltage across a capacitor cannot change instantaneously" and the "Current through an inductor can't change instantaneously". The initial selection is usually done with the manufacturer's recommendations. Sometimes multiple types of capacitors are used in parallel.

FWIW: Sometimes (high frequency circuits) a single resistor won't work for three resistors in series adding up to the "same value". The inductances happen to be different. Wires moving in free space generate current. it's really small, like in the 1e-12 Amp range. It's a moving wire in the Earth's magnetic field. I had to worry about it. Solder joints can create unwanted thermocouples. 99.9% of the time, you don't care.

==

There are actually two protection diodes that you can install not just the one in your schematic.

#### crutschow

Joined Mar 14, 2008
24,084
....
When soldering the capacitors for the through-hole type, it's best to have leads as long as possible. Something to do with the lead attributing to capacitance....
That's backwards.
You want the leads as short as practical, to minimize the lead inductance which interferes with the job of the capacitor.
That's why surface mount capacitors connected directly to the trace are generally better than leaded types for high frequency decoupling, they have no significant lead length.

#### Binary Buddha

Joined Sep 24, 2016
40
I keep the LM317 legs as long as possible in order to provide a little extra cooling of the main body.

#### ericgibbs

Joined Jan 29, 2010
9,342
hi,
Yes but its so small it is insignificant.
E

#### crutschow

Joined Mar 14, 2008
24,084
Yes but its so small it is insignificant.
Perhaps in this application, but in higher frequency applications the capacitor lead inductance can be a problem.

#### ericgibbs

Joined Jan 29, 2010
9,342
Perhaps in this application, but in higher frequency applications the capacitor lead inductance can be a problem.
I have been using these devices in many products for many years, both in HF and UHF applications and I have never had a problem.

Do you have an actual application that you could post where this has been a problem.?