Flyback converter (110-220v line power to 5v) - Page 1
Forum section: electronics / projects

author: benjius
author_rank: Contributor
timestamp: December 11, 2010, 09:26:13 pm
content: Hi,I've been trying to come up with a really small design that will take mains line voltage in the range of 90-250 volt a/c - 50/60 Hz and output5 / 3.3volt at < 500mA.I don't want to use a big transformer+linear regulator because of the size !I've seen implementations like Microchip AN954, (capacitive and resistive PSU):But they seem unsafe and I don't like them, I'm looking for something more robust.I found the fly-back converter with secondary current and voltage regulation implementation, commonly found on wall adapters for cellphones.Then I located the ViPer family of devices from ST, specifically the ViPer12A which can handle a bulk and flyback configurations.It provides some sort of protection and I like them, they come in DIP package and most important I can source them in my town !From the app note "AN1484":The circuit is a standard Flyback converter with secondary current and voltage regulation driving the VIPer12A feedback pin through an optocoupler.This is the design I was looking for !, it's small, safe and it's been used all over the world but I know nothing about them,I feel I'm going through the rabbit hole and things get complicated every step of the way.First and most important it's very hard to find the correct flyback transformer, the two vendors I found don't have a sales webpage they work onlythrough distributors, and even then I'm not sure about the stock.PF0037 From PulseCVP11 Series from Cramer CoilFuture reading I found that I could buy a EE16 core and wind the transformer myself but I know nothing about that either.EE16 CoresI've some questions that google can't answer.Can you manually wind a tiny flyback transformer ?If someone has experience with these designs I would greatly appreciate any advice.Thanks.Ben.

author: Psi
author_rank: Super Contributor
timestamp: December 12, 2010, 12:17:06 am
content: You would need 7uF of mains rated capacitors to get 500mA in that first circuit anyway, those kind of power supplys are only physically small if you need under 100mA.

author: tyblu
author_rank: Frequent Contributor
timestamp: December 12, 2010, 12:32:57 am
content: Have you made a SMPS before? This is quite the variation on one. I don't get it on first inspection. Are you able to analyze it? If not, stay clear, as you'll just get zapped and die.

author: benjius
author_rank: Contributor
timestamp: December 12, 2010, 12:57:10 am
content: Quote from: tyblu on December 12, 2010, 12:32:57 amYes I've done a few DC-DC StepUp SMPS in the past but based on 555 timer chip (for my nixie clock)As for playing with high deadly voltages:18 Years ago when I was maybe 11 or 12 years old I promised mom and dad that I would not be killed an electrical shock and that I would stop playing with mains electricity for ever, (They found my playing with an old motor I picked up from the garbage)Since then I like to keep my projects running on low voltage, my nixie clock is the only high voltage project I've done.My last project was the first time I worked with 220V/AC and to be honest I was fascinated by the amount of power you can control with it, it feels really powerful and I learned a lot !The truth is that I've no other option for my project and this feels like the one I've to go all the way !You can buy assembled modules that would do just that 220v -> 12v 150mA but I can trust those vendors, also they add significant cost to my design.I'm really thinking about winding the transformer myself, but I don't want to fall into a deadly trap !Thanks.Ben.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: December 12, 2010, 11:47:04 am
content: Power Integrationsalso do loads of simple SMPS controllers for small mains PSUs like this, and I think they have teamed up with a magnetics supplier to provide standard transformers.But why reinvent the wheel? - there are a gazillion ready-made PSUs available off the shelf at prices not much more than you could make them for, and someone else has already done the safety engineering and got all the approvals work done.Unless you have a particularly unusual space constraint which can't be met with an off-the-shelf unit, or are into very high volumes I don't think you will save any money by rolling your own, even from a standard chipset.Incidentally if you need a non-isolated supply for more than practically can be done with a capacitive dropper, Power Integrations have some really nice cheap chips to implement mains-input buck regulators -Linkswitch TN series

author: Neilm
author_rank: Super Contributor
timestamp: December 12, 2010, 12:06:39 pm
content: In order to be sure of your safety, you would have to make sure that the transformer is done correctly. It is the device that gives you the isolation from mains. To do this, you have to ensure that either the secondary winding is done with wire that will not breakdown or you have to put sufficient insulation between it and the other windings. A commercial company will flash test each supply they build. Depending on the rating, this test will be either 1.5kV or 3kV.It depends on the turns ratio of the transformer and the current outputs you require on how easy it is to wind. Most transformers will use very fine wire, 38 AWG (as mentioned in the app note) has a diameter of 0.1mm. Those are very fine wire strands. If you are winding your own then remember that the transformer wires should lie beside each other in a layer rather that getting over lapped. If they do overlay, you will end up with problems winding the next layer and you can get voltage build ups which will cause the transformer to break down and fail. I am assuming that you don't have any sort of machine to help you wind. Also, counting the turns can be a problem, even if you are only putting on 30 or so.Also, pay attention to how you layout the whole circuit. In a good quality commercial design you will see that there is a division between the low voltage side and the mains side - This will be typically 5-6mm. The only things that will straddle this division are the transformer and opto-isolator. Both the devices should not only be rated for mains use, but also should be able to take mains transients (spikes) that household mains can have. If you want an idea of these, imagine running a vaccume cleaner then pulling the plug on it. The motor will keep spinning and will produce quite a large voltage spike.With all that I have said above if you do want make your own SMPS by all means go ahead. Enjoy. Getting the first one you have designed working is really satisfying. But do remember - if you have built your own supply, and wound your own transformer you can not be sure that your supply will be as safe or provide as much isolation as a bought supply. I usually assume that anything I connect to a SMPS module that is not tested is a live circuit and don't touch. I would recommend getting a transformer wound by a company like coilcraft - you can specify in the instructions that the transformer should have the required isolation between primary and secondary. They should be happy to test this for you.YoursNeil

author: Zero999
author_rank: Super Contributor
timestamp: December 12, 2010, 05:52:17 pm
content: Quote from: Neilm on December 12, 2010, 12:06:39 pmYes and the space between the primary and secondary side PCB traces needs to be enough to ensure adequate isolation.

author: TechGuy
author_rank: Regular Contributor
timestamp: December 13, 2010, 10:30:44 pm
content: Quote from: benjius on December 11, 2010, 09:26:13 pmGoing for the flyback is overkill in my option for a small 5V/3.3V 500ma power supply. These days you you buy very small PCB mount transformers. Alternative you can power your device using a wall wart that supplies 12VDC (or AC if you prefer) and just use a wall wart power connector on the PCB.The problem with a flyback your need to rectifiy the mains and then switch it at a much higher frequency, (at least 25 Khz for good regulation and no audiable switching noise).Yes, you can wind your own flyback transformed. But look for a "split core" transformer to isolate the primary (mains) from the secondary. for strong isolation. You can also wind the primary and lay the secondary on top with a good creepage insulator to isolate the two windings, You can't really do a bifiar winding since it does really provide sufficient isolation.My advice when it comes to experimenting with SMPS, is to start off with a low voltage (less than 40VAC -through a transformer) so that you don't kill yourself while learning and experimenting. After you have built a few designs using low voltage AC you can move up to full AC. When you test your SMPS that operates off mains, besure to use an isolation transformer and severely underrated fast-blow fuse. This way if something goes wrong the fuse will blow fast and perhaps enable you to salvage most of your circuit. Its very easy to get something wrong and have your whole circuit go up in smoke before your finger finishes throwing the switch, leaving you a collection of expensive destroy components.The big issue with Flybacks is that they are very noisy and not really a good for digital logic. A flyback works by draining the energy stored in the transformer core. It does not supply current when the primary is energized. Because of this design, Flybacks are very limited in the amount of energy they can provide. The duty cycle of a flyback is limited to about 50%. meaning for 50% of the the core does not provide energy to the output, and must be supplied by the output cap and output inductor. The issue is that under a high load condition, you need to use large output inductor and capacitors, which take up a lot of space. Flyback don't adjust input power to match the load demand. They simply dump a selected amount of energy into the transformer core, which is drained by the secondary winding after the primary is turned off. A forward convert, push-pull, half-bridge, full bridge design work with the primary. As the output load increases the inductance on the primary falls and permits more current to flow with each switching cycle.Consider that SMPS has a considerable learning curve, and may not be worth your time spend 100s to 1000s of hours learning about it if all you want to do is power a 5V/3.3V digital devices. FWIW: I have spent well over a 1000 hours of learning about SMPS and I certainly don't feel I am an expert by any means.

author: NiHaoMike
author_rank: Super Contributor
timestamp: December 13, 2010, 10:40:06 pm
content: I'm sure virtually all of those small wall warts use flyback converters. And because they're so common and cheap, there's little point in building your own unless you have special requirements or planning for very large volume production.

author: benjius
author_rank: Contributor
timestamp: December 14, 2010, 08:31:29 am
content: Hi All,Thanks for all the great responses.What got me in this trouble of building a SMPS off mains was:Size: (my board must fit in a 6x6 cm board and it must be self powered from the mains)Safety.US / EUR Regulations. (standby consumption)US / EUR compatibility (220 and 120 volt 50/60Hz input range)The trouble with a regular transformer+rectifier+linear regulator is the size and weight, I don't know how small can you go with those PCB transformers without going too bizarre and costly.mikeselectricstuff: thanks for the advice, I checked their products and downloaded the software.The range of devices they offer is very comprehensive , also they have some interesting features that will make my design a lot easy I decided to buy a dev kit form them and start my testing.Neilm: I've observed the wiring layout after you told me I was surprised to confirm that you can't overlap the wires making it very difficult to do by hand, I will either order them online or to a local business.TechGuy: Yes I've found many things I did not know about this kind of design that make it quite difficult for young players like me, for example the clamping of the primary to avoid destroying the MOS when is off, there seem to be books written sole on clamping techniques.These guys (ST, PI, TI, LT) will give you a reference design but if I need more output power or less ripple things get messy, I found myself lost in calculations I can't even start to comprehend.I must agree that there is a huge learning curve in flyback converters, and Im thinking It will take me several months of my life just to learn the basis of SMPS, that's why I decided to buy a devkit from PI and hope for the best. (house insurance checked in)Thanks AllBen.

author: Psi
author_rank: Super Contributor
timestamp: December 14, 2010, 09:29:00 am
content: i quite like to use POT cores for small dc/dc psus.You can buy them ready for winding with separate areas for the primary and secondary coils.Also you can unwind one coil without having to unwind the other so they are good for testing different turn ratios.They have a separate entry/exit for primary and secondary connections which keeps them nice and isolated and some have terminals built onto the bobbin.They also have good shielding characteristicsCan't say ive used one for a 230v psu tho.POT bobbinPOT coreJust make sure you get the right core type for what you're doing, some have air gaps in the middle.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: December 14, 2010, 10:39:20 am
content: Here are some off-the-shelf PCB-mount units that would fit your 6x6cm space :http://www.meanwelldirect.co.uk/products/05W-Single-Output-On-board-Type-Medical-PSU/NFM-05-Series/default.htmhttp://www.uk.tdk-lambda.com/KB/129126997916305460_KPSA%20Series%20Jan%2010.pdfhttp://www.rapidonline.com/netalogue/specs/84-2626.pdfBear in mind that with a seperate PSU you may have more space on your board for the rest of the circuitry

author: qno
author_rank: Frequent Contributor
timestamp: December 14, 2010, 03:20:37 pm
content: If its for a consumer/commercial product remember the following:Insulation voltage of 4000 Volt min between primary and secondary windings and the optocoupler to get UL/CE approval. Yes, it is not only the multimeters that are tested.You may need power factor correction.Conductive and radiated emissions.I think it is best to get an UL/CE/CSA approved wall wart for the 5 V you need.

author: Zero999
author_rank: Super Contributor
timestamp: December 14, 2010, 07:55:46 pm
content: Quote from: Psi on December 14, 2010, 09:29:00 amUnfortunately there isn't enough creapage between the primary and secondary for mains.Quote from: qno on December 14, 2010, 03:20:37 pmI don't think power factor correction is a requirement for small power supplies.

author: Psi
author_rank: Super Contributor
timestamp: December 14, 2010, 10:19:59 pm
content: Quote from: Hero999 on December 14, 2010, 07:55:46 pminteresting, could you use a 3 coil space bobbin and just wire the topmost and bottommost space

author: Zero999
author_rank: Super Contributor
timestamp: December 14, 2010, 10:21:22 pm
content: Quote from: Psi on December 14, 2010, 10:19:59 pmI don't see why not.

author: TechGuy
author_rank: Regular Contributor
timestamp: December 14, 2010, 10:45:40 pm
content: Quote from: benjius on December 14, 2010, 08:31:29 amI would suggest using a small PCB mount 50/60hz transformer that puts out 12-14VAC @ 120VAC and 24-28VAC @ 230VAC and use a 5V simple switcher cascade with 3.3V linear regulator. This will have:a small PCB footprintMains IsolationStrong voltage regulationPermit Operation at both 120 (USA) and 230 (Euro)High efficiency ~85% efficientKeeps the design simple!http://www.national.com/analog/power/simple_switcherSimple Switchers are Buck regulators and are much more efficient than Linear regulators. The also have a wide voltage input range (Standard: up to 37VDC and High Voltage Version up to 60VDC). You need to add a Pi filter in series with the Buck output inductor to remove noise for digital logic use. I use simple switchers in most of my designed so they can operate with a wide input voltage. For the Simple switchers use the small ferrite inductors (you can use them for both the Buck inductor and the PI filter inductor).http://www.cooperet.com/library/products/PM-4139%20DR1050%20Series.pdf(example of small SMT Inductor).LM2575-5 Simple Switcher Regulatorhttp://www.onsemi.com/pub_link/Collateral/LM2575-D.PDFI would recommend including a PTC fuse, a small input inductor and a TVS Avalache diode betwee the transform output and the simple switcher. the PTC,Inductor, TVS diode will protect the simple switcher from voltage spikes. Simple switchers have built in over current protect and will limit the output current.For the simple switcher, your learning curve is very small. You can hack a breadboard design in about 10 minutes using the reference designed provided in the datasheet. The advantage of the simple switcher is that its a monolithic device containing the controller, the switching transistor and the feedback loop circuity. Also reduces the PCB real estate requirment.If you like double isolation take a look at Linear's Simple Flyback Converter:http://www.linear.com/pc/productDetail.jsp?navId=H0,C1,C1003,C1042,C1113,P112208Although the Buck regulator powered using a PCB transformer will be more efficient than using the Isolated flybuck controller.

author: TechGuy
author_rank: Regular Contributor
timestamp: December 14, 2010, 11:26:37 pm
content: Quote from: AcHmed99 on December 14, 2010, 10:40:09 pmFYI:Leakage inductance is irrelevant in Flyback converters since energy is not transferred using primary-secondary coupling. Flybacks don't use Primary-secondary coupling. It uses the energy stored in the core.Flyback operation:Primary On, Secondary off - Primary dumps magnetic energy into the transformer corePrimary Off, Secondary On - Secondary drains magnetic energy from the transform core.http://www.eetimes.com/design/power-management-design/4012069/Flyback-transformer-tutorial-function-and-designInductance leakage matters with forward converters, push-pull, half-bridge and full bridge. Flybacks are typically used for high voltage operation since the primary and secondary can be placed very far apart, Typically on opposite sides of a U-core transformer (ie TV Flyback transformers providing 30KV for the picture tube -- Well when TVs had picture tubes!)

author: TechGuy
author_rank: Regular Contributor
timestamp: December 15, 2010, 02:21:20 am
content: Quote from: AcHmed99 on December 15, 2010, 12:47:09 amSorry AcHmed, but your confusing Forward\PushPull\Etc with Flyback. There is no Primary to Secondary coupling with flyback circuit. Pri-to-sec. Coupling only happens when the Secondary draw energy from the primary, while the Primary is on. In a Flyback, the Primary is off when the Secondary draws energy from core. It works like a Buck converter but instead of a single shared winding, its split into to separate windings for isolation. The quote from the book you included is for non-flyback converters.http://www.eetimes.com/design/power-management-design/4012069/Flyback-transformer-tutorial-function-and-designSee Figure 2.http://en.wikipedia.org/wiki/Flyback_converterQuoteQuoteIt doesn't matter how close you make the coupling between the primary and secondary in a flyback converter. Do a Bifiar winding and try it in a Flyback circuit the inductance leakage will be the same if you wind the transformer on opposite legs of a U-Core.Inductance Leakage is measured by connecting the primary to a inductance meter while the Secondary winding is shorted. However in a flyback, the Secondary operates like a open circuit because the diode on the secondary is in blocking mode while the primary is turned on. The Leakage inductance matches the primary inductance. The only way to minimize leakage inductance in a flyback is to make the primary inductance very low and switch at a very high frequency to delivery power. But this has a trade off because, higher switch frequencies cause higher switch loses.In a typical AC Mains transformer, the Primary and secondary are separated using a spilt bobbin. Take a look at any AC mains linear PS transformer and you see that is split if you remove the top layer tape. The Standard EU guidlines for AC transformers is about 2 mm of creapage between the secondary and Primary windings. Split bobbins are also used to minimize capacitive coupling in AC Mains transformers so that differential noise isn't transferred to the secondary.

author: scrat
author_rank: Frequent Contributor
timestamp: December 15, 2010, 09:11:06 am
content: IMHO, in a flyback, although you want (differently from a common transformer) energy to be stored into the core, there must be a good coupling effect.This is evident if you imagine the transformer with a parallel inductance. This inductance gets energized when the switch is on and then, when switch goes off, energy into the inductor is transferred to the secondary, forcing the diode to conduct since inductor tends to maintain its current.In other words, you can see it as there must be a good coupling between the core and each of the windings (to transfer the energy between one side to the core and the core to the other side), which translates into a good coupling between the two windings. Otherwise, some energy will be discharged into the primary, or the current will increase at each cycle.This is my view of the problem, not necessarily the truth.

author: qno
author_rank: Frequent Contributor
timestamp: December 15, 2010, 02:28:55 pm
content: Did you have a look at the Tiny Switchers of Power Integration?http://www.powerint.com/en/products/tinyswitch-family/tinyswitch-iii

author: Zero999
author_rank: Super Contributor
timestamp: December 15, 2010, 07:06:00 pm
content: Well it's true that a gap in the bobbin will increase the leakage inductance and that this is not optimal but this is only a small power supply and the negative feedback via the opto should minimise the effect so it's no big deal.

author: elmo
author_rank: Contributor
timestamp: December 15, 2010, 07:12:01 pm
content: Quote from: Hero999 on December 14, 2010, 07:55:46 pmIn the EU/EFTA area you need PFC if the power consumption is 75W or more. Though I guess this only apply if you plan to have the power supply in some kind of commercial product.

author: Zero999
author_rank: Super Contributor
timestamp: December 15, 2010, 11:44:40 pm
content: Exactly, he only needs 2.5W so even if it's a commercial product, that won't be an issue.Another thing I've realised about having a high leakage inductance is that you'll need more suppression on the primary side as less of the stored energy will be transferred to the secondary, yes it's not efficient but it's a small SMPS powered off the mains so it's not an issue.

author: uniment
author_rank: Newbie
timestamp: January 19, 2011, 09:58:33 am
content: Leakage inductance can be particularly troublesome when operating your flyback at full load. It has a tendency of breaking your circuit (in particular, the pulldown switch). As an example, if your coupling coefficient is k=95%, then the leakage inductance Le is 10% of the magnetizing inductance Lm. Therefore, 90% of the energy gets delivered to the load, and 10% of the energy is delivered straight into the switch's parasitic capacitance. Since this capacitance is small, the voltage tends to spike up very high—above the switch's voltage rating, and causing dielectric breakdown in the silicon. Time to warm up the soldering iron, because your circuit won't work after that.This is often handled by using an RCD snubber, which clamps the switch voltage and burns the leakage inductance's energy (it decreases efficiency, but at least your circuit doesn't break). Additionally, people often buy or make special flyback transformers which maximize Lm and minimize Le. An alternative to the snubber is to use an active clamp, which prevents the switch from breaking and then recycles the leakage inductor's energy back into the transformer—thereby keeping high efficiency even if the transformer has high leakage.Much of the reason people are moving toward rectifying the mains immediately using high voltage diodes and then performing DC-to-DC conversion (instead of the old way of transforming it first, then rectifying it like in wall warts) is because of the frequency involved. Remember that fundamentally, transformers are coupled inductors—they rely on inductance. At low frequencies (such as 50 and 60Hz), a small-valued inductor behaves more like a resistor than an inductor. At those low frequencies, a small transformer's primary also behaves like a resistor, and very little energy is delivered to the secondary. Efficiency is low, and lots of heat is generated. Therefore, for low frequencies, you need to use a big transformer (high inductance, low DC resistance). In order to miniaturize the transformer, you need to operate at higher frequencies. DC-to-DC converters often work in tens or hundreds of kHz, allowing the use of much smaller parts (smaller transformers and filtering capacitors)... at the cost of requiring diodes and transistors that can handle high voltage.