depending on the voltage divider on the reference pin determines the voltage out... how is that resistance produced digitally?

I am assuming the question is:-I have a reference voltage on a LM317t an adjustable voltage regulator. Currently in my circuit it is produced by a potential divider, how can I make that reference voltage variable under the control of an arduino. Will PWM help?

In which case the answer is yes, remove the potential dividor and feed the PWM into an RC filter to smooth it, this will then produce a variable voltage you can then apply as a reference to your LM317t .

An LM317 has a Max 100uA Iref or reference current and unless the OP needs need a really fast response could be filtered with a 10K resistor and a 220nF cap. It's a voltage source essentially. Do remember to filter the output of the '317, there's a lot of gain in that small package. I've enclosed a data sheet on that part.

I would first use a transistor to generate a PWM signal based on the output of the regulator, before filtering it and applying to Vref. This is so that you get the feed back from the output to get a good voltage regulation.

I would first use a transistor to generate a PWM signal based on the output of the regulator, before filtering it and applying to Vref. This is so that you get the feed back from the output to get a good voltage regulation.

I'm basically with G_M here. His ckt should give a voltage output in the range of Vref[LM317] = 1.2V minimum to 5V+1.2V = 6.2V max.

The answer will depend on if you wish to change the output voltage digitally and if you require low ripple. pwm + a filter will provide a variable voltage but it also provides ripple that gets passed onto the output un-attenuated.

This is where a digital pot / dac would be very helpful to achieve low ripple output.

for the current requirements, an Arduino will supply enough current for control with passives, 2 RC low pass filters should reduce the ripple to virtually 0. One low pass on the input to an op-amp for voltage scaling and one on the output of the scaling amplifier. The Arduino however can't supply enough voltage to get more than 3.8 V from a 5 V source using an LM317. I would have to repeat Mikes suggestion about digipots And a scaling amplifier as the digipots have a Vcc restriction @ 5 V... due to the input parasitic diodes inherent in the chip. Were it Me I'd use a switcher and control the voltage output with a digipot, No linear loss to contend with and really easy to clean up with a very simple Pi section filter... I'd use a 100 uHy Choke and 2 22 uF caps. The only real consideration would be the current requirements... The output filter might not be required... If you aren't doing any analog sensing then any noise from the switcher is a "don't care" thing because the typical "Noise" from a switcher is ~100 mV which is well below the switch threshold for CMOS logic. The 317 is a nice OLD device and when it was made there were no easy to use switcher IC's available... There are devices that are smaller than an LM317T (TO-220) device and require minimal heat-sinking unless you require full current capacity with high duty cycles, then a simple copper "Tab" soldered to the switcher PCB and bolted to a small heatsink. I used a similar method to control a UHF tranceiver's transmit power output power in the early 2000's by sensing the output power and controlling the switcher for required output power, in exactly the same manner as I described above.

Bob

--> WA7EMS "The solution of every problem is another problem." -Johann Wolfgang von GoetheI do answer technical questions PM'd to me with whatever is in my clipboard