I'm trying to test the capacity of some 18650 Li-Ion batteries by discharging them to 3 volts with a constant current load. For the load I'm using an LM317 as such:

-Battery +ve to the input pin -3 ohm resistor between output and adjust (should limit current to 400mA) -1 ohm load resistor between the adjust pin and battery -ve.

Short circuit current without the 1 ohm load resistor is 320mA, measured in series with the load resistor is 270mA and measured in parallel with the load resistor is 240mA. I'm very confused, I was under the impression that constant current meant constant current. Am I missing something obvious? I know an LM317 isn't the best option for CC, but it's the simplest option I had on hand.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ A schematic would really help. Obviously the LM317 is not working as you expect. Edit this post, then click on the icon that looks like schematic symbols to open the editor. \$\endgroup\$
    – user57037
    Commented Apr 30, 2017 at 6:20
  • \$\begingroup\$ @mkeith I didn't know that was available. Updated the post with a schematic. \$\endgroup\$ Commented Apr 30, 2017 at 6:30
  • \$\begingroup\$ What voltage do you measure across R2? \$\endgroup\$
    – user133493
    Commented Apr 30, 2017 at 6:31
  • \$\begingroup\$ When I started it was .33v, now (about an hour and a half later) it's at .25v. \$\endgroup\$ Commented Apr 30, 2017 at 6:38
  • 3
    \$\begingroup\$ LM317 is not suited to this problem. the datasheet reccomends minimum 4.25volts from ADJ to IN \$\endgroup\$ Commented Apr 30, 2017 at 7:03

2 Answers 2


The LM317 needs a minimum of about 3v input to output. I haven't tested this but spec is :

VI – VO = 3 V to 40 V (from www.ti.com/lit/ds/symlink/lm317.pdf)

so the regulator is pretty certainly dropping out of regulation, given that the fully charged battery voltage is 4.2v and there is 1.2v dropped across the 3 ohm resistor.

You could use a low dropout regulator e.g. LD1117ADT12TR, which is a D-pak device that should work down to about 2.5V (in-out dropout 1.1v), download datasheet at:


Regulation is not all that critical in this application, so you could probably use a reasonably high gain power transistor (not a darlington) and a couple of diodes (or 1 LED) as the regulator. You may have to adjust the resistors experimentally, depending on transistor gain, and the base-emitter junction and diode forward voltages.

R1 just has to be able to turn on transistor at low batt voltage (this current appears at the emitter) so for 400mA in the collector, the max R1 value will be a little less than $$ R_1 = \frac {(V_{BattLow} - V_{diodes})*transistor gain}{0.4} $$

R1 should be kept as high as poss without losing regulation at low batt. It needs to supply the transistor base current plus some to turn on the diodes enough to have a stable voltage across them.
It has more voltage across it at full batt voltage, so more current then flows through it. The extra current flows through the diodes, which hopefully hardly affects the voltage across them if they are already conducting well. Note that the voltage across R1 will be less if there is an additional voltage drop e.g. the 1 ohm series resistor (R2 in your circuit).

R2 sets the current limit. Use a resistor with enough power rating to run cool. $$R_2 = \frac {(V_{diodes} - V_{be})}{I_{lim}}$$

Diodes could be replaced with a suitable LED.
I'll expand on this a bit. P-N junctions (e.g. base-emitter, diode) have a fairly constant forward bias voltage of around 0.5 - 0.7v for silicon (reasonably independent of forward current once they are fully conducting). Most multimeters can measure this. Check the voltage vs. current curves on some data sheets for examples. Measure the ones you have at different currents.
For the purpose of this discussion I'll use 0.7v.
(Incidentally if you need to identify the leads of an unknown transistor, the base-collector junction is also like a diode, and generally has a slightly lower forward voltage than the base-emitter, measured at the same current).

The idea is that the transistor base-emitter junction (a FET won't work here) has 0.7v across it, the diodes also have 0.7v across them so 2 in series gives about 1.4v. (1N4007s should work ok if they are biased on with enough current through R1).
This means the base is at a constant 1.4v above the bottom of R2 and the emitter is at 1 base-emitter drop less than this (1.4-0.7 = 0.7v) so R2 has a fairly constant 0.7v across it and therefore a constant current through it. This is most of the current passed by the circuit.
A much smaller current flows through the diodes, just to forward bias them into their constant voltage state, which adds to the current passed by the circuit but is usually small enough not to matter.

The higher the transistor gain the better it compensates for changes in applied voltage and the higher you can make R1. A gain of >50 would be good (e.g. BD639).

Most LEDs also have a reasonably constant forward bias voltage (roughly related to colour) of between about 1.7 to 3.5v (I've seen voltages outside this range). To check the on-voltage, use a resistor in series with a LED (or diode), adjust the voltage applied as you measure the current through it and voltage across it. Plot the results if you want to see the curve. Find the minimum current needed to get a fairly stable voltage as the current changes. You want a low on-voltage (< 2v, infra red or red have the lowest) so that you don't run out of head-room. Note that some LEDs are designed to run directly from a battery and do not regulate V in this way. If you can find a LED with a fairly stable and low on-voltage it could be used in place of the diodes. The brightness might even give you an idea of the state of charge. I have a feeling a LED on-voltage varies a bit more with current than a couple of diodes but I'm not sure. It might work ok.

Yes, good idea to use a variable power supply for testing the circuit between 4.2 and 3V. Ideally it should still be regulating well at the lowest voltage, which means you should probably leave out the 1 ohm resistor in series. Try it and see. Try different diodes and transistors and bias currents. (The best results will be if you find a LED or diodes for which varying the diode current has little effect on diode forward bias voltage and adjust R1 to give this current range).

You will probably need a small heat sink on the transistor.

The current can be measured anywhere in the discharge circuit where all of the current is flowing (between the batt and the rest of the circuit is good). Note that the voltage across R1 will be less if there is an additional voltage drop e.g. a series resistor (R2 in your circuit), but if you take this into account when calculating R1 so it doesn't drop out of regulation at low bat, it could be useful for measuring the discharge current. 0.1 ohm would drop 40mV at 400mA, easy to convert, but the your meter needs to be able to measure 40mV accurately to useful. 1 ohm is probably a bit too high for good regulation (only leaves 2.6v for the regulator at low bat).

The voltage should be monitored directly across the battery.

The battery Energy rating is the integral of VxI with time.

The Ah rating is the (discharge current)x(time to discharge from full to empty). If you can keep I constant then you just need to measure the discharge time. If you have a way to automate these measurements into a computer then you can calculate / graph these ratings quite easily (and get it to sound an alert when the full discharge voltage is reached). As others have pointed out, many lithium batteries will begin to self destruct if discharged too far or overcharged. (Good idea to carefully read the manufacturer's specs and warnings for the particular ones you have).

Note that the discharge rate affects the available energy and Ah rating of a battery.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ To the OP: The reason I asked if you have diodes transistors etc, is that I was going to suggest you try this circuit. Basically, D1 and D2 become a voltage reference. Q1 is an emitter follower. So the voltage across R2 is mostly constant, and the current, therefore, is mostly constant. You will still need to watch cell voltage and manually disconnect it to avoid over-discharge. \$\endgroup\$
    – user57037
    Commented Apr 30, 2017 at 16:38
  • \$\begingroup\$ Thank you for this very detailed answer. When you say "suitable LED" what do you mean by that? I have tons of various color 5mm through-hole LEDs (red, green, blue, yellow, white, one or two IR and some UV ones on the way). I also have a lot of 4007 diodes. Also hope much does the transistor matter? I have several different types of transistors and MOSFETs, what would you qualify as reasonably high gain? Finally, would it be worth testing this circuit with a power supply and an adjustable buck regulator to ensure consistent current output between 3 and 4.2 volts? \$\endgroup\$ Commented Apr 30, 2017 at 20:15
  • \$\begingroup\$ One more question, sorry. I assume I should be monitoring the voltage across the battery, but where should I be measuring the current? In series with the battery and the circuit would make sense to me, I just want to make sure. I can put one meter measuring voltage across the battery and another measuring current in series. The only issue is that at >200mA I have to measure on the 20A unfused setting and I only get 2 decimal places of accuracy. \$\endgroup\$ Commented Apr 30, 2017 at 20:22
  • \$\begingroup\$ Yes, test it with a variable supply if you have one. If you don't have a good ammeter, consider putting a low value resistor in series with the battery to use as a shunt. Measure the voltage across the resistor, then calculate the current using Ohm's law: I = V/R. \$\endgroup\$
    – user57037
    Commented May 2, 2017 at 4:38

I have also had this problem with RC battery's, my solution was to discharge accross a known power resistor with a low thermal constant. Then just used an Arduino to monitor the voltage accross the resistor and print it to the serial console once per minute.

Simple in Excel or on the Arduino to convert it to power and add up the total capacity.

  • \$\begingroup\$ The current won't be constant, but you can still calculate capacity. For each measurement, you calculate both V and I. Integrate the I's during the entire discharge period. Integrate just means add up all the I's and multiply by the sampling period. \$\endgroup\$
    – user57037
    Commented May 2, 2017 at 4:40
  • \$\begingroup\$ @mkeith, yes, hence why I said convert it to power and add it up... or energy and add that up... \$\endgroup\$
    – MadHatter
    Commented May 2, 2017 at 12:50
  • \$\begingroup\$ Comment was more for the OP. Sorry. \$\endgroup\$
    – user57037
    Commented May 2, 2017 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.