Arduino controlled CC/CV bench supply- I have questions - Page 1
Forum section: electronics / projects

author: crispytato
author_rank: Regular Contributor
timestamp: September 05, 2013, 07:34:43 am
content: Hello everyone, I'm in the planning stage of a new project I'm designing. It will be an Arduino controlled power supply with 0-5 amps and 1.25-12v out. These numbers might be tweaked if the power source is higher voltage. I am intending to use a lm338 and an external npn pass transistor (tip41c). I will include a block diagram of the parts I intend to use. Any input that you think could help out, I'd appreciate heaps. I'm very new to digital electronics, and programming, so that'll be a challenge in itself, but the hardware is my first priority.For power, I have two ideas in mind. First, is just using a regular (or toroidal) transformer and full wave rectifying/smoothing with a few mF of electros on another smaller board is one option, and the other was to get a high voltage, high current laptop power supply and have it out of the way near the socket! this would keep the other parts of the psu (regulator and ics) cooler and more isolated too. my only concern is if the laptop power supply was ground referenced and not able to disable itI intend to drive the adj pin with an amplified and smoothed dac signal. this will give me range of 1.25-12, or up to about 15 volts I'm using lm324, and it doesn't go rail to rail, I'm not worried, 12v out is my minimum requirement though. Am I correct in assuming the Arduino would have the power to control the output in 11-12 bits worth of steps and calculate all the required stuff for variable current or voltage? or am I expecting more power than I'll be able to get out of my Duemelanove (atmega 328pu)I'll say it again, I'm a software noob, have very basic understanding of some analog circuitry, and a small amount of digital understanding. This is a bit beyond what I've built before, but we only grow by pushing ourselves. Any "traps for young players" would be appreciated by me greatly.Anything you'd like me to clarify please just ask, I really want to make sure I'm going in the right direction. Thanks very much for your time.PeaceChris O0

author: Dave
author_rank: Super Contributor
timestamp: September 05, 2013, 09:26:15 am
content: I hate to break it to you, but a software controlled CC loop is going to be really slow and prone to oscillating. You can forget about powering LEDs with this supply, because before the CC will kick in, the poor LEDs will be long gone.What you need is a completely analog loop, which you can adjust with a DAC. And while you are at it, you might make a matching voltage control loop, so you eliminate the ye olde LM338 and use an ordinary transistor as the series pass element. Your power supply will be much more stable and reliable with all kinds of loads.Have a look at theschematic of the good old HP/Agilent E3610A power supply(page 16; it might be worth reading the whole service manual to fully appreciate the design). Learn from it, and maybe use some of it in your own design.Quote from: crispytato on September 05, 2013, 07:34:43 amAll the more reason to upgrade your analog knowledge. I bet nothing can stop you from succeeding.

author: crispytato
author_rank: Regular Contributor
timestamp: September 05, 2013, 11:03:13 am
content: Thanks for the input Dave. I'm glad to find that out before I make a PCB or design a whole board which has a fundamentally flawed design. I had wondered if the mcu's response time was going to be sufficient to keep it happily in regulation. I shall study the schematic of the HP, and try to work a new schematic up and post it here.I am interested in moving away from the IC regulator for efficiency's sake as well as simplicity. However, I was concerned about getting the circuit stable because I don't have access to a scope. Do you think I'd be able to get it working stably so long as I err on the side of caution with design decisions?I'm going to go do some reading now.Peace

author: fcb
author_rank: Super Contributor
timestamp: September 05, 2013, 11:06:00 am
content: I have to agree that regulating CC with software loop would probably be crap, it would be interesting to see just how crap it would be.I'd probably look at regulating a very high frequency poly-phase SMPS, but could an *acceptable* bench/lab supply be built I wonder?

author: Experimentonomen
author_rank: Regular Contributor
timestamp: September 05, 2013, 02:05:43 pm
content: I don't even see the point of bringing in a µC into something a linear regulator would do better than anything µC based could ever dream of.The right way to implement µC control is to have the µC control what you normally control with analog pots, the µC is never part of the regulation loop itself. IE replace the analog pots with digital pots controlled by the arduino.I have NEVER EVER in my life seen a power supply where the µC was part of the regulation loop, the µC simply controls the linear regulator by means of a dac which supplies the voltage/current setpoints to the voltage/current regulator just like the analog pots would on your bench supply.

author: Dave
author_rank: Super Contributor
timestamp: September 05, 2013, 06:11:30 pm
content: Quote from: Experimentonomen on September 05, 2013, 02:05:43 pmI have seen one, it was terrible.Quote from: crispytato on September 05, 2013, 11:03:13 amIt might be tricky to get it really stable without a scope, but there are other ways to check for oscillation. I suppose you could measure the AC voltage on the supply rail. Zero AC voltage = stable power supply.As for picking the values of resistors and capacitors in the feedback loop, you could use Gerry Sweeney's programmable decade resistor and capacitor. You can then just play with the values and see what works best.

author: Unknown
author_rank: Unknown
timestamp: September 05, 2013, 06:55:58 pm
content: Quote from: Dave on September 05, 2013, 06:11:30 pmThe TuxGraphics one? Yep, that was a terrible idea.Quote from: Dave on September 05, 2013, 06:11:30 pmMost circuits can easily oscillate at frequencies much higher than the few hundred Hz of a cheap DMM.

author: Bored@Work
author_rank: Super Contributor
timestamp: September 05, 2013, 07:42:51 pm
content: Quote from: Experimentonomen on September 05, 2013, 02:05:43 pmActually, TI sells a whole range of digital control loop devices for SMPS' since at least 2009. For examplehttp://www.ti.com/product/ucd3020Around 2009 they published the math behind the loop designwww.ti.com/download/trng/docs/seminar/Topic_7_Hagen.pdfBut just because digital controllers exist doesn't mean some Arduino crap with an ad-hoc control software loop will work well.

author: fcb
author_rank: Super Contributor
timestamp: September 06, 2013, 08:32:18 am
content: crispytato,I say, go for it. You'll learn a huge amount from making an "arduino controlled bench supply" with a software controlled CC loop (including why it won't be as good as a linear loop). Yes, it probably isn't the *best* way to do it - but then the *best* way is probably just to buy one.

author: crispytato
author_rank: Regular Contributor
timestamp: September 14, 2013, 01:35:36 pm
content: Quote from: alm on September 05, 2013, 06:55:58 pmLucky for me, I have a nice Agilent U1251 which measures fairly high frequencies happily. I have used it to measure ripple on a line of an old power supply that I built. I checked it along side a real scope that belonged to a friend and the RMS voltage of the AC signal was close enough to my reading to be useful (within 10 percent variation in several different samples!)That being said, it's only so useful and I'm dying to get my hands on a real scope. I'm moving house in a couple of weeks (argggghh), but I really hope I can sort out an old analog scope when I get moved into a new place and have a bit more space for my lab. having the ability to look at a signal will be absolutely invaluable to me and understanding circuits more closely.I'm going to work on this project a bit in theory until I have something better to go ahead with than the fully software regulated loop. I'm thinking I might start with just voltage controlling it and measuring back current until I get the first half finished.I'm having a lot of trouble getting my head around the information I can find for regulators and the explanations of how they work. I think there are still holes in my knowledge of op amp action, making this all harder :/I want to build something practical! Getting a circuit working the wrong way, would be a crap idea imo. I'd rather have spent the effort learning it the way professionals do it, so I have the most useful knowledge.

author: dannyf
author_rank: Super Contributor
timestamp: September 14, 2013, 03:00:54 pm
content: QuoteThe first question you want to ask yourself is what are you trying to achieve? If you intend to build a DC power supply to a (near) constant load, putting the mcu in the control loop is doable. If you intend to build a power supply to a varying load (aka a Class B audio power amp), putting the mcu in the control loop is difficult to do even for seasoned pros - Freescale doesn't make billions in the power supply business for nothing.

author: crispytato
author_rank: Regular Contributor
timestamp: September 15, 2013, 02:31:38 pm
content: I've been working on my own regulator based on the advice I've received here to ditch my lm338 idea.I came up with this, It's rough, and I'm sure there's some mistakes, but if someone could throw some ideas my way it'd be great. is my theory and application okay for the analog circuitry for the most part? I gathered some inspiration from watching Dave and Gerry Sweeney's videos on their lab power supplys. I'll replace the main pass transistor with 1 or 2 darlington power transistors.As for what I want to achieve with this project-I have a couple of low-current 20-30 v maximum power supplys that I use for my projects. I built them over the years, and they're used to power anything from MCU's and such, all the way to fully analog circuitry and tubes etc.Ultimately my intention for this power supply project is to get a small compact fan cooled supply with a micro controller to give me flexibility in programming it. be that through serial, or buttons/rotary encoder as I'm putting on the panel. I want good clean power and I don't need high voltage, it'll be mainly for sub 12 v precision circuitry and I want a nice clean output at high amps. I really want to have a current limit that I can reliably protect my projects with too.It will be compact, linear, and fully cc/cv controllable. I am shooting for 12-15 volts max, with 4 or 5 amps current capability. I'm going to get a nice chunky transformer (hopefully toroidal) to achieve that sort of output. I want to use 12 bit dacs so I can still have small steps with my output amperage. I want to use a constant current device like dave did so it can be calibrated out easily.I will hopefully get this on a breadboard/stripboard before I move house, I will post my results here when I do.Excuse my scratchy writing and schematic, it's much easier to think on paper when you can use an eraser much easier than on the PC.