LM317 - Constant Current vs Constant Voltage - Page 1
Forum section: electronics / beginners

author: made2hack
author_rank: Frequent Contributor
timestamp: February 04, 2016, 06:10:08 pm
content: Hi all,I'm not sure I understand the LM317 properly and wanted your feedback.In example 1, as given in the data sheet, the current is limited to 50mA by the 24Ohm resistor between ADJ and Vout (1.25/24 ~ 50mA). At what voltage? Is it Vin - 1.25? So if I have 9Vin, I will get approx 7.75 Vout @ 50mA?In example 2, they give a battery charging circuit. Again, what current is it delivering and what does the 0.2 Ohm resistor do? What if I input 12Vin in this case?In example 3, the traditional variable voltage configuration, will the current limiting resistor limit the current of Vout? So, can I have an adjustable Voltage configuration with current limiting as I've drawn it?

author: Simon
author_rank: Unknown
timestamp: February 04, 2016, 06:27:33 pm
content: The first circuit is wrong, yes your Vout will be Vin-1.25V-whatever the pass transistor in the regulator needs.In the second circuit I'm not sure what the 0.2R resistor will do apart from add voltage drop to the regulator, it will still regulate to keep a constant voltage.In the third circuit the resisor wil drop the output a bit as the current goes up but calling it a current limit is quite an exageration.

author: Gyro
author_rank: Super Contributor
timestamp: February 04, 2016, 06:51:25 pm
content: The second circuit is designed for Lead-Acid battery charging. The 0.2R resistor effectively increases the output impedance of the regulator in order to limit the current into a discharged battery, while still providing regulated float charge voltage once it is charged.

author: Simon
author_rank: Unknown
timestamp: February 04, 2016, 06:53:09 pm
content: Quote from: Gyro on February 04, 2016, 06:51:25 pmDepends on the input voltage, I mean what is 0.2R, lots of wire ?

author: Gyro
author_rank: Super Contributor
timestamp: February 04, 2016, 06:58:35 pm
content: I should have said 'reduces' output current rather than 'limits' it. It's an app circuit from the datasheet. The LM317 datasheet (the old NS one anyway) specifically warns against connecting the ADJ resistor (Edit: ..network close to) the load because it degrades regulation, the circuit is making use of this

author: Zero999
author_rank: Super Contributor
timestamp: February 04, 2016, 08:24:07 pm
content: #1 You forgot the voltage drop due to the pass transistor, which will be around 1.6V at 50mA, so Vout will be 6.15V, when Vin is 9V.#2 The 0.2R resistor increases the output resistance. The formula is on the datasheet. For your circuit it's ZO= R4 (1+R3/R2), plugging the values in your circuit into the formula, gives an output resistance of 2.2R.http://www.st.com/web/en/resource/technical/document/datasheet/CD00000455.pdf#3 The output resistance is simply R7. The short circuit current and voltage at different loads can be calculated using Ohm's law.

author: ve7xen
author_rank: Super Contributor
timestamp: February 04, 2016, 08:42:36 pm
content: QuoteNote that your example 1 configuration is incorrect. Vout (or Iout here...) should be connected to ADJ, not Vout, and obviously needs a return path through the load.In a CC configuration, the device is regulating only the current and is unregulated for voltage. The feedback loop will adjust the output voltage as necessary to maintain the desired constant current. To understand this you need to understand that all the LM317 does is maintain a constant 1.25V between Vout and ADJ. In a constant-voltage configuration, you create a resistor divider such that Vout-1.25V appears at ADJ when the desired voltage is present on Vout, and the LM317 will maintain it. In the constant-current configuration, you place a resistor across Vout and ADJ, and attach the load to ADJ. In this case, the LM317 maintains 1.25V across the resistor, which by ohms law, is a specific current. That current must return to the supply, and the only path is through the load, so you have created a constant-current source.Now obviously this is the real world, so the voltage at ADJ (the current source node) can't climb all the way to Vin. You can think about the voltage drops involved. First the regulator will have a dropout voltage from Vin to Vout, which is something like 1.5V. Then you have a regulated 1.25V between Vout and ADJ, where you're interested in. So your effective maximum output voltage will be Vin - ~2.75V.

author: Zero999
author_rank: Super Contributor
timestamp: February 04, 2016, 08:57:00 pm
content: Here's the corrected circuit.

author: made2hack
author_rank: Frequent Contributor
timestamp: February 05, 2016, 10:49:46 am
content: So getting back to my question, what's I guess the best way to current limit with an LM317 while having variable voltage? Should I allow the LM317 to take care of the voltage section? And then have a transistor / resistor combination afterwards do the actual current limiting and current handling? And just always take into account the voltage drop over the LM317? And also the 1.5A max load it was designed for (heat sinked)?

author: Gyro
author_rank: Super Contributor
timestamp: February 05, 2016, 02:02:51 pm
content: I'm not sure you asked a specific question in your original post? I wasn't clear what you were trying to do, other than understand the LM317.From the schematic in your latest post it looks like you're trying to charge a battery, but you haven't mentioned it in your text in either post. it sounds more like you're talking about a current limited variable PSU. What sort of battery? That's rather an important thing to know.Edit: in terms of what sort of battery: What chemistry? what capacity? What voltage (how many cells)? what usage (standby, charge and remove, how fast)? Circuit 1 (constant current) is most applicable to NiCd/NiMh, Circuit 2 is applicable to Lead-Acid, Circuit 3 is simply a variable PSU with a resistor on the output. None of the circuits is suitable for LiPO.

author: Seekonk
author_rank: Super Contributor
timestamp: February 05, 2016, 02:50:24 pm
content: Simplest way would be a low ohm resistor sensing the negative lead to the battery. That drives the base of a transistor. The collector of that transistor shunts the pot of the regulator dropping the voltage. You can reduce the burden voltage of the shunt resistor by using a lm339 instead of the transistor.

author: made2hack
author_rank: Frequent Contributor
timestamp: February 05, 2016, 06:39:39 pm
content: Hi, sorry. I wasn't too clear.I want to be able to charge / test NiCd batteries, either one cell (1.2 - 1.4V) or I guess up to around 8 in either series.

author: ve7xen
author_rank: Super Contributor
timestamp: February 05, 2016, 07:11:18 pm
content: If you want to regulate both current and voltage (can only regulate one at a time of course), you usually want two separate control loops. I think your latest schematic is probably a sensible approach - use an LM317 on the high side to regulate the maximum voltage and a current sink on the low side to regulate current. The current sink could be another LM317 in constant-current configuration but with ADJ tied to ground and Vin sourced from the low side of the load. There are lots of other ways, of course.Keep power dissipation in mind. Yes, the LM317 is rated for 1.5A, but the junction-to-case thermal resistance is still 23?. If you're dropping 10V over it at 1.5A, you're dissipating 15W. Even if you were able to perfect extract all the heat from the case (you can't, even with an infinite heatsink...), its junction temperature would rise to 345? over ambient. Well actually it would go into thermal protection or be destroyed, but... The practical limit is probably 2-5W with a decent heatsink.

author: Gyro
author_rank: Super Contributor
timestamp: February 05, 2016, 09:10:56 pm
content: Quote from: trs80 on February 05, 2016, 06:39:39 pmIt happens... You get so wrapped up in the details you forget the question.Ok, if you're talking NiCds then that counts circuit 2 out - only suitable for Lead Acid.For NiCd you want to charge them constant current, especially in series stacks because it allows all cells to balance up their full charge.It now depends how quickly you want to charge them - the simplest way is to charge them at C/10 rate for 14hrs or so (14 rather than 10 because they are not 100% efficient). C/10 means battery capacity in mAh/10. At C/10 rate you don't need to worry about voltage - they can tolerate C/10 charging almost indefinitely and will simply reach their full charge voltage and stay there.The simplest way of doing the above would be the simple LM317 current source (LM317+1 resistor wired correctly - as Hero999's correction). You could use the same supply voltage for any number of batteries (max. number of cells x 1.5V + 3V approx) but you might want to drop it for smaller numbers of cells to reduce LM317 power dissipation if necessary.If you want to charge faster, eg C/5 rate or faster then more precautions are needed to limit the charge time and cutoff based on battery voltage. Faster than that you need to monitor battery temperatures too. If time isn't an issue then keep things simple and charge at C/10 overnight.Hope this helps.P.S. You're not talking big currents here - for 1500mAh AA cells you're only talking 150mA at C/10.

author: made2hack
author_rank: Frequent Contributor
timestamp: February 06, 2016, 11:33:31 am
content: Ok, so I connected 6 cells in series with the lm317 acting as constant current regulator. Pulling 140mA (a little under C/10).Vin is 12V -> Vout is approx 7V. Is this normal? Will the Vout increase as the batteries charge up? Do I need to worry about over voltage?

author: Gyro
author_rank: Super Contributor
timestamp: February 06, 2016, 12:01:29 pm
content: Yes, that sounds fine, the cell voltages should rise as the they charge.There's no need to worry about over-voltage at C/10, the cells will just settle to their fully charged voltage. Probably best to limit charging time to less than 24 hours, but they will tolerate C/10 for much longer without damage.You should be able to get a very rough idea of cell health by comparing their fully charged voltages, and then after letting them sit for a few hours off charge. That should weed out those with internal shorts/dendrite growth but not low capacity.Edit: you might want to increase the LM317 input voltage slightly, say, 14V, to be sure that it stays in constant current mode at full charge voltage (~1.5V / cell)

author: made2hack
author_rank: Frequent Contributor
timestamp: February 06, 2016, 12:05:09 pm
content: Thanks a bunch!