Building a bench supply from an ATX power supply? (A study in masochism)

Continuing the discussion from TalentCell YS1203000 "State of charge" monitor:

This is the fork to discuss my efforts to turn a sow’s ear into a silk purse.

Unfortunately, I’m fresh outta pig-ears and my shipment of silk-worms was held up at Customs.

Here’s the last relevant message:

2 Likes

Update:

Before going nuclear and ripping things apart - only to discover that I really didn’t have to rip everything apart. . .

I decided to do some “test and measurement” to quantify what I believed to be true.

First:
I had replaced the fan on the bench supply and I decided to disconnect it on the off chance that the fan was a major noise source.  Not that I expected it to be, but hey, you never know.  Yes, the fan DOES generate some noise, (that’s why there’s a filter network connected to the PS fan circuit), but that wasn’t the problem.

Second: As I mentioned before, I have a different ATX power supply that I can test with and compare against.  So, I did just that.

The Actors:
“Bench Supply” - The result of all the hard work I have been putting in.
“ATX supply” - another ATX PC supply I have kicking around.

I also have an ATX power supply tester, (get one, they’re not expensive and are worth their weight in gold!), that I can plug an ATX supply directly into, power it on, and it gives you voltages and other important parameters.

I picked this beastie up from Micro Center for about $20 and that was some of the best money I’ve ever spent.  Actually, this is a second one I bought with the idea of giving it to my son Kirill, as he does IT as a day-to-day job.  He’s letting me borrow it as my tester is back in the U.S.

Viz.:


 

Tests done:

  • Connect the Bench Supply to my 'scope and take screen-shots of various measurements.
  • Connect the ATX supply to the ATX power supply tester and repeat the tests above.

Next:

Test results and what they mean.

2 Likes

Before I get crazy, here’s s short “switching power supply” primer so that what I am telling you makes sense as we go on.

Here is the analogy I used to explain switching supplies to my technically semi-literate older brother.

A linear supply basically consists of

  1. A transformer to change voltage “A” to voltage “B”.

  2. A rectifier on the “B” voltage side.

  3. Some way of regulating the voltage so that it is the voltage you need.
    “Unregulated” supplies simply provide the transformer, rectifier and filtering. The parts are big enough, especially the transformer, so that the voltage does not change too much as the load changes.  Note that, in this context, “big” also means “hugely wasteful of power” too.

A typical 5v linear supply has a transformer to change the hundred-or-so volts mains power to about nine volts AC.  It is rectified and filtered to a (reasonably) smooth DC voltage and then passed through a 7805 regulator chip, (looks like a big power transistor and heats up like one too!), to create the regulated +5v DC.

The 7805 regulator works by “throwing away”, (as heat), the parts of the input power that are not needed.  (i.e.  The excess water flows over the lip and is wasted.)  A 7812 does the same thing for +12v power and the corresponding 79xx devices are the negative voltage complements of the 78xx series.

The advantages:

  1. Easy-peasy lemon-squeezy.
    It is so easy to implement, even I can do it!

  2. The parts are common and dirt-cheap.
    A half-dozen off-the-shelf components and a heat-sink are all you need.

  3. Extremely low noise.
    Even today with switching power supplies being dirt cheap, if noise is a first-order requirement then linear supplies with quality decoupling components are the first and best choice because it is virtually impossible to build a switching supply that’s nearly as quiet without becoming a major expense.

The disadvantages:

  1. Linear supplies are essentially heaters, as they throw away unused power as heat.  As a consequence, they’re extremely inefficient.  As the amount of power needed, (amps at a particular voltage), increases, they become even more inefficient.  (And gigantic.  AND expensive - see below.)

  2. Transformers, all by themselves, are grossly inefficient by today’s standards.
    Unless specially constructed, a typical transformer has an efficiency of somewhere between 50% and 70%.  Transformers can be made more efficient, (at a particular frequency of operation), but that involves making the transformer and its wiring larger, using special core shapes and materials, using special ways of winding the transformer, special wiring, and other things that make a relatively efficient transformer expensive.  Even after all that, efficiencies are seldom greater than 80% unless you’re NASA or the DOD with deep pockets.

  3. Linear supplies don’t do large amounts of power well.
    (i.e.  A 20+ amp linear supply rapidly becomes hugely expensive as well as massively huge for any reasonable amount of regulation precision as it is essentially a small linear regulator coupled to a BIG class-A power amplifier.)

  4. Each different regulated voltage becomes an entirely separate regulator problem.
    If you need +5, +12, +3.3, and -12 volt outputs, you have to create essentially four different regulated supplies, though the output of a higher voltage supply can become the input to the next - but that cuts down on current available to the load at that voltage, and overloading of one stage can affect all the following stages too.

On the other hand, switching supplies are more complex.

Whereas a linear supply takes mains power, runs it through a transformer and then regulates the output, a switching power supply sends pulses of power to the output, timed in such a way as to create the voltage needed, as it is needed.  (i.e.  The valve only allows water to enter the tank if it’s being consumed somewhere else.)

The result is that power is “pulsed”, (switched), to the output sufficient to provide for what is being used, and no more.  However, the switch-mode supply has to be more careful in the way it monitors and regulates both output voltage and current.  In fact, at least three quarters of the circuitry in a switching supply are the voltage feedback and current limiting feedback circuitry.  And because of the relatively high frequencies involved, feedback filtering becomes a major design concern too.

Advantages:

  1. Because the actual transfer of power is what is being regulated, (instead of excess power being wasted), switching supplies can be extremely efficient.
    Efficiencies of over 80% are not uncommon, and later designs have them crowding the 95% mark.  (Remember that a 75% efficient linear supply is basically a Gift from the Gods Themselves and efficiencies are usually considerably lower depending on how crummy the design is.)

  2. Because the power supply doesn’t have to supply energy to offset the transformer’s inductive power conversion losses, (the transformer’s steady-state I2L losses), the power handling components can be smaller and lighter.

  3. As the switching frequency increases, inductive components can be made smaller for a corresponding amount of power transformation.  (This is why aircraft use 400hz power instead of 50/60hz power, the transformers can be very tiny.)  Likewise, higher switching frequencies make filtering components smaller too.

The disadvantages:

  1. Because a switch-mode supply is basically an oscillator connected to an amplifier, (and the amplifier’s output is your circuit!), switch-mode noise is a huge concern.  Many circuits avoid switch-mode supplies for just this reason.

  2. Since the primary side coming from the mains is not transformer isolated prior to rectification, power/voltage isolation is also a huge design concern.  This is addressed by inter-section isolation/conversion transformers and opto-isolators in the voltage feedback loop.  Higher voltage/power designs actually have physical cut-outs in the PCB itself to help avoid power bridging.

  3. The other side of #1 is switch-mode supplies have comparatively huge amounts of radiated EMI and RFI, and special designs have to be used to minimize it, including a metal case-shield.

The result of all this is that ANY switch-mode supply is electrically noisy.  Exactly how noisy it is, is a matter of design care and requirement.  Obviously something that’s just charging a battery doesn’t need to be as, (electrically), quiet as one running a piece of sensitive medical equipment.

This particular fact is why some “wall wart” supplies have difficulties with things like the Raspberry Pi and others don’t - even though they may be rated for the same exact current load - because the amount of electrical noise on the output may be excessive, which causes erratic operation.

Output noise is an important consideration for switch-mode power supplies, which we will investigate further in the next chapter.

1 Like

The actual tests and what they mean:

For the Bench Supply, I have a set of banana plugs terminating in alligator clips.

For the ATX supply, I stuck a wire into a connector’s ground pin and attached the 'scope to the +5 and +12 pins next to it.

The ATX supply:

+5v

Note at the lower left corner of the “oscilloscope” display, each vertical box represents 10mv, (0.010 volt) of signal.

+5 new ATX supply detail of voltage

If you look closely, you can see digital noise that consists of (approximately)

  1. 3khz switching noise. . .
  2. That is grouped in bursts with a period of about 300hz
  3. With about a 80hz overall ripple
  4. The total noise amplitude is about 10mv.

This periodic noise is not unusual for a switching supply.

By comparison, here is the +5v from the Bench Supply:

It doesn’t look like much to begin with, but look at the ranges!

This view shows a totally aperiodic (random) noise of 330mv! (0.3 volts)

Zooming in we see. . . .

Here you see:

  1. High-intensity pulses with a total period of about 43hz.
  2. Over 36 mv of high frequency ripple. . .
  3. With a ripple frequency of about 750hz. . . .
  4. With glitchy spikes all over the place!

Remember the high frequency ripple on the ATX supply was about 3khz.  Here, it’s less than 1khz.  And that’s slooow for a switching supply like this one.

Now, let’s look at the +12 supplies:

First, the ATX supply:

Here you see:

  1. The same approximately 3khz switching noise. . .
  2. And the same appx. 300hz bursts. . .
  3. And the same 80+hz ripple. . .
  4. With an overall 27mv PP ripple. 27mv out of 12 volts isn’t too nasty, 'eh?

Since the supply generates the +12v, which is then filtered and regulated down to +5v, the increased ripple on the +12v line isn’t surprising.

Now let’s look at the bench supply:

Here we see:

  1. 200hz of regulator noise.
  2. Random spikes giving almost 130mv of peak-to-peak noise.
     

Wandering through the waveform, I found THIS monstrosity!

  1. A high-frequency burst that was almost 55μs long
  2. Ringing at almost exactly 250khz. . .
  3. With an amplitude that was off-the-scale for the 10mv/div range


Restarting the supply showed a different waveform for the +12 supply.
(. . . and exactly HOW did that happen?)

It’s essentially the same as the first image, except that the regulator ripple is now almost 71.5khz instead of the 200hz it was before!  My guess is that the regulator control chip is toast, or something related to it, and the regulator ripple frequency depends on the time of day, phases of the moon, the color of my shirt, or whatever.  Whatever - that’s NOT a good thing!

Either that or I zoomed in and found a “subcarrier” ripple on the main regulator ripple, I’m not exactly sure.  Maybe it’s sending clandestine encoded messages to the KGB?

In any event, I think I’ve established enough “probable cause” to remove this power supply board and replace it with the ATX supply’s board.

My next step is to remove the ATX supply’s PCB from its case, without removing the connectors, and then re-test on the bench in vitro as it were to see if the absence of the case and/or cable routing changes things.

=============================================================

The real pressing question if you have any engineering/management skills is “What happened?”, and “Why didn’t I realize the first PCB was toast before I installed it?”

Well, (as I said before), we all know hindsight is 20/20.

Even more so is the fact that, since I started this journey, I have had the equivalent of a college-level class in switching power supply design and use, and things that I saw - and ignored - before are now known as gigantic flashing red beacons saying “Run Away!!”

  1. The original instability of the +5 standby voltage and the two over-voltage-damaged electrolytic capacitors I changed.

    • I now understand that the main power-supply controller and regulator IC is the part that generates the +5 standby voltage.  It is also responsible for the health of all the other signals and voltages on the board.

    • There is no “good” reason for those two electrolytic capacitors to have been bubbled-up like they were.

  2. The original supply, prior to being disassembled, had a “Power Good” assertion time of something like 750 to 800ms. It should be less than 400 or 500ms.
    Viz.:


     
    Notice that the readings from the ATX supply are right on 300±ms which is what I would normally expect - and I now realize that any significant deviation is a ticking time-bomb.

  3. Other supplies, like -12v, also varied when originally measured on this same meter as I am using on the ATX supply now, but I did not realize the significance of what appeared to be a minor variation in voltage.  I now realize that ANY variation is suspect.

In total, (and not unlike the ROS adventures of my dear and esteemed colleagues), this has been, (shall we say), “educational”.  I’ve seen more datasheets, graphs, articles, explanations, and other stuff in the last couple of months than in the entire year prior!  And that includes the TalentCell battery research I did.

In summary:

  1. I feel like an absolute clod.
    There are other, more accurate ways of describing this but - since I don’t know how much British slang Nicole knows, (and she IS a lady), I don’t feel comfortable using it here.

  2. I have learned a LOT about the inns-and-outs of switching power supplies.  For those of you who are into unique and interesting circuits, look up “joule-thief”, an interesting charge-pump type supply commonly used in outdoor solar lighting.  It’s about as closes as you will come, electrically speaking, to turning a sow’s ear into a silk purse.

  3. More important, I’ve learned what to look for.  I now have a clearer understanding of what’s important and what’s not.
    Spoiler:  In a switching supply, it’s ALL important.  Everything is so closely tied together that any tiny thing can, and will, affect everything else.

  4. As an old boss used to say, “The Devil’s in the Details.”

  5. And I probably should have gone out and just bought a supply instead of trying to “grow my own”. :wink:

What say ye?

1 Like

If I can find it here, (make that read "if I can find it here in English), I’d like to get the book.  The Lord Of The Rings, (as a movie), was good, but the book(s) beat that right to its knees!

Actually sitting down and watching a movie takes too much time away from what I should be doing, not to mention that it bores me to tears!

Aside from taking the granddaughters to something they want to see, I don’t have much use for movies.  I can make popcorn at home and watching idiot drivers on YouTube is more fun. :wink:
 

It’s just like a garden hose.  Kink it and the water goes away.

They do that with precision resistors - it’s called “laser trimming”.  They lay down a resistive film that’s just a smidge lower in value than what they want, and then bake it in.

Once the component is baked and cured, but before final packaging, they use an automatic machine to accurately measure the component’s value and then use a very thin laser to burn slits/notches into alternating edges of the film - slowly cutting away material - until the resistance rises to the value desired.

For precision parts they get really close than stop to let the component cool, then use a different, lower-power laser to cut away the last smidge or two until the part’s value is dead-on.

They “tune” precision capacitors and printed-circuit inductors the same way.

Precision active components, like the precision +10.0000v voltage reference IC’s that Analog Devices manufacturers, are done the same way.  They build up the part all the way to the “lidding” step, but before they put it in the can, they fire it up in a live circuit and “hot tune” the component for the correct voltage and temperature compensation so it can be used as a calibration standard.

An interesting technology!

2 Likes

What? Pay $500 and learn nothing, always believing you could have built it yourself and had money left over to take your wife to the best restaurant in town?

2 Likes

What’s the big deal - I probably see that much noise at Carl’s NiMH battery. Turn your scope up to 1v p-p and listen for noise with headphones.

2 Likes

Thanks - I learned a lot. And more with the description of tuning highly calibrated electronics components.

And I’m with @cyclicalobsessive - it does seem like you’ve learned a lot through this too :slight_smile:
/K

2 Likes

How are you getting that much noise from a battery?  Or is that on his charger?

What’s important is the comparison to a known good supply and the overall stability.

1 Like

A joke, my boy. Just a joke. The pervasiveness of switching supplies with acceptable-until-you-scope-it noise is an electronic cyber-pandemic. Carl May be the last generation of robots to have a true DC power source.

2 Likes

You could always attach a class-II hitch to Dave and have him drag batteries in a tiny trailer.

2 Likes

He won’t need that until he attempts a go at the “Autonomous GoPiGo3 1k Trials”.

He’s already cabled for a second battery, but the hitch may be a little harder to do.

2 Likes

Update:

I removed the ATX supply from its metal enclosure, attached it to the tester, and tried again.

Viz:

+5v DC, 10mv at 20μs per division


 

+5v DC, 10mv at 0.2s per division.


 

+12v DC, 10mv at 2ms per division
Note that the baseline has been moved down - that is deliberate.


 

+12v DC, 10mv at 0.2s per division.


 

Looks good to me.

2 Likes

Update:

The new PCB is sufficiently different from the original PCB. . .


(The new PCB is the one on the right.)
 

. . .that I had to completely re-do and re-paint the rear of the box to accommodate the changed configuration and layouts of the connectors and switches.

The epoxy isn’t self-leveling, so it’s a bit rough looking.

Right now the box is sitting on a warm radiator to help bake in the paint.

I absolutely hate rework.

===================

On a similar topic, I am going to do as much of the assembly and fitting as possible WITHOUT removing the ATX PCB connectors.  This way I can continue to test and monitor waveforms, noise, and voltage stability prior to doing all the final connections and soldering everything up.

I plan on obtaining screenshots of the measurements and comparing them with the PSU’s original waveforms and measurements prior to disassembly.

2 Likes

Its the back, so looks is not the issue - doesn’t the two different materials make cutting the new holes risking cracks and worse?

2 Likes

Stinks being me, doesn’t it?

The holes are in different places, (to the right of the original holes in that view), so it shouldn’t be too big of a problem but you gotta be careful no matter what.

2 Likes

. . . . The real problem is that it takes forever for the paint to harden to the point where I can cut the plastic.  (I should have cut first and painted later, but I actually had sunny weather[1] for a day or two and I wanted to take full advantage!)

Another thing, if you notice the new PCB on the right, I decided to mount it with the bottom pan in place to provide better grounding and at least some shielding.

  1. The weather here reminds me of British weather.   Overcast, cold, drizzly, fungus-inducing weather 99% of the time.   That is, when it’s not pouring rain or snow, or blowing a hurricane.
     
    I have a running joke with my wife that sunny weather is sufficiently rare that when the sun IS out, little kids ask: “Mommy, what’s that great big light up in the sky?!”
2 Likes

Update:

Nearly done!

This is the initial test before making things more permanent.

One thing I did differently is I changed the value of the load resistors - I added a second resistor in parallel, dropping the value to half its original value, increasing the steady-state load current to one amp on both the +5 and +12 voltage rails.  I also beefed up the heat sink as shown below.

Here are the measured voltages:

+12

+5

+3.3

And -12

I haven’t been able to put a 'scope on it yet as things are a disorganized mess, however voltages, particularly the +12 volt output, are now rock solid.

I am expecting good things from this.

2 Likes

Final assembly:

This time I was able to calibrate the two front panel variable voltage power modules which was problematic the last time.

This time I have repeatability to less than 0.01 volt of variation and an accuracy, (compared with my meter) of ± 0.01 - giving me a total error of < 0.02 volts - usually within 0.01v.

The load resistors get quite hot without any cooling, but with the fan in place the heat isn’t unreasonable - where “unreasonable” is defined as “possibly melting the plastic”.

I tried to get a rough measure of the supply’s noise/ripple by placing the meter in its “AC” voltage range and measuring the AC component across each set of terminals.  I measured about 11mv across each output which is consistent with my earlier readings with the 'scope.

So far I am happy with what I see, but the proof will be when I put a 'scope across the outputs.

Bottom line is that things appear to be more stable than before.

One puzzling thing though is that it takes my meter about three to five seconds after being connected before the indicated reading settles down.  This is odd, and I am looking forward to seeing the supply’s outputs on a 'scope.  This will tell me if this is a “meter” issue or a “power supply” issue.

1 Like

Update:

Success!

I dug out the DSO138 'scope and put it on the outputs, prior to setting up a full-blown USB scope on the laptop, just to see what was what.

There is, literally, nothing else to say.

  • 20mv of high frequency switching noise on the +12 output.

  • 10mv of the same noise on the +5 and +3.3 output.

  • Absolutely minimal noise on the -12 output as well as both of the variable voltage outputs.  (Where “absolutely minimal” means less than one or two millivolts, and it was virtually indistinguishable from the 'scope’s baseline AD converter noise.)

  • There was no visible ripple component on any of the outputs.

  • Voltages are rock-solid, with a maximum of ±1 count in the least significant digit.

  • Voltage repeatability is excellent, again with a maximum variation of ±1 count in the least significant digit.

As soon as I finish cleaning up the mess, I will repeat the GoPiGo voltage test and continue with the battery project.

Summary:

This time I think I got it right.

We’ll see.

2 Likes