### Author Topic: DIY power supply  (Read 7715 times)

0 Members and 1 Guest are viewing this topic.

#### MarkF

• Frequent Contributor
• Posts: 833
• Country:
##### Re: DIY power supply
« Reply #75 on: August 19, 2018, 09:15:18 pm »
Okay...   Here is a cross between your original two LM338 design and Dave's current limiting case.  There are still a few odds and ends to work out.

« Last Edit: August 19, 2018, 10:46:22 pm by MarkF »

#### Pirateguy

• Regular Contributor
• Posts: 112
• Country:
##### Re: DIY power supply
« Reply #76 on: August 20, 2018, 03:30:51 am »
i wasn't actually thinking of using 2 lm338 or an adjustable current limit,
but rather that using a regulator would cap the max current at whatever the
regulator's max capability is.

is this wrong?

i like the idea of having an adjustable current, but that might be a bit over my head at the moment.
i am decent at basic math, but i never learned any kind of shorthand in school or anything, so i still need
to learn to interpret these formulas n stuff.

like when it says '(stuff)morestuff', does that mean i calculate '(stuff)' and then multiply the result by 'morestuff'?
there seems to be a missing symbol there...
is there a guide or something out there that happens to focus on specifically those kinda questions?
i bet i can do it if i can just learn to translate it into english...

anyhoo, for now maybe i should build a variable voltage one for now and separate the variable current limit to
in which case, single 338 +bypass transistor +polyswitch?

in that last pic, what is REF02?

#### MarkF

• Frequent Contributor
• Posts: 833
• Country:
##### Re: DIY power supply
« Reply #77 on: August 20, 2018, 05:41:03 am »
You can build the adjustable voltage part of the last circuit (It's just like in the datasheets) and then add the variable current limit later.  The variable current section just monitors the current through a 1 ohm resistors and pulls the LM338 adj pin to gnd, which sets it's output to minimum, when the current reaches the set point.  Identical to Dave's video.  Just watch his explanation and think LM338 where he has the LT3080.

The REF05 is a 5V reference.  You would need the variant that has a 40V input capability.
www.analog.com/media/en/technical-documentation/data-sheets/REF01_02_03.pdf

i wasn't actually thinking of using 2 lm338 or an adjustable current limit,
but rather that using a regulator would cap the max current at whatever the
regulator's max capability is.

is this wrong?

Do not depend on any chip for current limiting.  That's the same as not using any fuses and just waiting for the meltdown.
I would still use a polyfuse on the adjustable supply just like you're doing for the fixed outputs from the ATX.
« Last Edit: August 20, 2018, 06:02:29 am by MarkF »

#### MarkF

• Frequent Contributor
• Posts: 833
• Country:
##### Re: DIY power supply
« Reply #78 on: August 20, 2018, 08:46:31 am »
Here's an initial cut at what the LM338 Adjustable Voltage and Current Limit Power Supply PCB might look like:

Updated for AC or DC inputs (not all parts would be populated).
« Last Edit: August 20, 2018, 04:53:40 pm by MarkF »

#### JS

• Frequent Contributor
• Posts: 943
• Country:
##### Re: DIY power supply
« Reply #79 on: August 20, 2018, 12:54:56 pm »
You might consider this power supply by Peter Oakes:

That looks quite unstable, I run a simulation and it behaves awfully, specially with a little bit of capacitance at the load. Adding some resistance at the output makes it better but that screws regulation even further than the already badly placed current sense. Some inductance in parallel with the resistors helps but now it's getting tricky, not as simple as it looks. output wire parasitics might be enough in some cases but relying on that isn't good practice. I think Peter showed this as a first approach, to show a working prototype with a minimalistic approach but it doesn't mean it's a good design. It does work on steady conditions but will overshoot every time it can.

Something similar would happen with the LM338 example, it might work but once in the real world it will catch a condition when it becomes  as current limiting doesn't look particularly stable. It's quite easy to make one or the other condition stable but the transition between both gets tricky to get right. I've explained this in a topic, I designed a CC/CV dummy load which simulates stable under a wide range of conditions, I haven't found one where it behaves erratically, overshoots badly or starts oscillating, I did build a prototype for the first attempt and it was ok, the second attempt after some math and more time on the sim looks even more promising but I haven't got around to build it yet. In the meanwhile it showed the possibility of adding constant resistance mode which looks nice so I might add that before finally building and for simple tests I have the first one which does an ok job for general testing.
Going from there to a power supply adds a few challenges, they are similar but the load isn't designed to reject ripple for instance or accomodate for input voltage variations as it's only looking at the voltage across the pass elements, turning that around swaps all the control configuration bringing new stability issues so is not a straight forward conversion.
There's a design around here of a dynamic load which seems great, much faster than mine, only current but with a pulsed current on top of the DC, so you can look at the dynamic response of the DUT.

In all this time looking for a simple design of a lab PS which meets my desires I haven't found a project up to the task. I'm not being too picky about voltage and current ranges as I am with dynamic response under different loads. I expect my lab PSU to behave as it should with capacitive or inductive loads, avoiding overshooting and oscillations which might bring problems to the table later on when I'm testing something and trusting the PSU.
One thing I'm considering is using two power devices to regulate current and voltage independently, which makes control much easier but that doesn't scale up nicely as two small devices are cheap and easy but once you get into higher powers needing multiple bigger devices it gets expensive and having twice as much as needed doesn't play nice.

JS
If I don't know how it works, I prefer not to turn it on.

#### Pirateguy

• Regular Contributor
• Posts: 112
• Country:
##### Re: DIY power supply
« Reply #80 on: August 20, 2018, 01:38:07 pm »
man, i thought this was gonna be simple. lol.
this and some other stuff i been reading lately suggests that power supplies in general are kind of an advanced project
the moment you make any kind of demands of it's performance.

i think i'm gonna have to just build the fixed output ATX one, then the variable voltage one, and then
reassess if i want to diy anything more complicated after using that for a while.

#### MarkF

• Frequent Contributor
• Posts: 833
• Country:
##### Re: DIY power supply
« Reply #81 on: August 20, 2018, 01:39:36 pm »
@JS:

I'm a little confused as to which circuit you are referring to or both.

If Peter's design, he makes heavy design changes by the end.  It's been a while since I've watched the series and I don't remember what all he does.  The last I looked he was redesigning the entire thing and his Electronic Load.  I built his Electronic Load and it performs well even when driving it externally with pulsed control.

If my last Frankensteined design of the adjustable voltage circuit in the datasheet with Dave's current limit approach in his video.  To me it looks okay on paper but I have not built it up and performed any testing.  If you see any specific issues with the design, I would like to hear them.

#### MarkF

• Frequent Contributor
• Posts: 833
• Country:
##### Re: DIY power supply
« Reply #82 on: August 20, 2018, 01:53:37 pm »
man, i thought this was gonna be simple. lol.
this and some other stuff i been reading lately suggests that power supplies in general are kind of an advanced project
the moment you make any kind of demands of it's performance.

i think i'm gonna have to just build the fixed output ATX one, then the variable voltage one, and then
reassess if i want to diy anything more complicated after using that for a while.

This thread has been throwing a lot of things around.  Don't get put off yet.
• Your ATX fixed output should be in the can with just a few fuses.  This is going to be your workhorse 90% of the time.
• The Adjustable Supply is a good project to cut your teeth on.  Build it up and do some tests.
• Then, try building an Electronic Load.  About the same difficulty or easier then the Adj Supply.
• After, tackle a Function Generator.  It would be a mix of analog design controlled by a microcontroller. (The Arduino's you already have for example.)

#### plazma

• Frequent Contributor
• Posts: 436
• Country:
##### Re: DIY power supply
« Reply #83 on: August 20, 2018, 03:38:40 pm »

This thread has been throwing a lot of things around.  Don't get put off yet.
• Your ATX fixed output should be in the can with just a few fuses.  This is going to be your workhorse 90% of the time.
• The Adjustable Supply is a good project to cut your teeth on.  Build it up and do some tests.
• Then, try building an Electronic Load.  About the same difficulty or easier then the Adj Supply.
• After, tackle a Function Generator.  It would be a mix of analog design controlled by a microcontroller. (The Arduino's you already have for example.)

It depend if you want to use time and build your own gear or buy ready made ones and  use them for the hobby straight away.

Current limit is so important I would not bother with an ATX supply. The DPS modules are so cheap and work well.

#### JS

• Frequent Contributor
• Posts: 943
• Country:
##### Re: DIY power supply
« Reply #84 on: August 20, 2018, 03:58:42 pm »
By all means, build a variable PS with an LM317, or two... The ATX looks a bit dangerous for the projects as it can source quite a bit of current and blowing fuses testing projects is not my thing. It is useful to power a few things and I have a bunch I use every now and then when I need to test something, like feeding the input of your variable PS to test it. As Plazma just said, the "LAB SMPS" option is now available looks great and are cheap, with that and a laptop power bank you get quite a bit out there, I'm considering to get those but as SMPS doesn't quite get to a linear one I'm still with my project, even if I do get some of those.

The circuit with 2 LM317 with a switch for selecting a few different current limits seems nice, I never build one but I wish I did, now I'm trying to get a more advanced one as I see I should be to the task.

The frankie with Daves approach tends to be unstable, Dave stabilized it making it really slow to climb and fast to go down, with some big capacitance on the Vadj pin. The voltage being FF shouldn't overshoot which is nice. When he shows the Vadj pin on his you can see quite some oscillations going on in a few different situations. CC is one of them and you might get a noisy output there, put the shunting transistor to some abuse or be too slow and have quite a big current overshoot, you choose.

Now, after my last post one idea came to mind that looks promising at a first glance in the simulator, more testing should be done there before addressing the real world design, ideally my design should be scalable to higher voltages and currents. Decent currents could be archived with a single big mosfet without worrying much about redesign other than stability tweaks to compensate for gate capacitance, for an extended voltage range the opamps rails becomes a problem, like 0-30V range you want the opamps to be able to run a bit wider than the range, and low dropout from the main supply for efficiency and better range from the same pass device. I'd like to run all that from a single transformer, which combined with the last few points makes for the need of some higher rail likely using a multiplier, to archive a higher voltage rail for the opamps. Last but not least, I want to be able to control it with a µC. On top of all that I want to use all standard components, nothing fancy or special. All of that put a lot of restrictions, I'm not to fancy about precision and stability, to makes things easier but that mostly comes to the µC side of things, where you could choose better reference and converters to improve on that, as well as opamps if going to the limit.
Just for kicks, the difference in the new approach is using what Dave shown on the first video designing a lab PSU, in EEVBlog #221 as the constant current control, a conventional approach to control the voltage using a second opamp and a diode to select between both. As I have the current sense resistor in the high side after the pass device for the current mode it makes easy to stabilize the voltage mode under different loads without introducing new losses and keeping a good load regulation. An N-channel pass transistor looks like the more promising device but as has been discussed around here getting a proper transistor to work in this kind of circuits inside the SOA and not shortening it's life is a harsh problem, it looks like I can get an IRFP064 like the one in the Peter Oakes's design for about $3 which seems like a suitable part for a nice range, not needing to go for IXYS which could cost many times that. I'd probably start with some smaller IRF part to test around as I've been doing with my dummy load, if all comes together I'd get a few of those so shipping doesn't cost more than the devices. Going too long with this, I just hope to find some time for it and finally get to something, I want to get this right and test it to then share it with all of you, with a flexible design that anyone can build with it's own specs, right now I'm moving the lab in a new room in my house so it's all been quite messy plus some big projects on my day job eating all my time. I need this supply for myself too, I'm setting up the lab quite a bit lately and if I could save the$ for the supply I'd like to have and settle with this the $could go to some other toy as I'm collecting quite a few lately and building some others. JS « Last Edit: August 20, 2018, 04:07:01 pm by JS » If I don't know how it works, I prefer not to turn it on. #### JS • Frequent Contributor • Posts: 943 • Country: ##### Re: DIY power supply « Reply #85 on: August 20, 2018, 04:15:28 pm » One thing you might like to know... CC dummy loads are a much simpler to build than a lab PSU, same thing for a variable power supply, but if you have both and connect the dummy load between the source and the variable supply you get pretty much a lab PSU. That's what I meant when I said using two power devices for a lab PSU. Remember to put first the CC load and then the variable PSU, otherwise it won't work. The other possible way to do it is to put it on the low side, using the high side of the CC load as the ground for the variable PSU. CC load is basically a mosfet, a sense resistor and an opamp. The variable PSU is just an LM317 with the standard circuit around it. If you want to go this way (which I totally recommend to get something up and running for a beginner to have something to work with) let us know so we can help you choosing the right CC load to build, as it's the part that might get unstable under certain conditions, the classic simplistic design gets unstable, but just adding a resistor and a cap to make it slower makes it work fine. JS If I don't know how it works, I prefer not to turn it on. #### MarkF • Frequent Contributor • Posts: 833 • Country: ##### Re: DIY power supply « Reply #86 on: August 20, 2018, 04:30:28 pm » @JS: Could you post the circuit you're tossing around so we can see your thoughts? I believe that @Pirateguy going to setup his ATX Supply with polyfuses so that he just needs to remove the overload condition and the fuses will reset for him. As a start, I think he will just build the basic LM338 adj voltage in the datasheet with a polyfuse for current protection. Then add adj current at a later date as his knowledge grows. I actually did build Peter's Electronic Load. The IRFP064 in a TO-247 package is a beefy MOSFET. I have no problems with it. However, I lowered the current capability to 1.5A for mine. That's all I really need. #### JS • Frequent Contributor • Posts: 943 • Country: ##### Re: DIY power supply « Reply #87 on: August 20, 2018, 05:17:52 pm » The picture is the basic design, I've just found it on google, at least has some compensation as I said which makes it usable but the values are wrong, at least R14 which should be 1Ω or maybe lower, depending on the expected current range, properly rated for power, much higher than the actual power the resistor will dissipate to get better stability and not get too toasty. 1k there seems way off unless going for really low currents, in which case the mosfet makes no sense as a single opamp could do the job for a few mA. R1 could be 100Ω, R15 10k and C10 something like 1n should roughly work, depending on the mosfet and some other factors, like expected speed and loads. Iset will be Vref/R14 This is the topic of my dummy load. https://www.eevblog.com/forum/projects/cccv-dummy-load/msg1589761/#msg1589761 As you see mine is quite more involved, having CV and CC modes, and thermal shut down and a more involved compensation to keep it relatively fast and stable under many conditions. It will be in CV till the CC limit is reached. The funny connected transistor is the temp sensor which I didn't had the lib for. JS If I don't know how it works, I prefer not to turn it on. #### MarkF • Frequent Contributor • Posts: 833 • Country: ##### Re: DIY power supply « Reply #88 on: August 20, 2018, 05:42:21 pm » Looks nice. But, I thought we were talking about adj power supplies. #### JS • Frequent Contributor • Posts: 943 • Country: ##### Re: DIY power supply « Reply #89 on: August 20, 2018, 05:51:29 pm » Looks nice. But, I thought we were talking about adj power supplies. They have a lot to do... specially once you start talking about current limiting. As I said, with a simple variable supply and a CC dummy load you basically have a lab supply. Also, a related but simpler project that you would need to test the power supply you build so why not build it first... is kind of the egg and the chicken as what are you testing each with, but I tested mine with a 9V battery just to check so you don't need the PS to build it. JS If I don't know how it works, I prefer not to turn it on. #### MarkF • Frequent Contributor • Posts: 833 • Country: ##### Re: DIY power supply « Reply #90 on: August 20, 2018, 07:06:56 pm » Here's the Electronic Load and values I used. This does need a fan for the heat sink at currents over 500mA. Maybe @Pirateguy would want to put the chicken before the egg. It's just a matter of putting it together as I already tested it. « Last Edit: November 07, 2018, 11:40:39 pm by MarkF » #### Pirateguy • Regular Contributor • Posts: 112 • Country: ##### Re: DIY power supply « Reply #91 on: August 20, 2018, 11:07:40 pm » This thread has been throwing a lot of things around. Don't get put off yet. • Your ATX fixed output should be in the can with just a few fuses. This is going to be your workhorse 90% of the time. • The Adjustable Supply is a good project to cut your teeth on. Build it up and do some tests. • Then, try building an Electronic Load. About the same difficulty or easier then the Adj Supply. • After, tackle a Function Generator. It would be a mix of analog design controlled by a microcontroller. (The Arduino's you already have for example.) lol i'm not put off, but i know my limits and the adjustable current is presently one step too far for me. the ATX one is definitely gonna get built, as well as the volt regulated one. but after that i think ill switch it up and work on some other projects before coming back to the psu. however one of the things i wanna do next is build some mini tesla coils, and i want at least 1 that can be modulated n stuff with an audio jack and a built in func gen, so that will help when i get back to the psu. (i guess ill also be learning much about tiny faraday cages... ) #### rstofer • Super Contributor • Posts: 5300 • Country: ##### Re: DIY power supply « Reply #92 on: August 20, 2018, 11:40:30 pm » man, i thought this was gonna be simple. lol. this and some other stuff i been reading lately suggests that power supplies in general are kind of an advanced project the moment you make any kind of demands of it's performance. i think i'm gonna have to just build the fixed output ATX one, then the variable voltage one, and then reassess if i want to diy anything more complicated after using that for a while. This happens all the time. It seems obvious that a power supply should be a first project and many folks recommend it to newcomers. Then reality hits the wall. A REAL lab power supply with a wide range of voltage and current capability coupled with adjustable current limit is a really big project. Dave's project is substantial and I think he got to a dead end (I stand to be corrected on that, I just watched a couple of videos). When you look inside a REAL lab supply you get an understanding of just how complex the project can be. The ATX is a common next idea. The problem is, it doesn't have current limit and current limit is a really important feature. It saves so much on smoked parts. So, one approach that I used for decades is to use wall warts or batteries. I could always put in a 7805 or whatever if I wanted a clean source. Dedicated supplies for each project is one way to go. Even a fixed voltage power supply using 7805,7815 and 7915s will do the job. The output current won't be much but we really don't need 30V at 3A these days. OTOH, Dave did a video or two on these Chinese supplies and they look really capable at about$20 per channel.  I don't know anything about them and I did notice that nobody linked them earlier.  I don't know why.

These are neat looking supplies.  There are at least 2 videos because there was a design problem with the earliest models, since corrected.

Here's the failure video:

And the fix:

« Last Edit: August 21, 2018, 01:18:29 am by rstofer »

#### Pirateguy

• Regular Contributor
• Posts: 112
• Country:
##### Re: DIY power supply
« Reply #93 on: August 21, 2018, 06:48:05 am »
yeah i was looking at those and ill prolly go with that if i ever decide i need a better psu.
a loose panel like that provides a lot of freedom over the configuration of the externals.

#### Pirateguy

• Regular Contributor
• Posts: 112
• Country:
##### Re: DIY power supply
« Reply #94 on: August 24, 2018, 08:30:42 am »
quick last question:

can i put n led on a negative volt rail?

#### MarkF

• Frequent Contributor
• Posts: 833
• Country:
##### Re: DIY power supply
« Reply #95 on: August 24, 2018, 11:09:00 am »
can i put n led on a negative volt rail?
Yes.  But you need to reverse the polarity of the LED.

Do you mean polyfuses?

This diagram might help (Again you may not need the load resistor for the supply to turn on):

« Last Edit: August 24, 2018, 11:13:10 am by MarkF »

#### havewattwilltravel

• Contributor
• Posts: 14
• Country:
##### Re: DIY power supply
« Reply #96 on: August 24, 2018, 11:55:34 am »
One thought: You can get really cheap low voltage digital voltmeter+ammeter boards on Ebay, which allows you to watch several channels simultaneously and still have a meter free.

#### Pirateguy

• Regular Contributor
• Posts: 112
• Country:
##### Re: DIY power supply
« Reply #97 on: August 24, 2018, 12:14:47 pm »
can i put n led on a negative volt rail?
Yes.  But you need to reverse the polarity of the LED.

Do you mean polyfuses?

This diagram might help (Again you may not need the load resistor for the supply to turn on):

ahh thanks

One thought: You can get really cheap low voltage digital voltmeter+ammeter boards on Ebay, which allows you to watch several channels simultaneously and still have a meter free.

yeah mean the panel mount ones?
yeah i got 2 of those, but for the fixed outputs i don't really need one i think.
anyways i'd have to either have 3 of them or have a switch for it, and i have no room for that.
i did put in a temp display though, and the variable psu ill make after this will have a meter in it.

#### MarkF

• Frequent Contributor
• Posts: 833
• Country:
##### Re: DIY power supply
« Reply #98 on: August 24, 2018, 12:58:36 pm »
I missed the 3.3V Sense wire (Brown).
It needs to be tied to one of the 3.3V Output wires (Orange).

#### Pirateguy

• Regular Contributor
• Posts: 112
• Country:
##### Re: DIY power supply
« Reply #99 on: August 24, 2018, 08:07:36 pm »
lol no worries. my atx has neither 3.3v nor 3.3v sense wires
i added a step down module to get the 3v.

i also don't have a power on wire that i can see...

so it looks like my first planned upgrade will be a double pole version of the power switch
hopefully the chinese won't make me wait too long...

in any case here she blows:

Smf