Best way to digitally control lm317 based constant current driver - Page 1
Forum section: electronics / beginners

author: rwgast_lowlevellogicdesin
author_rank: Frequent Contributor
timestamp: January 01, 2013, 08:47:54 pm
content: So ive been working on a battery charging project, and with some help I got in another thread I have sucesfully built a simple lm317 based charger wich will charge my 16 cell nimh pack at 240mA for 12 hours or so. Right now im just simply using a 1/2 watt 5 ohm resistor between the output and adjust pin to set the current level. I would like to be able to use a micro to digitally set the amount of current this circuit uses. The only way I can really think of is to use a digital Pot. I have a few ds1806 pots and an AD5220. I couldnt find the amount of wattage the ds1806 can handle in the data sheet, and looking at the AD5220 data sheet it would appear to me it can only handle load in the micro watt range... im not sure though. So what would be the best way to do this??

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: January 01, 2013, 10:11:44 pm
content: Hi,Here is a way that you make the LM317 current source adjustable. I used the LT1117 in the LTspice model for convenience.Here is the original circuit:Here is the modified circuit:A voltage is developed across R3 which reduce the voltage needed across R1. The voltage across R3 depends on the current sink Q1, U2 and R4.If the voltage on positive input is varied from 0-1V the current limit is reduced from 250mA towards zeroThe 0-1V signal can come from a DAC or a PWM output, with suitable filtering.Note:this circuit only works if the output voltage is greater than about 3V.I have attached the LTspice models.Jay_Diddy_B

author: Bored@Work
author_rank: Super Contributor
timestamp: January 01, 2013, 10:24:54 pm
content: Oh dear, a programmable LM317 current source ... The thing with making the LM317 into a programmable current source is that you have to throw in more parts than what you'd need if you just build a voltage to current converter with a beefy transistor.It is almost ironic that the solution presented above in fact adds a voltage to current converter (used in turn to add some voltage via a resistor inside the LM317 feedback loop).Instead of letting the V/I converter drive the LM317 feedback loop one could let it drive a beefy transistor. And that is in fact what many have done here by just building Dave's Dummy Load (the Dummy Load plus a constant voltage makes a current source).

author: rwgast_lowlevellogicdesin
author_rank: Frequent Contributor
timestamp: January 02, 2013, 03:22:08 am
content: Hmm well im not the greatest at analog electronics here still learning, the posted solution seems to be alot more effort than this is really worth... for this project, if I were making a standalone programmable charger id definitely figure out the circuit above and use it. I was thinking maybe there would be a simple way to throw a digital pot in there with a transistor or something, it doesn't even need to be a FET as a 2n222 provides more than enough current. I try to stay away from opamp circuits where ever possible, this is my rule until I have time to sit down with a good book and really understand opamps!