Go Down

Topic: Digitally Controlling an LM317 (Read 4 times) previous topic - next topic


I am trying to use the Arduino to run the brains of a digitally controlled power supply. I'm using an LM317 regulator as the heart of the system, but I am having trouble trying to control it without a physical potentionmeter.

My input voltage to the regulator is 20 volts. I am using a MAX548 8-bit digital to analog converter controlled by the Arduino to go from 0 to 5 volts. I'm taking the output of the MAX548 and feeding it into an LM324 op-amp with a gain of 4. The output of the op-amp is shifted so it ranges from 0 to 20 volts. I have tried taking the output of the op-amp and feeding it directly into the adjust pin of the LM317, along with a 240 ohm resistor connecting the output of the LM317 to the adjust pin, as shown in the data sheet. Using this configuration, interesting results are produced. The LM317 outputs about 12 volts as long as the value going into the DAC is ~< 135. Once it passes 135, the LM317 output voltage slowly rises as expected until it reaches ~18 volts (which is right where it should end, considering the voltage drop of the regulator).

What can I do to get the lower range working? Any other ideas on how I should approach controlling the lm317? I've tried using various different resistor values coming from the op-amp to the adjust pin, but that hasn't had any effect.


Maybe skip the DAC and op-amp thing, and get a digital pot (or two)?  Maxim has several, including I2C and SPI interfaces.  I seem to recall there's an Arduino tutorial on using a digital pot.



Just for any other people searching for something later on, I resolved this issue. Turned out that I had the pinout of the lm317 wrong, much to my embarrassment and frustration. This set up works perfectly, it outputs ~2 volts to ~18 volts controlled via the arduino.

kg4wsv, I would have used a digital pot, but I couldn't find any that supported a high enough current running through it to drive the adjust pin at a high voltage.


I would have used a digital pot, but I couldn't find any that supported a high enough current

I didn't realize the currents on the digital pots were so small, but the first one I looked at (DS3502) showed max wiper current of 1 mA, and the LM317 data sheet shows a max Iadj current of 100 uA, so it looks like you're covered by a factor of 10 with that example.

Anyway, sounds like an interesting project - good luck!



This is pretty interesting. Would it be possible to do pwm to create an analog out on the arduino and then use that to control the lm317 ? This could be a nice little digital power supply. Any possibility of sharing you schematic ? Just want to see how you hooked everything up.

Go Up