Trying to build a psu with a pwm dac, inspired by uSupply - Page 1
Forum section: electronics / projects

author: Moriambar
author_rank: Unknown
timestamp: December 31, 2021, 07:39:36 pm
content: Hello,insipred by theuSupplyI am trying to build a 0-10V supply, just for fun.My idea is to use, in this phase, an LT3080, but to regulate voltage I want to use a pwm dac. Why? Just to experiment. don't need precision.The schematic I'm using is in(Please excuse the crudity of this model. I didn't have time to build it to scale or paint it)ok and this intro has been copied from a previous post of mine. Since I think this is gonna be a long project I might as well try and keep a topic on it.First of all I still consider myself a beginner; second of all I need your help:yesterday my self-bought christmas present (an awesome electronic load) has arrived and I started experimenting with my psu.My current settings are:Vin=10V {from siglent psu}Vout=set via pwm to 7V without loadLoad params=from 0 to 1A in 20sWhat happens is that the voltage rises to about 7.3-7.4V at around 0.4-0.6A and then it plummets to around 5ish Volts at the full 1A.I tried substituting the LT3080 with a regular lm317 and a similar behaviour occured. Not trusting myself I tried the same on the siglent psu and ofc it works fine, it drops ~ 6mV total (and I think that is due to my suboptimal connections).If you're willing, how can I help you help me?Thanks

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 31, 2021, 08:03:16 pm
content: First things first - the LT3080 will get pretty hot at 1 A while dropping 3 V: it'll dissipate 3 W. You will need a heatsink. Did you add one? (And, we don't know what package you used.)Then, have you checked the output of your PWM filter? Ideally with a scope.Also, have you set a current limit for the PSU? If so, what's the limit, and is it limiting when you have a 1 A load?

author: Moriambar
author_rank: Unknown
timestamp: December 31, 2021, 09:14:53 pm
content: Quote from: SiliconWizard on December 31, 2021, 08:03:16 pmyep, albeit crudely I did and its temperature will get stable at around 40-50°C with the heatsink (measuring the out tab). Before it was going crazy hot. I also changed the part. The package is the TO-220-5 iirc, I mean the through hole with five legsQuoteI just measured but with the dmm (I wasn't notified of reply) and I weirdly see that the value is rising constantly as the proto-psu gets loaded more and more. Even when the voltage drops, eventually, the value here is going crazy. I'll be back later with more data on a scope.QuoteNo, not yet, I plan to add it later (I originally had it but since nothing worked I just reassembled and tidied a bit up the "voltage stage". So no limiting, except on the actual PSU, but that is set to 1.5A and we go nowhere near that value.Thanks for your reply

author: Kleinstein
author_rank: Super Contributor
timestamp: December 31, 2021, 09:55:21 pm
content: The µsupply circuit never worked really well with the current limit. The idea of using a voltage regulator and than add current regulation as an afterthought is not really good. It is quite difficult to get it this way and the voltage regulator many be degrated to a trasistor with thermal protection ( still OK for the cheap LM317).

author: Moriambar
author_rank: Unknown
timestamp: December 31, 2021, 10:25:42 pm
content: Quote from: Kleinstein on December 31, 2021, 09:55:21 pmare you saying all of this is useless? I tried the lm317 in this same configuration but doesnothingEDIT: nothing different. Also, I thought that by building by steps it could be easier. Should I instead try and design it from scratch including current limit as well?cheers

author: Kleinstein
author_rank: Super Contributor
timestamp: December 31, 2021, 10:58:29 pm
content: If current limit is wanted, it would be a good idea to start from scratch / or a different project as a starting point. Adding the currentlimit as an after-though can be more tricky than a lab supply from scratch. The voltage regulator is not helping that much: it make the votlage regulation a littel simpler, but current regulation more tricky. The other point is that a voltage regulator is for a fixed load with limitations (e.g. on the load capacitance / ESR), while a good lab supply should work with essentially any load.

author: Moriambar
author_rank: Unknown
timestamp: January 01, 2022, 09:53:33 am
content: Ok, listen: I see that it's best for me to detail thw whole project and see what can I do with your help.First of all:Disclaimer:I don't intend for you to design this psu nor to do work for me, since I need and want the learning experience coming out of this project. Ofc I'm a beginner and in need of a lot of help, but I usually try and make things on my own. The problem is that I'm in need of help ofr this project. Let's make it a learning experience.BackgroundBack in the day I was fascinated by the uSupply project and wanted to build my own. That's when I went on a spending spree and bought the rotary encoders and the LT3080s, as well as heatsinks and silpads. As of today I still haven't build a thing out of them; in the last few months, though, a friend of mine (which is best described as a mechanical engineering genius) started looking to be able to create and test small circuits to attach to his designs. Up until now he uses batteries as PSUs or powerbanks. I thought that building one would be a wonderful learning experience for me and a great gift to him. Also, since he likes 3d-printing I don't have to worry about the case.uSupply, what I like about itThere are a few things that I like from the uSupply and want to incorporate in my humble PSU. Namely the PWM DAC is a simple and neat idea, I like it a lot. That's basically what prompted me to this project. Another big plus, and needed, is the voltage pre-regulator that effectively limits the power dissipated. Last but not least is the LM334 providing the minimum required current to the regulator IC.Hard Requirements/what I like to doI'll try and summarize:The psu will have to have current limiting capabilities and voltage regulation. Max voltage ≥ 12V; max current≈1A. See belowIt will be powered by a 24V 1A or 24V 2A switching brick which I don't intend to touch. I can also settle/make another version with 12V 1.5A adapter going down just to 10VIt has to use the LT3080. Why? 'Cause I can then get rid of those chips that have been aging in my bin for many yearsI'd like it to go down to 0V. If not possible, the lower the min voltage the betterUnless it's physically impossible or something, I really would like the PWM DAC ideas to be inI don't need special precision. I don't know what figure is a good one for precision thoughI think a voltage pre-regulator would be a great idea in order not to have to figure out how to dissipate the excess power in the regulatorsAll of the components should be hand solderable, ie no BGA or something smaller than 0602. I also have a hot air station coming, so something with the central pad exposed on the bottom can be ok too (although I have 0 experience with 'em)the display will be a 16x2 LCD which I already have. Since it's i2c and I love i2c if any other ICs like that are needed I like them to be i2cIt should be able to be controlled by an AVR chip (I have some experience with them) or an stm32F103C8T6 (I have a couple in stock!)No coarse-fine knobs. All rotary encoders (I already have them)If minimum load is required -> LM334Nothing extra unless neededMy "design" ideaMy idea is to build something likewhich is taken frompage 18 of the LT3080 datasheet, but substituting the pots with some PWM DACs, just as dave originally designed in the uSupply video series. The PWM frequencies are set from a mcu which will control the epot for the preregulator too. I do not plan the elaborate CC circuit from Dave's schematic, I'm going for something simplerConclusionsDo you think this is viable? Is there anything faulty with my ideas? I tried and built the CC regulator too using a pwm dac and it seems to work fine (limits current effectively) BUT I still experience the huge voltage instability on the whole range, especially when my limit is set over .5 Amps (up until 500-600mA I have around 5% precision).Can you help me please?Cheers

author: Kleinstein
author_rank: Super Contributor
timestamp: January 01, 2022, 11:40:34 am
content: The µC, LCD and PWM DAC idea is OK. Chances are one could have that part more or less seprate, just in case the rest would change or not work. Chances are the PWM would like a higher order filter, 3rd or maybe 5 th order to keep the ripple small.With 1 A and starting from 24 V or even less, there power dissipation is not yet that large. So at least for the start I would go without the preregulator. A simple heatsink and maybe a fan is easier and less noisy. The SMPS part is kind of separate too, so even if the board is planed to include the preregulator one could skip this part first.For the LT3080, it depends on the case: the TO220 version is kind of OK. Though the advantage compared to a simple transistor is small.The smaller case version is likely not worth the trouble and would only work with the preregulator or a much lower current, as it is hard to get away the heat.Adding current limit to the LT3080 is tricky. The way by changing the voltage at the set pin is very tricky and prone to instabilty. The idea of lowering the input side voltage may actually be better (at least easier), though it needs a 2nd power stage.

author: Moriambar
author_rank: Unknown
timestamp: January 01, 2022, 12:29:30 pm
content: Quote from: Kleinstein on January 01, 2022, 11:40:34 amThanks. The lt3080 (TO220) is what I have AND want to use and get rid ofI have at least two of them and I was working on the aforementioned design (the one where the input is lowered based on the current regulator).I'll tell you what, I'll hook up what I have, and draw a schematic and test it again. I'm sure I'll get it wrong but it's at least something.Right off the bat I know that the filtering will give me a huge headache because I don't know anything about it, but I'll see what I'll be able to do. I'll stick to Dave's design to start and make a PoC and then design it better perhaps.Thanks

author: Moriambar
author_rank: Unknown
timestamp: January 01, 2022, 03:30:07 pm
content: Ok now I put it all together, see attachment.The fact is that it does not regulate at all. First of all both pwm end up regulating the out voltage with no load at all. Second of all whenever I apply any load the voltage drops and continues dropping. It's hard to tell whether it's limiting or not.If you're concerning with me burning it it's a 3W job (I had it lying around) so it's not the case.Thanks

author: Moriambar
author_rank: Unknown
timestamp: January 01, 2022, 07:58:17 pm
content: Quote from: Kleinstein on January 01, 2022, 11:40:34 amdo you think it's best to toss altogether the LT3080 and use the lm317s with the same idea?I mean, I'm not able to make this work. But perhaps tomorrow will bring new ideas. Thanks for your support.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 01, 2022, 08:22:22 pm
content: For the shown circuit I see 2 problems:1) the amplifier behind the PWM filter does not like the large capacitance in the loop and would likely oscillate. At least the chance is high that is oscillates. The filtering is also not very good, but that would not stop it from at least partially work.The PWM part could be tested on a breadboard or maybe airwired circuit. So this would probably be a first part.At least for the PWM filter part it would be a good idea to think about doing a simulation, e.g. with with LTspice. this may be easier than soldering and one can try a fre configuration quite fast. Ideally one would also use it for the rest.2) the current regulator part does not work, it is more like a 2nd voltage regulator.The adjustment from the DAC can be a bit tricky for this circuit.I think it is too early to give up - learning takes some time.

author: Moriambar
author_rank: Unknown
timestamp: January 02, 2022, 03:04:13 pm
content: Quote from: Kleinstein on January 01, 2022, 08:22:22 pmOk, about 1 I have the circuit on a breadboard and I tested with the scope and everything seems fine about the pwm, I have some neat analog voltagea. Perhaps I'll try and test more carefully to see whether there is any massive ripple on that, but it seems not too much.About 2) I found many issues:first of all the output of the current regulator has to be taken not directly from pin 3 but from the junction after the 1R0 resistanceActually the amplifier isn't doing anything useful there (see below)From what I understand what I have to regulate is the Voltage difference across the 1 ohm shunt, and it should be between 0 and 1 Volt. This guarantees the current limit. I thought about that all yesterday evening, this morning and this afternoon.Well, having understood that I thought about using a voltage divider on the pwm (which is 5Vpp) to bring it in the 0-1V range and then use the amp in some kind of difference amplifier configuration. The problem is that what I can set is the… SET pin, and I don't have a clue on how to do that so that it work, except, maybe, using an e-pot and ditching the whole pwm dac on the current limit side.Is there a different (maybe better) choice?Cheers.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 02, 2022, 04:17:39 pm
content: Getting the current set signal to the LT3080 used as a current regulator is indeed a bit tricky. The ciruit want a positive voltage relative to the output and in the circuit in the DS they use the fixed current and a variable resistors.One possibility would be to use a fixed resistor (e.g. 1 K) and than a variable current to add to the chip internal 10 µA fixed one. This way one would not be able to regulate the current all the way down, but this is not working well anyway, as there is the internal consuption in the LT3080 and the minimum load current anyway. So one may end up in a range like 10 mA to 1 A.The positive current could be transferred to the regulator with a current mirror (2 PNP ransistors+2 resistors) from the positive side and a current source controlled by PWM.Alternatively one could use the 10 µA and a fixed 100 K for the maximum current and than go down from there by sinking some current from the set pin. Here there is a slightly larger drift problem, as the set values is a difference.A digital pot would also be a bit tricky, as the signal is at a relatively high voltage and the digipots only work with the signal inside the supply range. Most digipots are 5 V supply max and thus no suitable. One could more like transfer the PWM signal with an optokoppler and than do PWM and filtering where the ref. is needed. It still is a bit tricky.

author: Moriambar
author_rank: Unknown
timestamp: January 02, 2022, 08:38:01 pm
content: Quote from: Kleinstein on January 02, 2022, 04:17:39 pmawesome, I knew I was thinking the wrong way! I have much to learn about the correct mindset to obtain what I want.I'll hook up a current source and mirror as soon as I get the chance.Thanks, I'll be back with more details as soon as I have some.

author: Moriambar
author_rank: Unknown
timestamp: January 07, 2022, 02:43:05 pm
content: Quote from: Kleinstein on January 02, 2022, 04:17:39 pmMan, I swear I tried. I built some kind of current source to inject to pin 2 of the current limiting circuit and the 100k resistor. I'm attaching a schematic of how I set up the current source. I tried connecting the output of the amp to either side of the current setting resistor.The problem is that I get a steady 15mA of current regardless of the pwm signal.I'm at a loss, what am I missing?Thanks

author: Kleinstein
author_rank: Super Contributor
timestamp: January 07, 2022, 04:09:54 pm
content: The current mirror with the 2 transistors need the input from a current signal, not directly from the voltage at the OPs output. So the simple solution would be with the 1 K resistor to the OP and not to ground. This still has some problem, as in the ciruit the signal is more like 0-5 V and not to 12 V.The alternative would be another transistor to use the OP in a adjustable current sink.

author: Moriambar
author_rank: Unknown
timestamp: January 07, 2022, 11:09:41 pm
content: Quote from: Kleinstein on January 07, 2022, 04:09:54 pmSo I tried. The amp gets 0-1.5V from the pwm signal. but sinking the current from the pnp kinda lifts the OP output to a minimum of 1.2V, reducing the range to 1.2-1.5V. I tried setting a 10x gain but no luck. Perhaps I'm just doing something wrong, and I'll try again tomorrow but I'm starting to think this project is not for my skill level. I still have much to learn and I'm feeling more or less just as clueless as when I started (although the current source idea was illuminating).Cheers

author: Kleinstein
author_rank: Super Contributor
timestamp: January 08, 2022, 08:23:48 am
content: Quote from: Moriambar on January 07, 2022, 11:09:41 pmA lab supply is not as easy as it looks at first sight. It is still a very interesting project to learn from.One should not give up so fast. Maybe try a smaller step first to get the constant current sink and maybe the current mirror working with just a LED or similar.

author: Moriambar
author_rank: Unknown
timestamp: January 08, 2022, 09:27:17 am
content: Quote from: Kleinstein on January 08, 2022, 08:23:48 amok, well today I have new energy… and tried again: I put the OP in a x10 gain and the voltage on the low side of the current setting resistor is ok and goes from 0-10V. By ok I mean ok for now.The problem is that the current injected in the 100k resistor that's connected to the set pin is fixed at 10mA regardless of that voltage. I'm really thinking that there's something loading something else in my setup, otherwise I don't understand what's happening.I'm attaching a new schematic just to see what I'm doing wrong.I also do not understand how to test the circuit further…

author: Kleinstein
author_rank: Super Contributor
timestamp: January 08, 2022, 09:48:12 am
content: The circuit with the OP gives a current in the 10 mA range. That part should be reasonable working, though 2 discrete transistors are not very accurate. To improve on the current mirror there should be small resisors at the emitters to improve the stability and accuracy.The control of the current to the mirror just with the OP and resistor is not ideal (as it depends on the supply), but OK for now.R14 directly at the OPs output is not needed and more like causing trouble.The regulator part is missing the load to the output. So there should be something like 100 Ohms (high power rating) or a light bulb at the output of the regulator.The other problem is that with R16 = 100K the control is with a much smaller current. So this resistor R16 should be much smaller, like 100 Ohms or 1 K (with less current from the OP and mirror, like R15 = 10 K or 47 K). The regulator works a bit like a current amplifier with a gain of R16/R17.

author: Moriambar
author_rank: Unknown
timestamp: January 08, 2022, 12:37:07 pm
content: Quote from: Kleinstein on January 08, 2022, 09:48:12 amSo…R14 is an error in the schematic. it's not there. The regulator has on its output the other regulator, the CV one. I tried 10k for R15 and R16 100R. No effect. I mean I set the load to a CC 1A and no matter how I change the pwm, the load always receives 1A. Should I try and hook up the load directly on the output of the first regulator? I tried tentatively, in CR mode but the pwm does not change the current value.For reference the current source, when loaded, outputs 53mA, regardless of the pwm signal

author: Moriambar
author_rank: Unknown
timestamp: January 08, 2022, 03:13:05 pm
content: ok WE HAVE PROGRESS!what I found out is that one pnp tranny was gonsky, I probably did something wrong during my experiments and burned it off or something, so basically was allowing any amount of current to pass through it and I noticed thanks to its smell…well now we can limit current effectively, although I'll have to work out how to linearize the relationship between pwm and current value.We have another problem though: attaching this circuit to the CV part I have a very bad psu: at medium to high currents we cannot hold the voltage. At the max 1A I notice ~3V drop on 9V (power is 12V), .150mV on 6V and ~50mV on 4V regulated value.now, what's all that about? I feel like there's something missing

author: Kleinstein
author_rank: Super Contributor
timestamp: January 08, 2022, 04:14:23 pm
content: The LT3080 has some drop ot voltage (some 400 mV from the power input and ~1.5 V from the control power). With 2 regulators and the 1 Ohms resistor in between this can add up at 1 A. Depending on the cooling there can also be some thermal effect at 1 A.With 12 V input 9 V out could be about the maximum possible: 1.5 V loss for the first regulator, 1 V for the resistor and 0.5 V for the 2nd regulator if the control parts gets direct power.One could lower the resistor a little to maybe 0.5 or 0.33 Ohms and thus less loss there, though less accurate regulation.A higher voltage is loss is a downside of using to regulators in series.For a more linear and more stable current control one could use an extra NPN transistor at the ouput of the OP, to make it a constant current sink instead of the voltage gain.

author: Moriambar
author_rank: Unknown
timestamp: January 08, 2022, 09:55:08 pm
content: Quote from: Kleinstein on January 08, 2022, 04:14:23 pmThank you for your reply and for not abandoning me! Your help is much appreciated.I might've not expressed myself well.So, all in all I'm currently ok with:setting a current limitno-load regulationI mean I can still fine tune it and enhance it later, but at least I can set a voltage (with no load) using the pwm and I can set a current limit THAT WORKS with the other pwm signal.I have no concerns, currently, about the 9V output: I'll deal with it later, if necessary, or I'll work with different input voltages.What I'd like now would be to be able to regulate VOLTAGE. I mean: with full 1A load I can only have ~7V with a 9V setting. I can kinda keep the 9V up to around 200-300mA IIRC (I still have losses but <100mV) but from there is just a somewhat linear drop. I thought about increasing the output capacitance but that only helps with transients (duh!), but evidently there's something I am missing since I would not expect the LT3080 to "fail" with .5A or .6A…and the thing is that this loading is happening (in a smaller way) with every voltage. OFC no current limit set.Tomorrow I'll check again all of the connections on that side, but I expect them to be ok since with no load I can regulate…btw I'm attaching the new full schematic for reference.If you have any ideas on where to look or what to look for I'm all earsEDIT: unfortunately I have two small mistakes in the schematic: the +10V of U5 should be +12V and there's a single 10k resistor in place of R5-R6.I'll try and correct the thing in the morning

author: Kleinstein
author_rank: Super Contributor
timestamp: January 08, 2022, 10:09:41 pm
content: Vcontrol of the 2nd regulator is probably better connected to the 12 V and not the reduced votlage from the current regulator.As shown there would be some 1.5+1+1.5 V of drop out at 1 A and thus around 8 V max.The LT3080 has a temperature protection withput a heat sink it may regulate dawn alread.Where is the supply coming from ? Maybe the input 12 V are also droping under load.

author: Moriambar
author_rank: Unknown
timestamp: January 08, 2022, 10:13:11 pm
content: Quote from: Kleinstein on January 08, 2022, 10:09:41 pmI'll connect to the 12V, thanksQuoteI have an heatsink with silpad and I tried cooling it with a fan too to no availQuoteit's coming from my siglent psu, set with 1.5 limit (for safety), but the psu basically sits at a minimum of 11.99VThanks!

author: Kleinstein
author_rank: Super Contributor
timestamp: January 09, 2022, 08:30:07 am
content: The circuit to set the voltage set point may oscillate with the feedback from the capacitor and not directly from the OPs ouput.If it actually oscillates depends on the details (e.g OP manulacturer, layout, capacitor type).

author: Moriambar
author_rank: Unknown
timestamp: January 15, 2022, 03:24:09 pm
content: Quote from: Kleinstein on January 09, 2022, 08:30:07 amok then,It took me a bit since I've been sick, but I'm back on track.I'm currently adding fan cooling to the project and it works.Current limit works perfectly too; I'll work out the OP best configuration later but as a proof of concept it does exactly what I expect.The problem now is on the voltage regulation side. I mean I can set the voltage using the OP, although it's quite inefficiently configured; the problem is that I cannot maintain the voltage set under load.I'm trying the "worst case", ie an input of 12V (linear psu, perfectly stable), an output of 9V limited to 1A. I think that I won't be able to achieve 10V with this configuration and 12V input. Anyhow I removed the cap that was between the voltage op and the reg, I also connected the control voltage to 12V instead of the output of the current limiting stage.The result is that I can keep my 9V up until 100mA CC load. Then I have a 50mV drop (which I think I can still see as fine) up until 500mA. From there I start dropping heavily until I end between 6 and 7V under the full 1A load. I tried increasing the output capacitance to no avail.Is there any suggestion I can follow? Honestly I don't understand what I did wrong nor what I can measure to see what I did wrong.Thanksps: I'm attaching the new schematic, should be correct this time