Adjustable voltage regulator (LM317T) with Arduino (328P-PU)

Thread Starter

EzDaddy

Joined Oct 26, 2017
2
Hey Guys!
I decided to modify and old PC ATX Power Supply and use Arduino to show me the voltage output. I put in some banana plugs in different colors to give me 3.3V, 5V, -5V, -3.3V and -12V up to 12V (typical ATX voltages). Kinda like a Lab Power Supply.

Now I dedided to modify this thing to use the 12 V Output to give me constant voltage ranging from 1,5V to 12V. So I bought a LM317T, which handles it quite well. I put Arduino reading the voltages using a simple voltage divider circuit. Easy enough. There are 100eds of Tutorials on how to use the Arduino ADC this way. And the Lm317 Datasheet also gives some suggestions.

Long story short:
the circuit is working. I can adjust the voltage with a potentiometer (5k). I use Proteus to simulate the whole thing before putting it on the breadboard.
it doesn't bother me much that the voltages in Proteus are off (output goes from 1,5V to 13V) :-D and in the real circuit it ranges from about 1,5V to 10,70V. I'm fine with that as well.Circuit.png

Besides... I'm planning on modifying this whole circuit to be able to adjust the desired Output Voltage with my (barebones 328p) arduino (maybe some buttons or a rotary switch or sth).



So here are my questions:

HOW MUCH CURRENT will this circuit be able to supply? The LM317 Datasheet says it can handle "more than 1.5A".

And would you guys recommend a digital potentiometer (like the AD5204 or AD5206) and replace the potentiometer (RV1) in this circuit with that one (so i can control voltages with the arduino)?

Possible alternative would be the following (i guess):
From the LM317 Datasheet:

LM317 Digital interfacing.png

For this I have a few TIP120 Transistors or a lot of 2N3904.
What do you guys think?
 

OBW0549

Joined Mar 2, 2015
2,985
HOW MUCH CURRENT will this circuit be able to supply? The LM317 Datasheet says it can handle "more than 1.5A".
There's no way to even guess how much "more than 1.5A" the regulator can pass. Safest bet is to not count on getting any more than its specified maximum output current.

And would you guys recommend a digital potentiometer (like the AD5204 or AD5206) and replace the potentiometer (RV1) in this circuit with that one (so i can control voltages with the arduino)?
No.

If you look at the AD5204/AD5206 data sheet, you'll note that it operates from a 5V supply, and that the voltage on all three potentiometer terminals MUST lie between ground and the supply voltage to avoid damaging the part. You cannot go outside that range, ever.

Two digital potentiometers that could be used, though, are the AD5290 (256 adjustment steps) and the AD5293 (1024 adjustment steps), which can operate with higher supply voltages.

Possible alternative would be the following (i guess):
From the LM317 Datasheet:

View attachment 138030

For this I have a few TIP120 Transistors or a lot of 2N3904.
What do you guys think?
Ugh. Too crude.

The TIP120 are Darlington transistors have a saturation voltage of nearly a volt. The 2N3904's could work, but even though their saturation voltage is less than a tenth of that, that's still more error than you might want. A low-current MOSFET like the 2N7000 would be a better choice for that circuit.
 

Thread Starter

EzDaddy

Joined Oct 26, 2017
2
Thanks for the quick reply. And for your help.

If you look at the AD5204/AD5206 data sheet, you'll note that it operates from a 5V supply, and that the voltage on all three potentiometer terminals MUST lie between ground and the supply voltage to avoid damaging the part. You cannot go outside that range, ever.
Oh! That could have gone wrong. I didn't notice that. I was about to buy that thing! Thanks.
I went to my local hw store, but they don't have it. I ended up ordering the AD5262. It's similar and even a little cheaper. And it also does 256 Steps. That's going to be more than enough for my application.

I was thinking on using a rotary switch to select the desired voltage on the display.

Planning all this I ran into another problem.

How can I store "my last position" each time I rotate the rotary switch?
The Arduino EEPROM would be a solution, but each write will decrease the limited lifespan of it. I would prefer something less limited.
But I can't seem to find anything.
SD Card would be kinda overkill :-D

Do you have any suggestion?
 

philba

Joined Aug 17, 2017
959
I wouldn't worry about eeprom lifespan too much. At least do some math to have actual numbers.

Every thing has a lifespan, even the SD card you mentioned.
 

philba

Joined Aug 17, 2017
959
If you are totally banging the EEPROM, you can do simple things like delayed updates. Wait for 60 seconds before updating the EEPROM after a change is made. That gives you 100,000 minutes of knob twiddling at minimum. If you want to be totally AR about it, implement a way to sense power down and use a big fat cap and diode to act as a short term battery for the arduino. Sense the power being turned off and write the EEPROM. Cap size is dependent on power draw and how long it takes to detect the event and write the EEPROM. I'd target twice as long as you need. Then you are good for at least 100K power cycles.
 
Top