DIY Power Supplies - Page 1
Forum section: electronics / projects

author: rebelrider.mike
author_rank: Contributor
timestamp: October 14, 2018, 09:07:00 am
content: I'm pretty new to electronics, and I want to do some projects more to learn than to use.One thing I'm interested in is power supplies. I figured I'd start simple, and build a linear power supply. I found the basic diagram and parts, and it's pretty straightforward. At least until I got into the details.Mains Voltage => Transformer => Rectifier => Smoothing Capacitor => Noise Filter Capacitor => Linear Regulator => Another Noise Filter Capacitor => Output VoltageI decided to make my own transformer from one I found in a defunkt UPS. That project was written up in another thread.https://www.eevblog.com/forum/projects/noob-plays-with-transformers/I already had a rectifier in a parts bin, which I was able to identify as a GBU806. I found out this unit has can do up to 600V, 8A. And has a Voltage drop of 2V. At the start, I had no idea what the 3 capacitors were supposed to do, or that the regulator would need such "high" Voltage (7-28V) in order to give a 5V output. Fortunately, some folks were able to help me read datasheets, and I found a lot of useful info on the internet!One of the first things I discovered was that after rectification, the Voltage would be higher than it was coming out of the transformer. Eventually, I learned about RMS and some of the math associated with it. Turns out 120VAC is closer to 170V at it's peak, but since it's constantly sine waving from +peak to -peak, something more like an average is used to. That took a while to wrap my brain around, but fortunately, the math to figure it is pretty simple. Just whatever your Voltage is x 1.414.In my case: 9VAC x 1.414 = 12.7VDCI picked the Voltage coming from the transformer at 9VAC mostly because it seemed fairly close to the lower end of what the regulator wanted, without going too low.The reason knowing peak Voltage vs RMS Voltage is that once it's rectified, I have a DC Voltage that bounces from peak to 0V. I learned that the filter capacitor is for reducing that ripple so that the Voltage stays closer to the peak, instead of getting all the way down to 0V. How close depends on the capacitance.In order to find the value I needed for the filter capacitor, I had to learn some more math. Values that must be known first, are peak Voltage, minimum Voltage, time, and current.- Peak Voltage (Vmax): this is the 12.7V calculated before, minus the Voltage drop of the rectifier. So 12.7V - 2V =10.7V.- Minimum Voltage (Vmin): this took me a while to figure out. But it's the minimum Voltage the linear regulator needs to function. In my case, 7V.- Time (t): this is the time between peaks, measured in ms. In the case of 60Hz mains Voltage, this works out to 8.3ms.- Current (I): this is simply the maximum current required of the circuit. In my case, 1500mA.Capacitance = I x t / (Vmax - Vmin) = 1500mA x 8.3ms / (10.7V - 7V) = 3341uF.I found a 16V 3600uF which is close enough.For the two small capacitors, I found that I had to pick a linear rectifier first. Apparently, the two small capacitors help remove line noise that a particular regulator might find disruptive. So the capacitors recommended for each regulator is listed in it's data sheet. In my case, I chose a UA7805CKCT regulator which had it's capacitors listed.After I had the parts picked out, I was able to finish my diagram with values of everything. I had also tried to visualize what the waveforms would be at the various stages in the circuit.Another thing to consider is heat dissipation. The regulator and rectifier both produce heat, and especially the regulator needs a heat sink to function properly. I found the maximum working temperature of the regulator, and compared it to the temperature the chip would be if I didn't have a heatsink, and it was way above the maximum. I didn't do any estimating for the regulator, since I decided to put it on a heatsink regardless.About this time I got the transformer finished up, and I hooked my little oscilloscope to it. This is one of the first readings I've taken with an oscilloscope, so the resulting sine wave was pretty neat.The reading after the rectifier was exactly what I hoped for. A ripple wave at twice the frequency, and about the Voltage I had expected.The rest of the parts came in the mail, and I hooked those up too.With the capacitor, the ripple wave smoothed out too. Though this only seemed to work with the circuit under load.I was able to charge an eReader with it! I did find though, that the linear regulator could only put out a steady 5V with no load. Charging the eReader at only around .4A, the Voltage dropped to around 4.6-4.8V. It also did indeed get quite warm.I found another heatsink and bolted the two together, putting the regulator, and rectifier on opposite ends. This time I charged up my cell phone telephone, at about the same current, and the chips didn't get quite as hot as they did sharing the single heatsink.I had originally estimated that the power supply would be around 30% efficient. I took a few measurements, and calculated the actual efficiency.Efficiency (%) = Watts in / Watts used x 100I used a few different loads to get as close to maximum current as I could:Watts in = 23W, Watts used = 4.65V x 1.69A = 7.86W.Efficiency under full load = 23W / 7.86W *100 = 34.17%That's pretty nice all things considered. However, here's what I got charging my cell phone telephone:Efficiency (phone) = 12W / (4.78V * 0.41A) * 100 = 16.33%Pretty dismal! On the bright side, my house is cold. So the waste heat is only helps to keep the pipes from freezing, LOL.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: October 15, 2018, 02:43:41 am
content: Hi,I've seen your transformer in the making on another post. This is a nice project.However, take into account that the uA7805 may not be able to deliver 1.5A. The short circuit protection is not guaranteed as well (that really depends on the manufacturer, from my experience).Kind regards, Samuel Lourenço

author: GigaJoe
author_rank: Frequent Contributor
timestamp: October 15, 2018, 03:32:00 am
content: wire from a chip regulator to the load has a resistance ,you loosing millivolts on it , it a fun to have multi-meter that able to measure micro-volts; May I suggest a cheapest one :https://www.banggood.com/ANENG-AN8008-True-RMS-Digital-Multimeter-AC-DC-Current-Voltage-Resistance-Frequency-Capacitance-Test-p-1157985.htmlhttps://www.amazon.com/dp/B06ZZG2F2N/ref=psdc_14244471_t3_B071H8PR61or something ...

author: technix
author_rank: Super Contributor
timestamp: October 15, 2018, 08:10:35 am
content: It is because of the efficiencies why people uses switch mode power supplies for big voltage drops like this. You can buy a cheap LM2596 buck converter module online and replace the 7805 with that, and see a significant efficiency boost.

author: kjr18
author_rank: Regular Contributor
timestamp: October 15, 2018, 07:45:33 pm
content: Yes, he can do it, but this way OP learns many things, he learns how to calculate different values. I think this is a correct learning process. If you know how something works you can work out what might go wrong, and how to protect from possible failures. It's a bit of different story when you introduce a piece that you're not sure how it works. OP here is new to electronics and he wants to learn. What's wrong with taking it slow and easy?

author: station240
author_rank: Unknown
timestamp: October 16, 2018, 07:13:25 pm
content: Quote from: kjr18 on October 15, 2018, 07:45:33 pmExactly, and knowing how to measure things like efficiency is also important.But some people are so obsessed with forcing others to do things a certain way because.If someone wants to design and built something, let them.

author: rebelrider.mike
author_rank: Contributor
timestamp: October 16, 2018, 11:30:50 pm
content: Now that that's done, I'd like to move on to a switch mode power supply. This one is a little more complicated as there seem to be several "topologies" to choose from. I made some progress towards figuring out which one I want. They seem to be separated into 2 broad categories, isolated and non-isolated. I picked isolated, mostly because it looks cool. But also, I have a store-bought isolated power supply that I can look at and maybe sort of reference.I don't want to reverse engineer this unit, but just reference it and learn to recognise the components. Another thing that will help pick the topology is that I want to go from AC to DC. Seems there are still a lot to choose from, and I don't really know the difference.So starting at the very beginning, I want to end up with a power supply that can take 120VAC in, and convert it to 5VDC, 1.5A out. Just like the linear power supply. I've put together a little diagram showing how I think it will work:- I've read that smps make electromagnetic interference if they're not inside a metal box, and so an EMI filter is needed. I don't know much about it yet, but it looks like an EMI filter is made up of a little coil thing and a capacitor.- Unlike the linear power supply, the smps rectifies the mains Voltage straight away, and smoothes it with a capacitor. This part I'm familiar with.- The inverter is a rapid on/off switch, and is usually a transistor or MOSFET. The resulting signal is a high frequency (kHz) square wave that can be used by a transformer.- The transformer steps the Voltage down just like a 60Hz transformer, but the high frequency allows the core to be much smaller.- The output from the transformer is still a square wave, and so gets "rectified" and filtered into something closer to a... flat line? No wave? Anyway, a steady Voltage.- To keep that Voltage steady, the output Voltage is also sent back to a feedback/controller which changes the behavior of the inverter so as to keep the output at a smooth 5V.Well, hopefully I got some of that right. It looks to me that there are different ways to accomplish the feedback and control, and that seems to be the reason for the different topologies. I'm working on a schematic showing actual electronic parts instead of boxes, that I'll share later when I've got more figured out.

author: technix
author_rank: Super Contributor
timestamp: October 17, 2018, 02:03:08 am
content: Quote from: rebelrider.mike on October 16, 2018, 11:30:50 pmThat is a big step up really, going from 7805 directly to a double isolated mains switching supply. Maybe take smaller steps for now?Those LM2596 modules contains a much simpler non-isolated DC-DC converter. The chip combined the power transistor, the error amplifier, the voltage reference and the controller in one package, and the supporting circuitry on the board includes a power inductor, a diode and some resistors for setting the feedback point.

author: David Hess
author_rank: Super Contributor
timestamp: October 19, 2018, 12:58:19 pm
content: Quote from: rebelrider.mike on October 14, 2018, 09:07:00 amMains VoltageTransformerRectifierSmoothing CapacitorDecoupling Capacitor at Regulator Input (might be combined with above)Switching or Linear RegulatorOutput Capacitor for Frequency CompensationDecoupling Capacitor at Load (might be combined with above)

author: station240
author_rank: Unknown
timestamp: October 19, 2018, 05:36:10 pm
content: Quote from: rebelrider.mike on October 16, 2018, 11:30:50 pmIsolate is also safer, relatively speaking, no risk of dangerous voltages on the low voltage side, unless you screw up the transformer.The blue capacitor between the two sides of the transformer also forms part of the EMI noise reduction. It passes high frequency AC noise on the ground of the output, back to the earth on the mains side.The type and voltage of these capacitors is a vital safety feature. Being rated for 2kV or 3kV seems like overkill, but it prevents power surges from slowing breaking down the capacitor. The blue ceramic disc type are at the very least sealed, for this application many have safety approvals of some kind.

author: Canis Dirus Leidy
author_rank: Regular Contributor
timestamp: October 20, 2018, 03:23:52 pm
content: Quote from: rebelrider.mike on October 16, 2018, 11:30:50 pmAs a rule of thumb:SMPS overview, comparsion and selection guide.P.S. There is another way: transformer with switched (manually with rotary switch in most simple case, more advanced designs userelaysortriacswith some voltage detection circuits) secondary wingdings.Pro: It's the same good old 50Hz transformer with linear regulator circuit.Contra: It's the same bulky and heavy 50Hz transformer. Plus, most likely, you will need to do it yourself or pay for manufacturing single non-standard transformer.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: October 20, 2018, 11:06:34 pm
content: Hi,Since you wish to learn, have you tried to build your own linear regulator circuit? You can do it with a few parts: an op-amp, a pass transistor (I suggest a NPN Darlington), a few resistors and capacitors, a Zener to serve as voltage reference and a pot to serve as your variable voltage divider. You can even add a simple short circuit protection with another transistor and two more resistors.I think this would be an interesting project for you to build, before you move on to SMPS topologies. You can apply some principles of linear regulation there too.Kind regards, Samuel Lourenço

author: rebelrider.mike
author_rank: Contributor
timestamp: November 15, 2018, 02:43:10 pm
content: Well, I've been reading and researching, and I haven't made a lot of progress. I have learned a little though.Here's a rudimentary diagram of what I think the circuit will have:I've read that the control chip runs off the rectified input Voltage, except that is being switched off and on rapidly by the control chip. So there are capacitors that keep enough Voltage so the chip will function. The chip runs on way less Voltage than the input from the wall though, so a Voltage divider is employed. Hot diggity, I actually know what that is!I've also read that this type of topology is called flyback as every time the input is switched off, the collapsing magnetic field from the transformer creates a negative Voltage. Though the current induced remains a forward current, and has to go somewhere. Somehow, they got the word flyback out of all that.Anyway, it seems there is a clamp needed to prevent bad things from happening if the induced forward current has nowhere to go. This is accomplished with diodes, resistors and capacitors that I haven't added to the above diagram yet. I've also heard this part called a snubber. Though these may be two different things.I still haven't been able to find a control chip that I can use in this setup. I must be searching wrong, but I don't know how. Surely such chips should be common. There are millions of these things charging cell phones, right? I was able to read the label on the chip from that circuit board I have. It reads: AP8012H. I found the datasheet on it, and it features an internal switch. Makes sense, as there's no switch on the circuit board that I have. So at worst, I can get these for 0.90$ each from AliExpress. Maybe I should reverse-engineer that circuit board after all...

author: prasimix
author_rank: Unknown
timestamp: November 15, 2018, 03:49:43 pm
content: Quote from: rebelrider.mike on November 15, 2018, 02:43:10 pmChoose any of your preferred IC vendors and simply search forflyback controllerorAC/DC converters. In case of TI you can find ithere. On ST site you can searchhere. In general there is two category: with integrated and without integrated power switch (i.e. MOSFET or BJT). Very straightforward solutions comes from PI (Power Integrations). They are offeringTinySwitchseries (III and 4), etc.

author: technix
author_rank: Super Contributor
timestamp: November 19, 2018, 06:41:15 am
content: Quote from: rebelrider.mike on November 15, 2018, 02:43:10 pmI have a few samples of ST VIPer22A. That chip has almost everything on the primary side integrated up to and including the power transistor. You just need to supply the transformer, optocoupler, rectifier and some passives for it to work.