Digital Power Supply – Part 1: Concept


I’ve found some information regarding poor performance of the ADC and DAC of the XMEGA micros (see some info here, here, here and here). So far there are some workarounds and new devices might have fixed some problems, but I will not take this micro into account until i have clear info that it works. Another solution is to use external DAC and ADC  but this brings the cost up and complicates the design a lot. For the moment a digital power supply is not on my top necessities so it will stay on hold for a while.


There are many power supply circuits available on the internet and a lot of users who had built them. Most of the designs are analog with voltage and current limit controlling via potentiometers and there are some projects which provide a volt meter and ampere meter with a microcontroller.

I’ve built quite a few power supplies over the years; it’s an almost vital tool for electronics. It’s been my plan to built one which would drop the analog potentiometers in exchange for digital control with a microcontroller. There are many advantages to it as well as disadvantages but I believe it is worth the effort.



The specs that I wanted are listed below and they should provide some justification for the concept that I have chosen:

-Good power supply characteristics: PSRR, output noise, stability, output resistance etc. It should be at least as good as its analog counterparts. This made me choose an analog regulation loop.

-it should be easy to scale in current or voltage without needing hard to find or expensive parts (such as high voltage op-amps).

-should be able to operate from a single supply and accept input voltages in a wide range. The idea behind this is to be able to add this at the output of a switch mode power supply such as a laptop power adapter without needing additional transformers or a negative voltage.

-it should be able to operate in either current or voltage regulation and provide digital control with a reasonable resolution for both current and voltage

-digital measuring of voltage and current is an obvious in this type of design, but I will add extra computable parameters: output resistance, output power, electric charge etc.

-measure the current without breaking the ground loop

-allow the addition of other functions such as output ON/OFF,  fan control, battery charging program etc

-PC control could be easily implemented, but I see no major use for it right now.



The concept schematic for the analog part is in the schematic below. The values are not final, there may be some changes until the final design. The conept itself is based upon some of the versions that are found on line, see the references section.

I’ve used a darlington configuration (T6 and T7) for the series pass element which should be adapted to the required current and voltage. Control is made with a constant current source (T2 and T3) and by two opamps.

For the current measurement I used a ZXCT1010 high side current sensor which translates the voltage drop on the sense resistor R8 into a current through the output pin. Because its operation is limited to 20V I’ve generated a supply that will be about 5V under the input voltage with the help of a zenner diode, D1. This will power the current sensor at 5V which, with the help of T8 will pass the output current through a resistor (R13+R14) which will generate a voltage above ground that is proportional to the output current.

R18 along with R19+R20 form a voltage divider which samples the output and provides a lower voltage to the opamp and for measuring with the microcontroller. IC1A takes this voltage and compares it to a reference voltage, controlling the output to the desired value. Control is achieved with the help of the current mirror, T4 and T10 which will sink some of the current from the current source (T3 and T2) and thus provide a required output voltage. The current mirror allows the opamp to operate at a low voltage, such as 3 or 5V and not be affected by how large VIN is. The requirement is that the transistors should be capable of handling a voltage larger than VIN.

Current limitation is achieved in a similar way with IC1B. The two comparators form an analog OR, so the output is limited to either a voltage (voltage regulation) or a current (current regulation), whichever comes first.

T5 and Q2 provide a minimum load of about 10mA which should keep the power supply stable unloaded. It is a constant current load which means that the output display can be easily corrected to take it into account. The downside is that it will sink 10mA only if the output is at least 1V but I don’t consider this a flaw since I see no need for an output voltage of less than 1V.

The scalability is one of the main features of this supply. Making it operate at a higher current requires more power transistors in parallel in place of T7, along with emitter resistors for balancing. One problem with it is the higher required base current to drive them, but I suggest adding a third transistor to form a triple darlington configuration. Increasing the current from the constant current supply(T2 and T3) is not a viable option since it will require more powerful transistors for T1, T3 and T4. The sense resistor needs to be shrunk for higher current which allow for lower power dissipation and keep the voltage drop to a reasonable value.

Voltage scaling is achieved by using a different value for R18 and higher voltage transistors for T1, T2, T3, T4, T9, T10 and Q2.

The power supply for the operational amplifiers and the microcontroller will be 3.3V which should be achieved with a linear regulator since the consumption is low. PCB design will require good ground routings and a separation of analog and digital supplies, probably with a filter.



The digital control

The next key block of the power supply will be the digital – analog interface represented by both a digital to analog convertor for setting the required voltage/current and an analog to digital converter for measuring the voltage/current. I considered that 12bits of resolution should be enough, it allows for a 1mA resolution on a 4A scale and 10mV resolution on a 40V scale. 40V maximum at 4A maximum should cover most amateur usage.

From this point forward, scaling may be done by multiplying the maximum voltage or the maximum current with whole numbers as this will provide round numbers for the resolution(such as 8,  12, 16 etc amps or 80V). While there will be applications for a high current, such as 8, 12, 16A, I doubt there will be for voltages as high as 80V.

The microcontroller of choice which makes this power supply design so easy is an XMEGA from Atmel. I’m currently looking at an XMEGA32A4. I haven’t used any from the XMEGA family before but some of them have some features that makes them perfect for this design: they’ve got a 12bit dual output DAC and a 12bit ADC with 10 channels. It’s price is also one of the main selling points, as it is not that much more expensive than a lower performance ATMega32.

So, in terms of IC’s for the whole design, the number will reach the astronomic value of 3: a microcontroller, a dual opamp and the current sensor. That’s it. It will simply not be more complicated to build than an analog version. Well, the design is more complicated, but replicating it is not.

More efficient

The direct solution is to power this PSU from a transformer, like many other designs. The bad thing about it is that there will be a high power dissipation at low output voltages on the series transistor. To address this issue, I will power this PSU from a switch mode power supply that will be modified to track the output voltage. This means that it’s output voltage will be just a few volts higher than the output voltage of the analog power supply. This is easily achievable since most SMPS have a circuit with an optocoupler that controls the output.

My goal would be to make a simple hack for a computer ATX supply. It’s rather easy to modify one to  get more voltage out of it, such as 30-40V and has the advantage of a low cost.

Issues to address

I still have some issues to address for the concept. The first one is the display which I would like to be a regular 16×2 alphanumeric with a HD44780 or compatible controller. The problem is that they require 5V logic levels to be controlled and the microcontroller will operate at 3.3V. One simple solution is to use a level converter, the other one is to use a 74HCT595 shift register which would accept 3.3V logic levels when powered at 5V. There is still greater flexibility because if I will not mount the shift register on the supply board but on the display board this will allow practically any kind of display, even the use of 7 segments giving somebody else great flexibility in choosing whatever display they need.

SMD or TH is the second issue. For a 4A and 40V version of the supply things can get really small and the whole board done with only SMD components should be small enough to fit on the back of the LCD without the power elements (series pass transistor, filter, rectifier).

Additional notes

The microcontroller of choice provides an internal reference of 1V that is accurate enough to be used. This means that the DAC will output a maximum voltage of 1V and the ADC accepts a maximum input voltage of 1V.

The opamp supply is 3.3V. Input range should be 0 – 1V. Output range should be 0 to 2V at least. A 5V supply allows regular opamps such as LM358 to be used. For the time being I’m settled on a MCP6022 which provides 500uV offset that translates into 20mV error for the desired voltage and 2mA error for the desired current which I find  acceptable.

I’m thinking of replacing R25 with a constant current source which should generate a less noisy supply for the ZXCT1010.

The current sensor ZXCT1010 is a better version of the ZXCT1009 and provides better measurement by having a lower internal offset.

TP8 and TP7 will be connected together at the power supply output connector to minimize the effect of the wires. I am thinking of adding a relay at the output to be able to disconnect the circuit or I might achieve an ON/OFF function by changing the required output voltage to 0V. I have not made my mind on this.


Measured parameters

I’ve simulated the design and done some preliminary simulation measurements for some parameters just to give an idea of the performance of the analog part. All measurements are at 27° C and 30V input.

Output resistance is about 1.2mohm for Vout=10V, load changed from 10mA to 1A, stabilizing time 100us. (voltage dropped about 1.2mV  when load was connected).

PSRR with 10V output, 100mA load and just 100n filter capacitor for C4 is about 89dB at 100Hz. Other values are: PSRR=70dB@1kHz, PSRR=52dB@10kHz, PSRR=46dB@100kHz.



The Circuit Cellar design is one of the oldest I know of a digitally controlled power supply and provided a good starting point. It’s a lot more complicated than my design because I have the benefit of better parts.

Other good designs of power supplies which provide at least current and voltage measurement:

A very well built design by Sylvain Bissonnette which provides digital measurement only.

A digital control design by Guido Socher who also has a version with fulld digital feedback.

Elektor has a design which uses filtered PWM. (hosted on avrportal but built with a PIC):

Another supply that uses filtered PWM for refference. It seems to be an improved version of the Elektor design that dropps the extra circuits for a bigger microcontroller.


Next part

I’ll try to build a prototype of the supply in the following weeks and test it. After that I will provide a complete design.

Be Sociable, Share!
4,998 views since Nov 2016

17 comments to Digital Power Supply – Part 1: Concept

Leave a Reply to Richard Sharpe Cancel reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>