How to replace a potentiometer

Hello everyone!

I am trying to figure out how to replace a potetiometer with an "-" and "+" button.

The circuit is for a variable power supply. I would like to take a 24v 1A constant power supply and use the arduino uno to control a lm317 circuit with a digital pot. OR modifying an existing variable power supply. Problem is that out of all ive read it looks like I cant use the shields and break out boards that I can find on the web because they can only handle a current of 5v and under.

I am nowhere near proficient in electronics and this is my fist venture with the arduino. So I might just be missing some info, but I've noticed how capable the arduino is and know its possible.

Hi,

Here's one possibility:

See the page with details HERE.

FREE LM317T's! anyone who sends me a self-addressed stamped envelope will get a couple of LM317Ts. Anyone who says they will do some electronics / Arduino with young person(s) will get 10!

Terry King
152 Colby Road
West Topsham, Vermont 05086

Here's one possibility:

See the page with details HERE.

That was actually a good read. Did open up some doors. But it left me with a more questions. So the IC That isn't named a LM358? Some comments were saying that the circuit doesn't actually work. From what i understand about the LM317 is that it needs at least 1.5v to operate, so my minimum voltage is 1.5v right? so if I'm supplying 20v is my maximum voltage 18.5v?

Last question, Can I PWM with analog pins?

"Last question, Can I PWM with analog pins"

analogWrite only works with pins 3, 5, 6, 9, 10, 11.

Hi terryking228...

surely your circuit wiill only work if the opamp can swing -ve => so needs a -ve supply...

otherwise the lowest output will be + 1.24 volts...

And the pot chain driving the -ve input of the opamp should go to the output - , not the adj pin on the lm317....

And if you don't want high current, why bother with the LM317 at all ? - a plain opamp will do the job.... and will sink as well as source current.

In fact if you just want a tiny current, just a R-C net....

regards

Allan

I'd use an LM358 and if I want the supply to go lower than about 2V, I'd add a negative supply voltage. As little as -3V will do.

A modern RRIO Op Amp will work great in this circuit.

The LM317 can only go to within 1.5V of the input voltage. So if you give it 24V, it can only put out a maximum of 24 - 1.5 = 22.5V. The LM317 can accept up to 37V input, but you must make sure you have adequate heat sinking for the power dropped.

Worst case is actually at the lowest voltage output, because most of the voltage is dropped across the LM317 and therefore most of the power dissipated. So with 24V in and 1.25V out into a 1.25 ohm load, 1A x 22.75V = 22.75W.

For that, I'd suggest a reasonably large heat sink and fan.

The time constant Tc of 1M ohm and 0.1uF is 1x10^6 x 1x10^-7 = 0.1s
To smooth a PWM signal, the Tc should be at least 5 times the time between pulses. The Arduino puts out 490Hz PWM (980Hz from some models), which is about 1/500 = 2ms. So this should be plenty of smoothing.

The LM358 can run from up to 32V single supply, so 24V input is fine. You'll need to scale R2 and R4 to match 5V max PWM output to 23.5V max LM317 output. Just calculate as if R2 and R4 were a voltage divider so that when 5V is at the junction of the two resistors, the output of the Op Amp is Vmax - 1.25V (pin Vadj of the LM317 is always 1.25V lower than Vout).

I do see the PWM symbols on the pins that you mentioned. But my question is, since you have to anologWrite to digital pins, can you PWM or, use LM358, on anolog pins like A0-A5?

Polymorph, did you know that there is a type of plastic named after you?! lol. But thank you for clearing that up for me. I completely understand the circuit now and even drew it out on some software.

Now, I have to ask... Is this the best choice for me then? Because I did read in an old post on someone buying a cheap DC-DC buck converter or something like that and it had a potetiometer or two for dialing in the output voltage and wanted to replace it. The posts stopped and the topic never got concluded so I don't know if he got it figured out or working. But it would seem like an inexpensive way to go.

analog pins A0 to A5 are inputs to the analog mux, one channel of which goes to the A to D converter.

3,5,6,9,10,11 have timer/counter behind them that allow behind the scenes PWM signals to be created without any code involvement once they are set up.

CrossRoads:
analog pins A0 to A5 are inputs to the analog mux, one channel of which goes to the A to D converter.

3,5,6,9,10,11 have timer/counter behind them that allow behind the scenes PWM signals to be created without any code involvement once they are set up.

Thank you for clearing that up for me. That actually makes sense.

I tried to draw out that circuit with the program Fritzing. I’ve used it for other stuff but this schematic looks really sloppy for some reason. I couldn’t get the parts to line up properly. Anyways, the Op-Amp looked different than in the original circuit. Is this still right?

No
see post 2 amd my comments in post 4

TheMunkee:
I am trying to figure out how to replace a potetiometer with an "-" and "+" button.

Buttons are ok - depending on whether you want your system to work with a 'memory', so that in the event of a power-down, or a power-glitch, or anything similar, your system will remember what it was set to before the power issue. Otherwise, it might be necessary to just start (or restart) the system with default values.

There's eeprom in most arduinos to save values over a powerdown...

regards

Allan

EEPROM can stay in place thru reprogramming also if the EEPROM bit is correctly programmed.
Atmega328P example, high fuse byte:
EESAVE, bit 3. EEPROM memory is preserved through the Chip Erase. Default: 1 (unprogrammed), EEPROM not reserved.

Southpark:
Buttons are ok - depending on whether you want your system to work with a 'memory', so that in the event of a power-down, or a power-glitch, or anything similar, your system will remember what it was set to before the power issue. Otherwise, it might be necessary to just start (or restart) the system with default values.

You are completely correct, and this was an issue I was going to have to figure out eventually. I"ve heard mention of EEPROM and having shields that can add memory capabilities to the arduino, but that's as far as my knowledge goes.

Anyways, Allan, 1.25+V is good for me, I don't need it to go any lower. That is why I didn't see the need for a negative power supply. Is there still something else wrong with it?