Table of Contents
Sometimes it is fun to start with a completely unknown component and see what’s possible with it! After exploring briefly a commercial high-voltage supply ( High-Voltage Bertan Power Supply: Peeking Behind the Cover ) I picked up some cheap ($1) parts known as flyback transformers. The particular transformers were not of very high quality and they are held together with sticky tape! I think they are pulls from equipment, and had no documentation.
This blog post shows how I went about using them, and hopefully in the process can serve as an introduction to Flyback circuits too. By the end of the blog post, it should be clear, from slightly more than a birds-eye view at least, what such circuits are about and how they work.
The end result of the project was an ultra-cheap (under $10), fairly high voltage supply (exceeding 600VDC open circuit) that is capable of supplying close to 1W of power. It is definitely not something you’d want to touch at the output when switched on! If you decide to build this, please take care.
The flyback transformer that was used is shown in the photo below. It is about half a cubic inch (actually 26 x 20 x 16 mm) and looks like a baby version of something known as a LOPT (short for Line Output Transformer, as they were known, when they were used in old cathode-ray tube televisions). There is a teardown of a LOPT here. The LOPT was used to generate over ten thousand volts because that is what CRTs needed. In contrast, this project will generate 600V or so as mentioned.
For more details about flyback transformers, there is currently an Experimenting with Flyback Transformers Design Challenge, so hopefully, there should be plenty of blogs soon.
This blog post takes an almost no-maths approach. There’s no datasheet for the transformer either, but it’s not a case of entirely flying by the seat of the pants, since we can measure, build, test, and iterate if needed, which is explained in the blog.
This circuit develops high voltages and could be dangerous, even when switched off. I’m not recommending this circuit for any purpose. Furthermore, there are plenty of opportunities for parts to explode into pieces, so you should take precautions (such as eyewear, and don’t leave the circuit powered and unattended or with children).
What is a Flyback Power Supply?
In brief, a flyback power supply relies on storing energy using inductors. The basic outline is that power is applied to an inductor (the diagram below shows that occurring with a MOSFET switch), and current begins to ramp up in the coil of wire. The magnetic field increases, i.e. magnetic lines of flux build up within the core (shown as yellow lines in the diagram).
Next, the power is disconnected from the inductor, and the magnetic flux collapses, and this causes a voltage to be created (i.e. induced) in the red coil of wire, but no current can flow since the inductor is disconnected.
If there is another inductor closely coupled (i.e., on the same core), then since the flux was created through that core path, a voltage is induced in the secondary (green) inductor too. A diode and capacitor across the output of that secondary inductor will allow current to flow and charge the capacitor. Effectively, the energy that was stored by the primary inductor by way of the magnetic flux is transferred to the secondary. The cycle is then repeated, and power is reapplied to the first inductor.
Note that the output diode only allows current to flow during the ‘flyback’ period, and not during the ‘forward’ period, due to the location (or orientation) of the diode. If it were not connected as shown, then very little energy would be stored using the magnetic flux, and energy would almost simultaneously be passed to the secondary side; that’s known as a forward converter, which we are not building!
Anyway, back to the flyback topology; although the principle is shown in the diagrams above (and it can vary depending on the on and off times! For example, the energy might not have been completely transferred before the MOSFET switches back on again), the devil is in the detail, as can be seen in the real-world traces when this is attempted. This will be seen further below. For instance, as will be seen later, the model of the MOSFET drain voltage is too vague an approximation to build a flyback circuit; instead, it will look more like the diagram here:
There’s no information about the transformer, so it makes sense to try to measure a few parameters, so that the circuit design isn’t done entirely blind.
The inductance of each winding was measured, at a few different frequencies, to determine the best frequency of operation. This measurement is known as an open circuit inductance measurement.
To do it, all that needs to be done is clip your inductance meter to the primary winding and make sure that all other windings are open-circuit.
The inductance is the blue line in the chart below, and it can be seen from the blue box that the winding is only usable up to about 60 kHz. Beyond that, the measurements are unusable because we then approach the self-resonant frequency.
It is also good to measure if your meter supports it, the parallel resistance (Rp) in the inductor model (you may be modeling the inductor as having a series resistance; it’s up to you. I clicked on ‘parallel’ in the meter options, but your choice depends on whether it can be measured accurately at the inductances of interest so check your meter user manual). The Rp value shows the core loss; it is inversely proportional. Therefore, I want to use the winding at a frequency where the Rp value (the orange line in the chart above) is reasonably high. At around 10 kHz, the Rp value is pretty low. So, anything in the ballpark of 20-50 kHz or so is a great choice! Since the rest of the circuit will also have inefficiencies that could be worse, I will pick a frequency toward the low end of the acceptable range, i.e., circa 20 kHz.
Note: if you don’t have an inductance meter (some are reasonable cost, e.g. MP700434 ) there are other ways to measure unknown transformers! For instance, you could use a signal generator, create a potential divider using a resistor and the transformer winding, and measure the amplitude with a ‘scope.
What Turns Ratio?
I didn’t know the turn ratio of the transformer either! However, it is easy to deduce by measuring the secondary side inductance. As seen from the chart below, it is about 1.8 H in the frequency region that we plan to use.
By also using the result from the first chart, the primary to secondary inductance ratio is therefore about 114e-6 : 1.8 which after expressing as a fraction, becomes 6.3e-5. The winding ratio is the square root of that, i.e., about 0.008, or 1:125 back as a ratio. I planned to use a 5V power supply, so a 600V output should be feasible.
Circuit Plan of Attack
Now that I knew some basics about the transformer, it was time to figure out what sort of circuit would be used! Ordinarily, a dedicated switching supply IC would be used, because it would contain all the important stuff: the oscillator, a MOSFET driver, and a feedback loop, plus some circuit protection. I decided just to use a 555 timer chip and drive a discrete MOSFET directly from it. With no control algorithm, I won’t be able to have any voltage regulation, and the efficiency will likely vary since the output frequency and duty cycle will be fixed.
The rest of the blog describes the circuit and how it was tested. The complete circuit diagram is also available toward the end of the blog.
Snubber or ‘Reset’ Circuit
Every time the MOSFET switches off, the voltage at the drain will shoot up because not all energy is transferred to the secondary (due both to the transformer and the circuit). Worse still, the magnetic flux lines won’t wholly collapse and then for all the subsequent times the MOSFET switches on, less and less additional flux is created (i.e. a limit is approached, known as saturation). A circuit is needed on the primary side to help get rid of this effectively ‘leakage energy’ (and reduce the voltage spike since it could destroy the MOSFET) and the simplest uses a free-wheeling diode and an RC circuit. It is known as an RCD circuit since it uses a resistor, capacitor, and diode. This will take a bit of experimentation since we don’t know all the parameters. Also, it’s not a good idea to use a breadboard for a prototype since that will very likely have higher voltage spikes and worse ringing, so it’s a better idea to do this on a circuit board or copper-clad board rather than a breadboard as I went ahead and did!
The end circuit that was used is described further below.
Although it’s possible to use an additional winding on a transformer to make a primitive oscillator, this is not as flexible as having a dedicated IC doing that, so in the aim of remaining a bit civilized we won't create a completely Minimal Viable Flyback, but an almost-MVF. I used a TLC555 timer chip (actually, I used half of a double-timer TLC556 since that was all I had). The TLC555 is an improved version of the NE555. The red box in the photo below is a fancy polystyrene 10nF timing capacitor (it’s not necessary; you could use a normal ceramic capacitor!).
The output from the TLC555 will be on pin 3, and that can be used to drive a MOSFET.
I used an FDT86244 N-channel MOSFET, which comes in a large but surface-mount package that needs wires attaching if you really plan on using a breadboard like I did (as mentioned earlier, this is not a good idea; use copper-clad board or a PCB). My prototyping was really ugly. The FDT86244 is a nice choice because it is low-cost, and has quite a high VDS rating, so it is a bit more forgivable if the circuit is initially incorrect. For breadboard use, I first soldered a 100 kohm resistor (R4 in the circuit) across the gate and source connections of the MOSFET, to make it less ESD (electro-static discharge) sensitive.
At the output, don’t make the mistake that I did, and use a 1N914 diode and low-voltage capacitor, and wonder where all the voltage went! I swapped to 1kV-rated parts, and then things were fine. Ideally, 1.5kV or 2kV parts should be used, but I didn’t have them.
You can see the diode and the output capacitor (I used a surface-mount part since that was all I had and converted it to through-hole with soldered wires) in the photo below.
The photo below shows some of the SMD conversions! If the connections are too fragile, the conversion can be made more rugged by encasing in PolyDoh (see In Praise of Polydoh ).
If you’re using the same transformer as me, then for the transformer pinout, refer to the photo at the start of the blog, which has the wires numbered.
The snubber/’reset’ part of the circuit needed some trial and error. The screenshot below shows the easiest signals to probe (but take care because if you look closely at the MOSFET drain voltage, you’ll see that the initial spike is very high, almost 50V (although the amplitude of the spike is hard to see since it is so sharp, the automated measurement at the bottom of the screenshot displays it). The 'scope traces can be compared with the earlier diagram to spot the similarities and differences.
After some experimenting, I decided to use a Zener clamp circuit (it is known as a ZD clamp since it uses a free-wheeling diode and a Zener diode). In parallel, a capacitor and resistor was placed to absorb the ringing since the ZD doesn’t improve that. The screenshot above shows the ringing with a 1nF capacitor, and the screenshot below shows the result with a 10 nF capacitor (I didn’t have any value in between). This has got rid of the ringing, but it should be measured on the actual PCB, not on the breadboard.
In the screenshots above, it can be noticed that the drain voltage never actually reaches 5V. It is slightly higher at about 8V or so. The cause is reflected voltage from the secondary side during the MOSFET off period. However, it looks unusual because there must come a time when the flux has gone, and therefore no more reflected voltage would exist. The reason that is not seen is that the MOSFET off period is too short. Some flyback circuits can detect when the voltage drops back to the supply voltage and then turn the MOSFET back on for the next cycle. My circuit can’t do that, it has a fixed duty cycle of 50%.
Here is what the drain signal would look like if the duty cycle could be changed:
What’s happening with the above trace is that the current flow in the secondary coil eventually depletes to zero, thus, there is no more reflected voltage, and the drain voltage can eventually settle at the expected 5V input voltage level. This is known as Discontinuous Conduction Mode (DCM). Selection of the mode and control either through pulse width or frequency, would allow for voltage regulation and improving efficiency. A proper flyback control IC would be an excellent way to do that. My circuit achieves about 30% efficiency with the component values in the circuit diagram at the fixed output load that I tested against. Experimenting a bit allowed me to see 50% efficiency but at a reduced output voltage. I decided to go for the maximum output I could observe with the single load resistance (that I randomly picked) at the expense of efficiency since I had no way of controlling it dynamically anyway, with the simple 555 circuit used.
The overall circuit diagram is shown below.
Testing the circuit takes a lot of care because you don’t want to damage humans or a ‘scope. I tested the oscillator by temporarily removing the connection to the MOSFET so that the TLC555 output could be checked in isolation. Once I had confirmed I could see a square wave (it is essential to confirm this because you don’t want to be applying a constant DC into the transformer), I disconnected the scope and re-attached the TLC555 output as it should be.
Next, with the power off, I connected the 10:1 ‘scope probe to the MOSFET drain connection, set it to a high scale (for instance 50V per division), and then powered it on, and experimented with tweaks to the snubber circuit (powering off each time a change was made of course, since you don’t want to run the flyback circuit with no clamp!).
After that, I removed the probes and just used a multimeter for the measurements. With no load attached, the output was 988V, which is uncomfortably close to the 1kV-rated limit of the parts; one option could be to have a small load permanently connected. The input current consumption with no load was 245mA. With a 200 kohm resistor load, the output is 405V, with 480mA current consumption, i.e., only about 34% efficient at that load. I didn’t try to find the optimal load, I only tested with a 200 kohm load, which is a 0.8W output load.
Efficiency improvements could be made to the circuit by (say) replacing the 1N4007 with a high voltage Schottky diode, for instance, however, the most improvement would be made by using a real flyback IC rather than a 555. I also didn’t check the output ripple (it's not a good idea to just directly connect that to a normal ‘scope probe), nor check for emissions. The circuit seems stable, however. Some bits get warm (since the flyback circuit is dissipating 1.6W when that load is applied), and 1.2W with no load applied) but I do not think any individual part is dissipating more than a few hundred mW (and I used 1/8W resistors mostly, and a SOT-23-sized zener diode). Anyway, not every application requires efficiency, or it may only be required to operate with a fixed load at which it could be optimized, and in that case, a fixed frequency/duty cycle circuit could be acceptable.
Modifying the Transformer
There’s a minuscule amount of sticky tape protecting the windings, and the two halves of the core are only loosely held together too! A decent transformer is more likely to use metal clips. If the core halves are loose, it is best to remove the sticky tape and then at least apply your own tape more securely, for instance, Kapton tape is not very stretchy and could be a better choice. If you take the transformer apart, be careful not to lose the paper separators that form the required ferrite gap. Alternatively, you could experiment with the gap! (I didn’t). If you need a different turn ratio, windings could be removed (or added) to the primary side. It isn’t practical to adjust the secondary because that will have thousands of turns.
Printed Circuit Board
Note: Although it is currently untested, I did eventually create a printed circuit board layout, and the zip file containing the Gerbers is below.
This is what the board will look like:
Here is the circuit diagram for the PCB:
The circuit is the same as before, except a few extras are added, so that an external signal can be used instead of the 555 if desired, plus there are some resistors on the output of the flyback circuit, to be able to attach measurement circuitry (not recommended to attach an oscilloscope there! just a multimeter).
A transformer was used with a 555 and a MOSFET-based flyback circuit to build a 600V or so power supply that operates from a 5V 450mA power source.
It can supply at least 0.8W of output power. More tweaking with the design would be needed to achieve better efficiency. I didn’t experiment a lot since it would be better to use a properly controlled flyback circuit, but still, it’s nice to see that not a lot is needed to get at least going. I don’t actually have a use for this power supply. I was going to use it to test some neon indicator lamps, but it is overkill for that, I should have picked a smaller transformer. If you can think of interesting applications, please let me know!
The transformer that was used has zero documentation, and some measurements and experimenting were required to get things functioning.
Although I have not created a PCB layout for this project, if anyone is interested, I could be persuaded to do it. (EDIT: A PCB is now created, see below for the Gerber files). It’s not often one needs a 600V power supply, but it could be a fun thing to tweak and experiment with. For anyone wishing to experiment at a low level (i.e. without a dedicated flyback integrated circuit), I’d recommend using a Pi Pico or Arduino and generating your frequency and duty cycle using that. Perhaps it could even be possible to code a feedback loop by using the analog-to-digital (ADC) converter.
Thanks for reading!