This article describes a rather nice solution for building a current- and voltage- controlled benchtop power supply using a DC supply in the range of 20-30 volts and some additional down-regulation circuitry, with current and voltage control provided by an AVR microcontroller in a feedback loop.

I like the idea, and I'd like to build my own, but I think the interface is a bit kludgy, so I'd like to improve on it. Unfortunately, although they sell a kit, they don't provide schematics. I understand about half to two thirds of the concepts they describe when it comes to power regulation - certainly not enough to build one myself - and the circuit diagrams they publish aren't complete.

Can anyone point me to some resources to get me started on building this myself? Ideally, I'd like schematics that incorporate most of the analog side so I can modify them in a fairly straightforward fashion to incorporate the microcontroller, since my knowledge of analog circuitry and power regulation isn't great.

Also, the linked project shuns existing regulators in favor of a lot of discrete components. Are there more integrated solutions that would simplify the design, without sacrificing features?

  • 2
    \$\begingroup\$ Here is a video series about exactly this. It's a bench power supply with CC/CV, controlled by an Arduino-compatible AVR, using integrated regulators. I wouldn't call the design simple, though. \$\endgroup\$
    – exscape
    Commented Mar 6, 2012 at 7:00
  • \$\begingroup\$ This is a link to the same thing, but on his site and includes other resources: eevblog.com/tag/powersupply \$\endgroup\$
    – tyblu
    Commented Mar 6, 2012 at 7:30
  • \$\begingroup\$ The chapter on power supply design in AoE is pretty good for basic analog understandings, including 3- and 4-terminal linear regulators. It's coverage of SMPS is poor, and many of today's 'advanced' regulators weren't around at the time of publication. \$\endgroup\$
    – tyblu
    Commented Mar 6, 2012 at 7:42

3 Answers 3


There are two possible ways to go here: linear regulator vs switcher, aka SMPS (Switch Mode Power Supply).

This is the old school solution, and for a variable power supply has 1 major drawback: power dissipation. If you have a high enough input voltage to supply 25V out (e.g. 27V) you'll have to dissipate a lot of power if your output is set to 1V and you draw 1A. Dissipation: 26V x 1A = 26W. There's nothing against integrated regulators like the LM317. This can provide 1.5A from 1.2V to over 30V. The LM317 works by setting its output voltage to 1.2V higher than its adj input. So all you have to do is take a DAC and place its output to the adj input of the LM317. Most DACs don't output high voltages like 30V, but that can be achieved by placing a simple opamp amplifier between DAC and LM317:

non-inverting amplifier

About the internal dissipation. The LM317 exists in the old TO-3 package, which, when mounted on a decent heatsink, will allow for a dissipation of few tens of Watt. But you can make it less wasteful. If you have a transformer with several taps for different voltages, you can switch with relays between input voltages depending on the required output voltage. That's something which can be done automagically, since you're using a microcontroller after all.

To control current limiting you could use high-side current measurement:

high-side current measurement

You can use an ADC to convert the measured analog value to digital, and compare it in the microcontroller with a set value; if it exceeds this value you can switch off the output. You would have to reset the power supply to activate it again, doing this automatically won't work because it would oscillate between shut-off and overload.
Alternatively you can do the current limiting outside of the microcontroller, by using a comparator to compare the measured value with a set value (output from a second DAC). The comparator can then pull the adj input of the LM317 low when there's an overload.

A SMPS solution in general has a much higher efficiency than a linear regulator, but is always optimized for certain input and output voltage and a given output current. If you use a SMPS with a variable output the efficiency may be up to 90% for the optimal output voltage but drop to 60% or lower at very low output voltages. PCB layout is also critical, both for the efficiency and EMI (ElectroMagnetic Interference).

Especially if you can find a transformer with several outputs I would go for the linear approach.

Since you've little practice with analog electronics I think it's best to start with a microcontroller board and build on that, step by step. Arduino is the word of the day, but I don't know how they are with analog in and out.
You rightly say that the user interface of the tux-dingus leaves a lot to be desired. I would use a rotary encoder to set the voltage. You could make it dynamic, i.e. fine steps when turning slowly, bigger steps when turning fast. You could use a second encoder to set the current limiter, or use the same, and switch between modes by pushing it (most rotary encoders are combined with a push-button). This way and with a DAC you can already create an analog voltage; this will ease the next step of bringing in the real power parts.

  • \$\begingroup\$ How would I do current monitoring and control on a simple linear setup like you describe? Do you have any links to resources with more details? \$\endgroup\$ Commented Aug 15, 2011 at 10:56
  • \$\begingroup\$ @Nick - I added a section on current monitoring/limiting. I only have this concept in my head, but I'll try to draw out some details of it later. \$\endgroup\$
    – stevenvh
    Commented Aug 15, 2011 at 11:12
  • \$\begingroup\$ This looks promising, thanks. I'd feel more confident if I could find an integrated design that uses this, since I feel like anything I design myself is going to be substandard, if it even works at all. \$\endgroup\$ Commented Aug 15, 2011 at 11:31
  • \$\begingroup\$ @Nick - I've edited the answer in function of getting started step by step. Let me know which part you'll have the most trouble with. \$\endgroup\$
    – stevenvh
    Commented Aug 15, 2011 at 15:53
  • \$\begingroup\$ Thanks. The interface is the bit I have no trouble with - I'd planned to use two rotary encoders as you suggest, as well as a larger graphical LCD. On further reflection, though, the rest is less complicated than I'd thought - the use of the LM317 removes most of the analog electronics I'm unfamiliar with, leaving me with just the op-amp and the voltage monitoring to figure out, which I'm positive I can find plenty of information on. Thanks! \$\endgroup\$ Commented Aug 15, 2011 at 22:46

Here is a more sophisticated way to do it, and more design information is available. You won't need the power-factor correction with your lower power level. You can get more information from the Microchip forums.

  • \$\begingroup\$ Thanks, this does look useful. The information provided is all pretty high level, though, and I don't have the knowledge to fill in the gaps. Even the diagrams that show individual components exclude values and part numbers, and it seems likely they omit the passive components required, too. \$\endgroup\$ Commented Aug 15, 2011 at 11:03
  • \$\begingroup\$ Oops, there are app notes with significantly more detail. I'm trying to find one that covers my situation (variable voltage, and selectable voltage or current limit). \$\endgroup\$ Commented Aug 15, 2011 at 11:09
  • \$\begingroup\$ AN216, "DC/DC Converter Controller Using a PICmicro® Microcontroller" seems to come closest, but still leaves me with a lot of implementation questions. \$\endgroup\$ Commented Aug 15, 2011 at 11:29
  • \$\begingroup\$ @Nick don't expect us to give you your whole project for you. If you have questions about a design, open up a new question and ask specific questions and we will gladly teach you have to fill in the gaps. \$\endgroup\$
    – Kellenjb
    Commented Aug 15, 2011 at 12:52
  • \$\begingroup\$ @Kellenjb Understood - but I was hoping someone would point me to a project not dissimilar to the one I linked to, that I could adapt for my own purposes. Synthesizing something myself from fairly basic components is beyond my current analog circuit expertise. \$\endgroup\$ Commented Aug 15, 2011 at 13:51

If you have a regulator with a fixed reference voltage, you can adjust the output voltage simply using a programmable potentiometer. For example, a MAX5387LAUD+ will let you vary the resistance between 0 and 10k in 256 steps using I2C control. I2C control is easy to output from the AVR part, especially if using the Arduino IDE with the Wire library. With a 250 Ohm resistor between output and ref, and the potentiometer between ref and ground, you'll end up with a range from 1.25 to 26.5 volts, assuming the regulator can go that far and you can cool it. Also: it's a surface mount part, so you'll have to solder it "dead bug" style, or make a PCB.


For current measurement, you want to measure the voltage drop over a very accurate, very small resistor. Something like 0.1 Ohm, or even 0.03 Ohm (although losses in solder joints start becoming a problem there...) The drop, in Ohms, is I-times-R, so 0.1 volts for 1 ampere into 0.1 Ohms, which will dissipate 0.1 watts. Use a 5W resistor and be able to go to 7 amperes :-) (Wattage is I-squared-R.) Because the drop is small, you may want an opamp across the resistor with some multiple to make it easy to measure using an analog in on the AVR. If you find that the amperage drawn is higher than you want, you reduce voltage until it's within limit. You could do this with analog electronics, for ultra-fast response, or using a control loop in the AVR, if you run it fast enough.

A while back, I was thinking down the exact same path as you, until I specced out everyting it would take to build a solid, reliable, safe supply with the three rails and amount of voltage/current I would want in a robust enclosure -- and then I said "screw it" and bought a cheap three-rail supply from China :-)

So far that's working fine, and I can get on with the projects I really want to work on.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.