# Adjustable Power Supply with precision steps

Discussion in 'The Projects Forum' started by lmagalhaes, Mar 23, 2016.

1. ### lmagalhaes Thread Starter New Member

Mar 23, 2016
4
0
Hey there,

I'm trying to build an adjustable power supply, which works between 0.8 and 5V, to drive some loads up to 100 mA. The catch here is that I want precision steps, which means that I need to jump from 0.8V to 0.9V, etc. The control of the output voltage is done with a microcontroller, for now an Arduino Uno, using an encoder. This is proving to be a not so great idea for several reasons.

To achieve the adjustable voltage output, I'm using an MCP1825 voltage regulator, the Arduino Uno with it's ADC, a rotary encoder, a MCP4922 12-bit DAC and a couple of resistors. The idea is to have the two resistors of the voltage divider of the adjustable pin of the voltage regulator, R1=10k Ohm and R2 = 1k Ohm and then have a third resistor connected to the adjustable pin and the output of the DAC, R3 = 1k Ohm. This setup leads to the following:

Vout = Vadj * (1 + R1/R2) + (Vadj - Vdac) * (R1/R3)

The expression allows me to determine the output values of the DAC to use.

There are many problems with this setup:

1) The circuit is implemented in a breadboard with jumper wires, adding a lot of noise. The output of the DAC is noisy, making the output of the voltage regulator noisy as well. I've tried adding 10uF electrolytic capacitors to the input and output of the voltage regulator, to the voltage input of the DAC but nothing worked. I'm using the 5V pin of the Arduino as the voltage reference for the DAC, but maybe that's not the best idea either. I've ordered a voltage reference IC to have a more stable reference, but don't know if it's going to be enough.

2) The output of the voltage regulator is not precise enough, mainly due to the Arduino ADC. For lower voltage values, the Arduino can detect that the output is not what it should be and adjusts the DAC accordingly. But with an increase in the output voltage, the reading error gets bigger and bigger, leading to output voltage errors of up to 80mV. Since the objective is to have 100mV steps, having 4.36 V going to 4.48V is not acceptable, even those values aren't acceptable. I've ordered a 14-bit ADC, the MAX1416, but I'm afraid to be missing something that would lead to these errors and that even with a better ADC they wouldn't be solved.

3) The voltage divider used means that the DAC voltage output values are (roughly) between 0.3V and 0.7V. Even if it's a 12-bit DAC, it doesn't have enough resolution to work properly with a such small range. I'll be changing the value of the R3 resistor to 10k Ohm, which will improve drastically the "useful" range of voltage outputs of the DAC. Is it necessary to order a DAC with more resolution or just increasing this "useful range" is enough?

I appreciate any feedback on this circuit and how to make it work correctly with the precision output.

Thanks,

Luís

2. ### TheButtonThief Active Member

Feb 26, 2011
219
38
Do you have a circuit diagram?

3. ### lmagalhaes Thread Starter New Member

Mar 23, 2016
4
0
I don't have a schematic in hand but I have something close to it:

I'm using this way of connecting everything. This is a representative schematic, I'm not using that voltage regulator nor all of those components. Also, I have the output of the DC-DC connected to an ADC channel of the Uno.

Luís

4. ### AnalogKid Distinguished Member

Aug 1, 2013
4,708
1,301
Your circuit will have a logarithmic relationship between the DAC code and the regulator output. If you want a linear relationship, it would be better to use the DAC output as the regulator reference.

ak

5. ### lmagalhaes Thread Starter New Member

Mar 23, 2016
4
0
Why will it have a logarithmic relationship between the DAC code and regulator output?

6. ### AnalogKid Distinguished Member

Aug 1, 2013
4,708
1,301
Ohm's Law and the equation for the value of resistors in parallel. You show the DAC as sinking a varying amount of current through R3 to GND. This places R3 is in parallel with R2. I agree that increasing R3 should improve your adjustability, but when the feedback loop is closed, the voltage at the input to the regulator always will be 1.25 V.

ak

7. ### ronv AAC Fanatic!

Nov 12, 2008
3,404
1,490
http://www.microchip.com/forums/m688260.aspx
You can place a pretty big cap on the adj pin to ground for the noise.

8. ### lmagalhaes Thread Starter New Member

Mar 23, 2016
4
0
My major problem is that I want a 0.800 V output voltage, not 0.81 or 0.823. And when it needs to go to the next step, it has to go to 0.900 and not 0.91 or 0.924, which is what is happening right now.

9. ### crutschow Expert

Mar 14, 2008
13,509
3,385
The MCP1825 is a linear regulator but you show and reference a DC-DC converter.
Which is it?

What is the nature of this "noise"?

Note that if you use voltage feedback from the output to control the DAC (and thus the output voltage), then you have a potential instability due to phase shift in the feedback signal.
This would require phase compensation in the feedback loop.
Perhaps that is what is causing your noise.

What type of feedback program are using?
It should be some type of PID or Fuzzy Logic loop for stability.

If your load is 100mA maximum then you can just drive the load using a BJT emitter follower directly from the DAC output.
That would give you the full resolution of the DAC.

10. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,442
1,628
To get the 0.0005 volt resolution you desire to insure that x.000 volt output you need a minimum of 10,000 steps between zero and full scale. A 14 bit DAC covers that and then some, but leaves out the wobblie reference of your regulator. So even with the correct DAC (and do note the MAX1416 is a ADC not a DAC) you should expect calibration issues.

That is one tough spec to obtain.

Your breadboard should work as you are using low frequency signals. Just look how the grounds connect between the micro and the current output: do Jan them at but a single point so digital noise goes one way and analog noise the other. The DAC goes smack dab between these domains.

11. ### AnalogKid Distinguished Member

Aug 1, 2013
4,708
1,301
Time to lower your expectations. If the voltage regulator has a 2% tolerance reference, that is 2% of its value, usually 1.25 or 2.50 V. Best case, that is +/- 25 mV error, not counting everything else in the control loop with component value tolerances. Also, you might have a 12-bit DAC, but unless it has a reference with a tolerance of less than +/-0.024%, you are not getting 12-bit effective resolution at the output. And finally, if you are closing the regulation loop by monitoring the output with an A/D, that converter has its own quantizing and reference tolerance errors.

With either a calculation routine or a lookup table you can get the DAC codes close enough to the perfect values, once you accept that the 2nd and 3rd decimal places aren't real.

ak

ErnieM and ronv like this.