Electronic – How should I select the resistors for this constant-current application for a 317

current-sourceled striplm317

Over at OnSemi, they have a little doc about using a 317 voltage-reg as a current source:
http://www.onsemi.com/pub_link/Collateral/AND8109-D.PDF

Their final example, providing constant current to an indeterminate number of strings of LED's is exactly what I'm looking for. I, somewhat, grasp how to choose the value of the "sense" resistor for each string, but they don't explain how to choose the resistor on the base of the transistor… and it's not completely clear to me what will happen if I choose a value which is too low, too high, and how to choose the optimum value.

enter image description here

Best Answer

You just need enough drive to easily sink the ADJ pin current, so the reference voltage can appear between Vout and the collector of the transistor. Because Vout is connected to the base, the transistor collector-emitter voltage will be very small since the collector must be Vref (~1.25V) lower than the base (e.g. it needs to be saturated)
This ~1.25V appears across Rsense, so it's easy to calculate the current (Vref / Rsense, or if you want be exact - Vref + transistor_sat_voltage / Rsense)

Since the ADJ pin current is very small, you don't need a small resistor. Check the ADJ pin current (which according to the datasheet is a max of 100uA)

Say you have a transistor with a gain of 100, the base current of your transistor needs to be a minimum of 100uA / 100 = 1uA. If we are conservative lets assume a minimum gain of 20 (gain drops at saturation)

So we need 100uA / 20 = 5uA into the base. We know that there will be around 1.25 Vref (plus a small amount for the transistor saturation voltage) between the Vout/R4 junction and the anode of LED1. We also know that a transistor has a drop of around 0.7V from base to emitter. So:

(1.25V - 0.7V) / 5uA = 110kΩ (at this base current 0.6V is probably a better estimate for Vbe, but it's not really important as long as we are close enough)

Let's pick 100kΩ since it's an easy value to find, and close enough. I think almost anything between e.g. 1kΩ and 200kΩ will do for a decent transistor, the current should only change by a very small amount over this range. Head toward the lower end for power transistors if you are planning on driving high current LEDs.

Note that for more than one string of LEDs, the ADJ pin current will be shared between the transistors, so you can take this into account if you wish and try higher value resistors, but since sharing will not be perfectly equal I'd stick with the simple equations above.