# LM317 circuit capacitor question

I am trying to figure out the significance of the two capacitors recommended for use in an LM317 DC-DC converter circuit.

Recommended circuit diagrams show that I should be using a 0.1uf Ceramic Capacitor and a 1uf Electrolytic capacitor.

Why the difference in capacitors (size and makeup)? Can I use two capacitors that are the same type and composition, assuming they are of the larger size? For example, can I use two 1uf electrolytic capacitors instead? Will this just make the circuit slower to level out?

I understand how capacitors work (roughly) but I don't understand their purpose in this circuit.

The reason I ask is because I took a look at Other Voltage Regulators and they seem to have the exact same capacitors.

The two capacitors used in the LM317 typical application are described on page five of this datasheet. An identical schematic to the one you provided is given:

Along with a helpful note about why the capacitors are needed:

Note: 3. $C_i$ is required when the regulator is located an appreciable distance from power supply filter. $C_O$ is not needed for stability; however, it does improve transient response. Since $I_{ADJ}$ is controlled to less than 100 μA, the error associated with this term is negligible in most applications.

The best practice, for either capacitor, is to always include them. Specifically for $C_i$, place it as close to the input pin on the LM317 as reasonable.

If you have determined that you know what you're doing, you can decide to omit or alter the suggested schematic. In determining that, for $C_i$, an appreciable distance in on the order of centimeters, but you should also factor in the level of noise you expect on the input supply and how much the load the LM317 will be changing. For $C_O$, you can likely omit it if you have decoupling capacitors at the inputs of any ICs and relatively high current draw devices, anywhere things are going to be changing how much current they're drawing in a short amount of time.

Do check out the related questions and answers regarding how to use decoupling capacitors and how to select the type of capacitors to use.

• Entirely correct. And, speaking from experience, if you need C1, you really need it. – WhatRoughBeast Jun 11 '14 at 0:36
• Samuel, Thank you for the great response and the citation. Luckily, I can wire Ci pretty much directly on the input pin of the LM317. As you can see, I am just starting here and I'm hoping I'm not asking dumb questions. It's good to know that I can change any part of the schematic now within reason for my application. – ntgCleaner Jun 11 '14 at 2:14

If I recall it rightly, the 0.1uf capacitor filters high frequency noise in the LM317 input and the 1uf capacitor is used to stabilize output.

The circuit will work without any of those, but will amplificate input noise and the output will not be very stable.

If you can, keep them as they are, you can use aluminium or tantalum instead of traditional electrolytic ones for the 1uf capacitor, and, for the 0.1uf, polystyrene ones give a good result also.

• FYI, aluminum and tantalum are two types of electrolytic capacitors. – The Photon Jun 10 '14 at 21:59
• Yes you are right, missed the "traditional" word. – Gusman Jun 10 '14 at 22:05
• For decoupling high frequencies, ceramics are a better choice than polystyrene. They have better high frequency response and smaller size for the same capacitance/voltage. Polystyrene is better for any application where dielectric relaxation is a problem, such as sample/hold, but not in this case. – WhatRoughBeast Jun 11 '14 at 18:45

The capacitor on the input side is stated in the data sheet to be recommended, period. It improves transient response, according to some data sheets I have seen before and cannot now find.

The capacitor in the output side is stated in the data sheet to stabilize the output: specifically, to reduce ringing, reduce output impedance, and improve stability. Without it, the output impedance looks inductive to the load.

• Sorry, no. The input capacitor prevents the regulator from breaking into oscillation. – WhatRoughBeast Jun 11 '14 at 0:35
• The N.S. (original manufacturer) datasheet says: "Normally, no capacitors are needed unless the device is situated more than 6 inches from the input filter capacitors in which case an input bypass is needed. An optional output capacitor can be added to improve transient response". It doesn't hurt with this particular part to add decent size caps if the conditions of use are unknown, or even if they are met. – Spehro Pefhany Jun 11 '14 at 1:36

I just finished a good two months trying to figure this out. Here is what I know:

Your 1uF Input Capacitor Explained) The larger capacitor on the left side of the LM317 or LM337 between the input voltage and ground is the filter capacitor that helps remove any input voltage "Ripple"that is coming from your power supply (could be AC Mains or, in your case, some DC Wall-Wart or Variable Lab Bench PSU) so that the input & output don't fluctuate at a level that your load cannot tolerate, or rather, the output doesn't pass any of the input ripple voltage voltage.

The filter capacitor is a low pass filter and it has to be pretty large depending on how large your input PSUs Output Ripple is (AC Mains that is rectified changes voltage continuosly so having a large Capacitor filter section keeps the Input of the Voltage Regulator constant, but during the portions of time when the AC waveform is below the Capacitors stored Voltage the load will discharge the capacitor and this is Ripple). If your getting your supply voltages from a Transformer, that is, stepping down the AC mains voltage you're going to need probably at least a 1000uF (I typically use 2200uF as they ar roughly the same size and the bigger the filter the better when Rectifying AC Mains to some constand DC) instead of 1uF (at a Voltage Rating that exceeds your Voltage Requirements; remember AC V-max is V-root-mean-squared/.707). I think your circuit is assuming that the input supply voltage is already DC and doesn't have much ripple voltage (due to the very low filter cap value of 1uF) so it doesn't need to filter that much and the FIlter cap in your case is simply for Ripple that may result from Transients or the very small (but non-zero) ripple coming from your DC PSU.

It basically keeps the input voltage at a constant value and you can calculate it using: C=I*dT/dV(peak to peak ripple) C=Filter Capacitance I=Output Current Requires dT=The difference in time between Maximum Voltage and Minimum Voltage (For Transforming and Rectifying AC Mains this amount can be calculated using the Look-Up Table I put at the bottom of this post, or use excel to make a LUT of Sin(2*PI()*T) and make T 1-360 so that you can see the angle at which the Capacitors Voltage equals the rising rectified AC voltage after the first half of the 50Hz AC Mains -Rectified the frequency becomes 100Hz).

This could be a tantalum capacitor in your circuit or you could use an electrolytic capacitor. I have never used to tantalum capacitor that hasn't exploded in my face so I wouldn't recommend that one and the aluminum electrolytic only explodes maybe .5% of the time so I do recommend that. Basically it just needs to be polarized (and polarized capacitors have the unique property of exploding when the polarity is reversed except Tantalum Caps Charge and Discharge almost instantly while Electrolytic Caps don't which is why the exploding capacitor occurs with Tantalum Caps more often). Tantalum capacitors take up about 5% as much space so I recommend using Tantalum if you know how to not make them explode and are low on PCB 'real-estate'. Tantalum is also a conflict material and harvested from mines in the Congo by child slaves unfortunately and due to that (and Tantalum's relative Scarcity) they are a wee-bit more expensive (but here is a link to a cheap kit of Tantalum Caps.

Example: If your Regulator is Stepping 17V down to 15V and your % of Input Ripple Voltage is 10% then the Minimum Input Voltage subject to Ripple is 17V-1.7V (10% of 17V). Therefore your output should be Ripple free c. But the Datasheet for the LM317 says you should provide at least 3-Volts "Headroom between Input Voltage and Output Voltage because the Voltage Regulator is merely an Op-Amp with a Darlington NPN Transistor Pair Output and the Collector of the Darlington as well as the Voltage Reference of the Op-Amp and the Op-Amps +Vsupply pin are all connected to the Input and when it's ripple is 10% at 17-Volts that means it's lowest Vin will be 15.3-Volts and the Darlington is going to have SOME amount of Vce and the Reference for the Op-Amp is a buried band-gap voltage reference that is always 1.25 Volts below the Vin so at 15.3-Volts as your absolute minimum Vin you're going to have 'some' Input Ripple "passing" through the regulator and appearing on the output as Output ripple because your internal Op-Amps Vref (inside the LM317/337) is now 15.3-1.25=14.05. Therefore at it's minimum Vout is 14.05 Volts giving the output a % ripple of (15-14.05)=.95V/15V=6.33%, Conceivably. If your Vsupply had a 5% ripple then Vref would be (17*(100%-5%)=16.15>>16.15-1.25=14.9; therefore Output Ripple % with a 5% input Ripple when regulating 17V to 15V is (15-14.9)=.1/15=0.6% which is likely tolerable. Also % Ripple is dependent on whatever the Capacitor Voltage is as it's Equation is (Vmax-Vmin)/Vmax, but the Ripple Voltage is not; if you have a DC offset of 5 Volts then the Ripple voltage at 10% is stil 1.7 Volts but the Ripple % is 1.7/(17+5)=7.7% instead of 10%.

Here are some links to various Tantalum 100 PC Kits; never under less than .47uF or higher than 100uF:

High Valued Electros

Your .1uF Output Capacitor explained) The Capacitor on the right side of the voltage regulator, or on the output, more accurately, it serves just about the same purpose except for it tries to keep the Vout constant. It filters: A> any Input Ripple Voltage that may have passed through the voltage regulator and into your load B> any Voltage from the Load that may flow back into the Regulator if you have an Inductive Load C> any changes in Voltage due to a Low Impedance Load (as the Output pin MUST supply enough current to flow between the resistor connecting the Vout pin and the Adjust pin so that there is 1.25-Volts across that resistor; the Adjust pin consumes a negligible .5mA and so the way the LM317/337 works is due to the Current created by the 1.25-Volts across that resistor needing to flow throught your Rset resistor (if Radj is 125-Ohms and Rset is 1200 Ohms then 10mA is at the node between Rset and Radj and must flow through Rset to Ground creating a Voltage Drop of 10-Volts. Thats why Vout=1.25(1+Radj/Rset)[which is the same equation as a Non-Inverting Op-Amp with 1.25 on its Non-Inverting-Input and Radjust acting as the feedback resistor and Rset acting as the input resistor (as it is normally called that due to the Non-Inverting Amplifier Topology being the same as the Inverting Amplifier Topology if the Inverting amplifier had a negative DC-offset on its Non-Inverting Pin making the 0-Volts Ground input connected to it (when in Non-Inverting mode) seem like a Positive Differential VOltage input to the Op-Amp. This is why it can regulate any voltage down to 1.25 but not below (in my experiences it only goes to 1.28-9).

Back to Cout: It supplies current to the load when your input voltage is fluctuating (due to a transient power loss at the input or if a branch connected to the input draws Voltage away from it temporarily). If Vin is below Vout then the regulator stops regulating as Vin supplies the Vref and the adjust pin is acting like the Feedback resistor in an inverting op-amp and when Vin drops below Vout then the Inverting input become greater than the non-inverting input and it outputs a Voltage Below Vout. Vout is the Emitter of a darlington transistor pair of NPNs with it's base connected to the Op-Amps input and this means that Vbe of the Darlington become Negative which turns it off. So if Vin is Bellow your input Voltage (the Vmax on your Input filter Capacitor) then no current Flows 'through' the regulator and the Output Cap will discharge into the load temporarily (until Vout

There should sometimes be a diode that is forward biased when Vout is greater than Vin and it is strapped across the regulator so that if Vin-1.25V is less than Vout the Capacitor doesn't supply Voltage into the Adjust Resistor which would result in Vout not fluctuating but would result in Vin going below Vout and the above situation results and, depending on the load, you can't be sure how the Load will discharge the Output Cap. Capacitive and Inductive loads would result in large transient Voltage Spikes. So this diode is necessary if you want an adjustable output so that the Capacitor can discharge into the input instead of the Output or Adjust pins as well as the Load.

The output capacitor should be a multi-layered ceramic capacitor and it shouldn't be polarized because your load may cause it be at a different polarity during transient voltage spikes on your output if the load is inductive or capacitive OR if their is parasitic Inductance or Capacitance (which their always is on a Voltage Regulator due to those three skinny legs; this is why the Adjust pin on the LM317 and LM337 is leg 1 for both but the input and output pins are not the same for both -there are different parasitic capacitance effects depending on the polarity of Vin as the Voltage of 1.25 across Vout and ADJ either flows from Vout to Adjust in the LM317 and from Adjust to Vout in the LM337.

I know that my mistake when making this circuit, or rather my attempt at making a circuit that is similar to yours, was trying to figure out the value of the output capacitor. Even though it's a pretty small capacitance it will have in equivalent series resistance that will mess with your load regulation because it's a parallel resistance with the load and your voltage divider to the adjust pin/GND

The output voltage capacitor value needs to be small enough so that it's corner frequency is larger than the frequency of any changes in load current due to changing the output load with a fast switch, mosfet or transistor (if you are creating an Adjustable Regulator imagine going from 10V to 5Volts with a low Impedance load; The Capacitor wouldn't Discharge when you changed the step. I originally had an Output Capacitor that not only was Electrolytic but also was pretty large thinking, "the larger the better if it's trying to provide stability". This resulted in the my Adjustable Voltage Regulator not changing it's output very quickly (it would actually hold it's output voltage for several minutes when I unplugged it -that is, when measured using a multi-meter so there was no Discharge path;if i had an LED attached the LED would slowly dim over the course of 5 seconds). If it has a lower corner frequency than it will not discharge the output capacitor fast enough and the output voltage could go into the LM317/337 Darlington NPN transistor output stage or the Adjust pin which only consumes .5 milliAmps and this could damage your Regulator over time.

Lastly, when I had a high Value electrolytic output Capacitor the Output Voltage wouldn't discharge when Vin

Unfortunately, as is with all thing 'Capacitive' the value to choose in Farads is best chosen with tial and error as each capacitor has an ESR and (Parallel/Series?) Inductance. The value depends on your load but I got my regulator supplying enough current to power a 5-watt computer Fan at +/-9-Volts (I connected the +Vsupply and the -Vsupply so the equivalent of 18 VDC) and I measured the Line Regulation and it only dropped 1.5 Volts when my Radj was 240-Ohms (as the Datasheet for the LM317/LM337 recommends.

My last piece of advice: don't think you can kill to birds with one stone by combining Rset and Radj into a single Adjustable Potentiometer. The Voltage Regulator works because 1.25 Volts creates a current that should remain constant and that current must flow through Rset and that creates the Voltage drop which sets the Output Voltage (which S/B the voltage across Rset +1.25, the voltage across Radj). If you use a single Pot your always changing the current between the Vout and ADJ pin and your also then changing Rset so it's very unstable and if you make Radj like 1 ohm then that 1-ohm portion of your pot between the output and the wiper connecting it to the ADJ pin is going to burn!

Here is my circuit using my simulator of choice: Texas Instruments 2016 release (it's only release) of the incredibly easy to use and simulate TINA (plus it's smorgasbord of TI parts already in its component select menu and multitude of examples. They don't have the LM337/LM317 in there though so I used Op-Amps with a single pass transistor output stage with two Diodes on their Non-Inverting inputs to represent the Band-Gap Voltage Reference.

EDIT: I wrote this while walking and using Voice2Text so I corrected the errors my phone made

LOOK-UP TABLE TO BE USED WHEN RECTIFYING AC VOLTAGE TO 25-VOLTS IN THIS CASE. IF YOUR DESIRED VDC IS 12 THEN DEVIDE THE NUMBERS IN THE FOURTH COLUMN BY 25 THEN MULTIPLY BY THEM 12. DISREGARD THE LAST THREE COULMNS ON RIGHT AS THEY ARE SIMPLY THE RATE OF CHANGE OF THE VAC IF YOU WANT TO DO INDUCTANCE OR CAPACITANCE FIELD EQUATIONS. THIS ASSUMED A MAINS FREQUENCY OF 50Hz RECTIFIED TO 100Hz:

• It's quite odd to speak of mains ripple when designing a LM317 circuit - it's not the job of the LM317 to clean that up, but rather the AC/DC converter before it. It seems you are mixing up low voltage DC/DC conversion with LM317 and AC/DC rectifying of 230 VAC mains, in some unholy mess. Which isn't helpful for the vast majority of LM317 applications. Just toss in 100nF for "generic EMC" and it will likely be just fine for most purposes. LM317 is mostly just a heat generator anyway - if you don't need heat, you'd use a more modern LDO or a switching regulator. – Lundin Nov 22 '18 at 12:08
• The only times/the only circuits I have seen it used is for Adjustable Voltage Regulation. I mentioned how he likely has already converted the AC to DC but gave an explanation anyway of what you would do when using it after a Bridge Rectifier as a Filter Cap in a AC/DC Converter/Adjustable Ac/DC Voltage Regulator. It's called an adjustable voltage regulator, not a "heat source" and I did mention that if you already have a DC Input voltage that it is there to combat any Variation due to Parasitic Capacitance or Inductance+EMI. But I'll make my explanation less complicated and more to the point – Danny Sebahar Nov 22 '18 at 14:48
• To begin with, there exists no such thing as AC in industry/automotive standard 12/24VDC applications. The main purpose of LM317 was to reduce BOM when you needed to step down a voltage in several steps. As is necessary with LM317 to prevent the temperature protection from kicking in. For example 24V -> 12V then 12V -> 5V, using the same LM317 component all the way, instead of specialized LDOs like LM7805. Anyway, that's electronics archaeology. – Lundin Nov 22 '18 at 14:55
• @Lundin, It's not odd to talk about mains ripple. In most use cases for a linear regulator, it is just rectified AC from a transformer wall wart that is fed to regulator input, so it will have ripply voltage at mains or double the mains frequency depending on half or full wave rectification, and you get not so much ripply 5V DC or whatever out for your chips. – Justme Nov 22 '18 at 16:55