There are many different approaches to designing a flyback converter depending on whether you are using an off-the-shelf transformer, a random core from the junk pile that looks about right, or a known core purchased from a reliable distributor. For the beginner in SMPS design the 2nd option is the worst because of too many unknowns.
The first thing to keep in mind about the flyback transformer is that it is really a multi-winding coupled inductor, and not a true transformer per se (but everyone calls it a transformer anyway, including me). This is because current is only flowing in either the primary or the secondary at any given time, never both, so each winding acts like an inductor. The second important point is that ALL of the energy delivered to the output has to be stored in the flyback transformer first. The third point is that the windings are all linked together by conservation of amp*turns (AT or A*T)and so the primary acts like a current sink (storing energy in its inductance) while the secondary acts like a current source. The upshot of this is that the relative voltages across each winding will be fixed by the turns ratio - as in a true transformer - but the absolute voltages are not fixed, just as is expected of a current source.
For example, if current ramps up from 0A to 10A in a 10t primary while the switch is on, then the current exiting the secondary immediately upon switch turn off will ramp down from a level of (10A * 10t)/Nsec. If the secondary is 1t then the current will attempt to ramp down from 100A; if the secondary is 20t then current will ramp down from 5A, etc. Of course, for current to flow in the secondary there needs to be a load across it, and
it is the load resistance which sets the output voltage! So if the secondary winding has 10t - same as the primary - and we put a 1R resistor across it then the peak secondary voltage will be 10V. How about a 100R resistor? Well, to get 10A to flow through 100R you need 1kV... Hence one of the reasons why the flyback is so popular for high output voltage applications. It's also why you never want to run a flyback unloaded if the controller IC can't do pulse-skipping or otherwise shutdown the switch drive signal if the output voltage rises too high.
There Ain't No Such Thing As A Free Lunch, however, and in this case the voltage across the secondary when its diode is conducting is reflected back across the primary through the turns ratio, and this reflected voltage, plus the input voltage, is what the switch must withstand when it is off. Similarly, when the switch is on the voltage across the primary is reflected across the secondary through the turns ratio and adds to the voltage the secondary diode must withstand (on top of the output voltage). Hence why I said the relative voltages across each winding are always enforced through the turns-ratio, even if the absolute voltage transformation ratio is not fixed.
All this means that we use the inductor equations to design the primary of the flyback transformer, and then select an appropriate turns ratio to trade off peak currents and voltages in both the primary switch and the secondary diode. If we use a step-down ratio then we reduce peak primary current (when the switch is on) but increase peak primary voltage (when the switch is off off), and vice versa for the secondary diode.
The relevant equations for an inductor are:
E in Joules = 0.5LI² (where E is in uJ if L is in uH and I is in amps)
L * dI = V * dt (where L is uH if dt is in us and dI is in amps)
However, the wide range of flexibility in duty cycle, frequency, turns ratio and even inductance in a flyback can make it somewhat maddening to design, so the best approach to take will depend on initial limiting conditions. For example, if you are using a salvaged core that you don't have full specifications on - and especially if you are manually introducing an air gap - then you might need to make frequency a dependent variable to achieve the necessary power throughput (a word of advice: your life will be much easier if you use pre-gapped core sets from DigiKey, Mouser, etc.).
Duty ratio is also a bit of a wild card in that the maximum allowed by the controller IC (e.g. - the TL494 is 45% per output) is not necessarily the limit when a flyback is in DCM. For example, duty Cycle in a transformer isolated flyback with a Npri:Nsec turns ratio specified by n is:
D = (n * Vout) / ((n * Vout) + Vin)
So if the transformer has a 2:1 step down ratio (ie, n = 2) and Vin[min] is 10V then the calculated duty cycle is 0.50, which means the switch on time and diode on time will be equal. In discontinuous conduction mode (DCM), however, all of the windings go to 0A for some portion of each switching period, so it would be perfectly reasonable for switch on time to be, say, 7us and diode on time to also be 7us, but total period at 50kHz is 20us, so that means for 6us each switching period all of the windings have stopped conducting (but then you get the infamous DCM ringing, as I pointed out previously). The way you ensure DCM is by *lowering* the primary inductance (which also causes peak current to rise).
Use the website below to play around with turns ratio, frequency, inductance, etc., in a flyback:
http://schmidt-walter-schaltnetzteile.de/smps_e/spw_smps_e.htmlJust ensure that Ton doesn't exceed 9us at Vin[min] and 50kHz fsw, of course.
Faraday's equation - the one you have found in a wide variety of formats - is only needed to check that the flux swing isn't too wide, leading either to saturation (which is disastrous) or just excessive core loss (which in most ferrites is proportional to around the 2.5 power of total flux swing).
Finally, there are pre-gapped ferrite cores available commercially which are usually specified by A
L in nH/t², and this usually assumes the use of one unground half and one ground half. Needless to say, pre-gapped cores are going to be a lot more predictable and consistent than attempting to insert spaces between ungapped cores you salvage. Also beware that magnetic amplifiers are commonly used in ATX power supplies to derive lower voltage rails without requiring another winding on the transformer and the cores that are used in this application are extremely unsuitable for use as flyback transformers (or regular chokes).
EDIT: Changed N -> n in formula above