# Adjustable constant current source using a lm317

I am looking to provide constant current source, I am using a LM317 right now and it seems to be doing the job just fine. however I need to switch it between 2 or 3 different current levels. I can not seem to find any information on this or figure it out(I cant help but think I am missing something simple)

It needs to be switchable with a 3v3 micro controller, and the voltage coming out of the current source may need to be higher then 3v3(up to 5V depending on current selected).

Can anyone help me out or point me in the right direction.

• Do you have a power source greater than 3.3 Volts (actually, greater than 5 Volts) available, for sourcing the up to 5 Volts requirement? Please keep in mind that even with a 5 Volt source, the current regulation will cause some voltage drop. – Anindo Ghosh Apr 19 '13 at 15:21
• @AnindoGhosh Yes I am allowing for the drop – jkozlowski Apr 19 '13 at 15:25
• Should the current source provide current to a load that is grounded? How much current might the load require? What resistance is the load and what dc voltage can the circuit operate from? – Andy aka Apr 19 '13 at 16:21
• @Andyaka Current would need be in the range of 50-200ma the resistance of the load would be about 20 ohms. The voltage source is 6v. – jkozlowski Apr 19 '13 at 16:27

One way to handle this would be to divide the current-setting resistance into 2 or 3 values in series, and use relays or optoisolators (depending on the magnitudes of the currents in question) to short 1 or 2 of them out as needed.

For example, this Toshiba TLP176A(F) has an on-state resistance of just 2Ω and can handle 400 mA.

simulate this circuit – Schematic created using CircuitLab

However, at the current levels you're talking about, perhaps reed relays would be a better answer.

• could you expand a little on the optoisolator method? a quick example or basic layout – jkozlowski Apr 19 '13 at 16:14

## protected by W5VO♦Apr 20 '13 at 0:27

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).