Trying to build µC controlled CC source for Lab supply - Page 1
Forum section: electronics / beginners

author: Unknown
author_rank: Unknown
timestamp: July 03, 2018, 09:02:15 pm
content: Hi there!I'm a beginner and having quite a hard time building my Lab PSU (1,25-12V, ?-2A)What I have so far, is a quite OK working µC Voltage Control of an LM317 from its Vref to 12V using an MCP1541 Voltage Reference on an MCP4922 DAC which then goes to an LM358 (Gain of 10) which then in turn drives the LM317 ADJ pin. The LM358 has a negative supply rail which comes from an TL7660. Also, there is an LM334 for the minimum load.As some may notice, this is inspired by Daves µSupply project which sadly never has been finished due to some design flaws and featuritis I assume.I tried to build up the current sensing using the MAX4080T and a 0.1R shunt resistor like in this schematic:http://www.eevblog.com/files/uSupplyBenchRevB.pdfAttention, Dave swapped the Inputs on U3B accidently. Instead of the TLC272BCP I used LM358 (with neg. supply) and instead of the LT3080 i used an LM317. Also I used an BD139 instead of the 2N3904 (Q2).BASICALLY that worked, however, current limiting was SWITCHING the ADJ pin on and off, instead of driving it in a linear way. You guess that ripple on the LM317 output. I tried several caps on C19 and C2 (1µ, 3.3µ, 10µ, 22µ, 33µ, 100µ, 220µ), the higher values made the switching kind of go away but the measured current on the MAX4080 obviously settled on a much higher level due to the high capacitance so that I got huuuge error there.Was the thing switching because of me, simply using different parts than in the schematics (maybe the LM358 are too slow?) or is there another error in the schematics?I also tried to simulate (didn't build that one up) the diff. amp from schematics Rev. C:http://www.eevblog.com/files/uSupplyBenchRevC.pdfHowever Dave mentioned somewhere that this circuit won't work cause the LM358 aren't Rail to Rail Opamps. So I tried to go for a higher supply voltage as well as negative voltage supply but the whole simulation behaved very strangely an when going to current limiting it mostly didn't even solve (or I'd have had to wait much longer for it to get there). I also tried to swap the LM358 with LT1007 (and others) but I had a hard time choosing Opamps due to my little knowledge.There's also another circuit which actually basically works: Two LM317 in series, one for current limiting and one for voltage control. However my concern was, if the current limiting LM317 lowers the input voltage below the dropout voltage of the voltage controlling LM317, wouldn't that thing become horribly unstable? I can't imagine that this would be a practical circuit, or am I missing something? Would the current limiting LM317 normally be AFTER the voltage controlling LM317?Attached you'll find the LTSpice Simulation of the Diff. Amp. from Daves Schematics Rev. CYou'll need to rename the LM358.txt to LM358.lib and have it in the same directory as the ASC file.Basically as I said, there is a voltage control circuit which works ok for me (looks ok on the oscilloscope as well) and I'd like to add something which I can control from a DAC (4.096V reference voltage, 12 Bit) which either pulls the ADJ pin to ground in a linear way or something like an NPN transistor (darlington?) which comes after(?) the voltage regulating LM317 and pulls the output to ground if there is overcurrent (also in a linear way). However for the transistor approach, I'd need far more help as I have absolutely(!) no idea which transistors to choose to make them work in a good operating area (read something about amplification and saturation.. NOO IDEA).Many thanks for your help!

author: MosherIV
author_rank: Super Contributor
timestamp: July 04, 2018, 11:15:28 pm
content: HiIt is not easy to build a full blown CV and CC bench PSU around the LM317.You have already looked at the bench PSU design that Dave put together.Personally I found this design the easiest to understand :http://www.microsyl.com/index.php/2010/03/31/bench-power-supply-0-25v-0-5amp/comment-page-2/It is basically what you are trying to build - a PSU controlled bench PSU.The circuit is based around 2 op-amps to control the voltage and the current.The output of the op-amps are ORed together so that the op-amp regulating the voltage is in control when the current output is below the ConstantCurent set point.The CC op-amp takes over if the current draw reaches the CC threshold and pulls the output voltag down to maintain the current at the threshold value.The output stage (which will replace the LM317) is basically power transistors in emitter follower mode. The op-amp sets the output voltage and emitter followers just output the same voltage on the emitter as on the base. The op-amp does not provide enough current to drive so many power transistors, so there is a buffer transistor to boost the current drive into the base of the power transisotrs.The CC op-amp has a tricky thing to master/get your head around - high side current measurement. Measuring the current on the supply line of the op-amp is tricky, op-amps DO NOT like having their inputs pulled above the supply voltage! The way to get around this is to put a voltage divider either side of the high side current shunt, then use a op-amp in differential mode to output the current measured by the shunt. The problem with doing this is the op-amp input offset will give an error (therefore giving you an erroneous current when there is none!). You can null this by carefully adjusting the offset to 0 but this will have to be re-done with time (and temperature).The designer of the PSU got round this by using an integrated device for measuring high side current. A lot easier but picking the right one and getting one easily is the problem. The ZXCT1009 is a fairly common one and I think is available if you look around.Hope this helps.

author: JS
author_rank: Frequent Contributor
timestamp: July 05, 2018, 04:51:46 am
content: I'm on a project similar to yours, Dave's design didn't oscillate just because of a filter in the current loop, but if your take it out it would oscillate as crazy, I guess you are missing that filter.Fast response to avoid current overshoot and stable could be archived with a non linear filter, so when tries to get current down it goes fast but it recovers slow.JS

author: Unknown
author_rank: Unknown
timestamp: July 07, 2018, 08:19:32 pm
content: Quote from: MosherIV on July 04, 2018, 11:15:28 pmGood to hear that, I already was thinking that I'm utterly stupidQuote from: MosherIV on July 04, 2018, 11:15:28 pmTHAT is one beauty, thanks for pointing me to this design!Quote from: MosherIV on July 04, 2018, 11:15:28 pmI guess I kind of understand the circuit. However, there are a few questions left, I hope that you'll find some time to answer to them:- There is an LM317 for stabilized 32V output - where do the 32V come from? AC input is only 4V at this point?- Why is there a Zener Diode (D10) before the 7805 and why is there a load resistor of 160 ohms (R26)?- I do not understand what D3 (Zener at ZXCT1009) is doing there, also I do not understand what Q3 (the PNP transistor) does? Why not just feed the Iout to the opamp? Also, what is R16 (1M) doing there? The MAX4080 seems to be easier to implement...- why are there D4 and D5, blocking the outputs of the opamps? how can this even work?- what are D7 and D8 doing, along with the resistors (R5 and R17)? i guess those pins go to the micro for sensing, but how does this work?- obviously I don't really understand how the feedback loop works, i didn't see a configuration like this, before. until now, i only saw configs where the feedback goes through one resistor to the inverting input and from there throug another resistor to ground...- Amp and Voltage calibration: what are those trimpots for, is it just to be able to choose cheap parts instead of 0,1% precision resistors? R11 and R12 are also trimpots but there is no note, why aren't they fixed values?- R2 (1k): what is that for? another load resistor?!Quote from: MosherIV on July 04, 2018, 11:15:28 pmDefinitely, thanks! But it also raised many new questions but I'm willing to learn :-)

author: Unknown
author_rank: Unknown
timestamp: July 07, 2018, 08:22:01 pm
content: Quote from: JS on July 05, 2018, 04:51:46 amReferring to:http://www.eevblog.com/files/uSupplyBenchRevB.pdfAll filters are there in my design as well. C19, R26 and C2 on the ADJ pin is there as well. Maybe this just doesn't work the way it was designed by Dave when using the LM317, maybe with the LT3080 it'd work just fine...

author: JS
author_rank: Frequent Contributor
timestamp: July 07, 2018, 08:45:39 pm
content: Dave's design doesn't work, at least not rev C with the follower on the high side of the resistor.JS

author: Unknown
author_rank: Unknown
timestamp: July 08, 2018, 10:38:19 am
content: i know, that‘s why i was referring to rev b..