You are on page 1of 78

Push pull topology ferrite core turns ratio calculation with example

Let’s start with example. For example we want to design a 250 watt boost up dc to dc converter. We are
using push pull topology for this design. We are using 12 volt battery. We want to step up dc voltage from
12 volt 310 volt. Switching frequency of design is 50KHz. We are using ETD39 ferrite core which can handle
250 watt. It is beyond the scope of this topic to tell how to select ferrite core according to power rating. I
will try to write separate article on it.  The output of ferrite core will be always high frequency square wave
of 50 KHz. We need to use full rectifier to convert it into dc of 310 volt. You may also need to use LC filter to
harmonics or AC components from output.
Push pull topology ferrite core turns ratio calculation with example
Let’s start with example. For example we want to design a 250 watt boost up dc to dc converter. We are
using push pull topology for this design. We are using 12 volt battery. We want to step up dc voltage from
12 volt 310 volt. Switching frequency of design is 50KHz. We are using ETD39 ferrite core which can handle
250 watt. It is beyond the scope of this topic to tell how to select ferrite core according to power rating. I
will try to write separate article on it.  The output of ferrite core will be always high frequency square wave
of 50 KHz. We need to use full rectifier to convert it into dc of 310 volt. You may also need to use LC filter to
harmonics or AC components from output.
Ferrite transformer primary turns calculation
As you know battery voltage does not remain same all the time.  As the load on battery on increases,
battery voltage will be less than 12 volt. With no load with fully charged battery, battery voltage will be near
to 13.5 volt.  Therefore input voltage is not constant, we must consider it while calculating turns ratio of
ferrite core transformer. Cut off voltage for battery is usually 10.5 volt.  We can take it as smallest possible
value of input voltage to boost up dc converter. So we have following parameters now:

Vinput = 10.5 volt


Vout = 310 volt
As we know that formula of turns ratio calculation in
transformer is
N = Npri / Nsc = Vin / Vout

Where Npri is number of primary turns and Nsc is number of secondary turns. We have three know
variables like turns ratio which can be calculated by above equation, input voltage and output voltage. But
we need to calculate primary turns to find secondary turn of ferrite core transformer. Formula to calculate
primary turns for ferrite core transformer is given below:
Npri = Vin * 10^8 / 4 * f * Bmax * Ac
But for push pull it will be half the primary number of turns.
•Where Npi is primary number of turn, Vin( nom) is normal input voltage which in our example is 10.5 volt.
•Bmax is maximum flux density. The unit of maximum flux density is Guass. Remember if you are using
Tesla unit for maximum flux density, IT = 10^4 Guass. The value of maximum flux density is usually given in
data sheet ferrite core. We usually take value of Bmax between 1300G to 2000G.  This is usually a
acceptable range for all ferrite core transformers.  Note : High value of flux density will saturate the core
and low value of flux density will lead to core under utilization. For example we will take 1500G for dc to dc
converter example.
•f is switching frequency converter. In our example switching frequency of dc to dc converter is 50 KHz.
•Ac is effective cross sectional area of ferrite core. We have to refer data sheet for this value. In this
example, we are using ETD39 core. The effective cross sectional area of ETD39 is 125mm^2 or 1.25cm^2.

We have all the values to calculate primary number of turns .i.e.


Vin = 10.5 volt, Bmax = 1500G, f = 50 KHz, Ac = 1.25 cm^2
By putting these parameters in two above formula, we can calculate turns primary number of turns.
Npri = 12 . 10^8 / 4 . 50000 . 1500 . 1.25  = 3.2
Hence Npri  = 3.2 But we cannot use fractional turns. So we need to round off primary turns calculated
value into nearest whole number 3. The nearest possible whole number is 3. primary number of turns for
ferrite core is 3. But before that we need check either for Npri = 3 Bmax is within acceptable range or not.
As I have mentioned above the acceptable range for Bmaz is 1300-2000G. But the question is why we need
to check the value of Bmax again? Because we adjust the value of primary turns from 3.2 to 3. So let’s
calculate value of Bmax for Npri = 3 by using above forumla.
Bmax = Vin * 10^8 / 4 * f * Npri * Ac
Bmax = 12 * 10^8 / 5 * 50000 * 3 * 1.25 = 1600G
So calculated value of Bmax is 1600G which is within acceptable range of maximum flux density. Its mean
we can take Npri = 3 for further calculations. Primary number of turns for push pull ferrite center tap
transformer is 3 turns + 3 turns. In any design you will need to adjust the value of Npri if it is in fraction.
You can easily adjust it. But you need to check value of Bmax every time. We start with assume value of
Bmax and calculated Npri. But you can also start with assume value of Npri and check the value of
maximum flux density Bmax. For example suppose a value of Npri =1 and check the value of Bmax and
keep repeating this process, until it is become in acceptable range.
Ferrite transformer secondary turns calculation
Now let’s move to secondary turn of ferrite core. In our design the output of dc to dc converter is 310 volt
at any input voltage. Input voltage is variable from 10.5 volt to 13.5 volt. We will need to implement
Feedback to get regulated 310 output voltage. So we will take little bit higher value of output voltage so
that at minimum possible input we can still get output voltage of 310 volt by changing the duty cycle of
PWM. So we should design a ferrite core transformer with secondary rated at 330 volt.  Feedback will
adjust the value of output voltage by changing the duty cycle of PWM.  You should also take care of losses
and voltage drops across switching devices and you should take them into account while designing
transformer.
So transformer must be able to supply 330 volt output with input of 13.5 volt to 10.5 volt.  The maximum
duty cycle for PWM is 98% and rest 2% is left for dead time. During minimum possible input voltage duty
cycle will be maximum.  At maximum duty cycle of 98%, input voltage to transformer is 0.98 * 10.5 = 10.29
volt.
By using voltage ratio formula of transformer = voltage ratio = 330 / 10.29 = 32.1. Voltage ratio and turns
ratio in transformer is equal to each other. Hence N = 32.
So we know all values to calculate secondary turns of ferrite core transformer.

N = 32, Npri = 3
Nsec = N * Npri = 32 *3 = 96
So number of primary turns is equal to 3 and number of secondary turns is equal to 96. So it is all about
turns ratio calculation for high frequency transformers.
How to Calculate Ferrite Core Inverter Transformer
Calculating a ferrite core transformer is actually quite simple, if you have all the specified parameters in hand.
For simplicity, we'll try to solve the formula through an example set up, let's say for a 250 watt transformer.
The power source will be a 12 V battery. The frequency for switching the transformer will be 50 kHz, a typical figure in most
SMPS inverters. We'll assume the output to be 310 V, which is normally the peak value of a 220V RMS.
Here,the 310 V will be after rectification through a fast recovery bridge rectifier, and LC filters. We select the core as ETD39.
As we all know, when a 12 V battery is used, it's voltage is never constant. At full charge the value is around 13 V, which keeps
dropping as the inverter load consumes power, until finally the battery discharges to its lowest limit, which is typically 10.5 V.
So for our calculations we will consider 10.5 V as the supply value for Vin(min) .
Primary Turns
The standard formula for calculating the primary number of turns is given below:
N(prim) = Vin(nom) x 108 / 4 x f x Bmax x Ac
Here N(prim) refers to the primary turn numbers. Since we have selected a center tap push pull topology in our example, the
result obtained will be one-half of the total number of turns required.
•Vin(nom) = Average Input Voltage. Since our average battery voltage is 12V, let's, take Vin(nom) = 12.
•f = 50 kHz, or 50,000 Hz. It is the preferred switching frequency, as selected by us.
•Bmax = Maximum flux density in Gauss. In this example, we'll assume Bmax to be in the range of 1300G to 2000G. This is the
standard value most ferrite based transformer cores. In this example, let’s settle at 1500G. So we have Bmax = 1500. Higher
values of Bmax is not recommended as this may result in the transformer reaching saturation point. Conversely, lower values
of Bmax may result in the core being underutilized.
•Ac = Effective Cross-Sectional Area in cm 2. This information can be collected from the datasheets of the ferrite cores. You
may also find Ac being presented as Ae. For the selected core number ETD39, the effective cross-sectional area furnished in
the datasheet sheet is 125mm2. That is equal to 1.25cm2. Therefore we have, Ac = 1.25 for ETD39.
The above figures give us the values for all the parameters required for calcuating the primary turns of our SMPS inverter
transformer. Therefore, substituting the respective values in the above formula, we get:
N(prim) = Vin(nom) x 108 / 4 x f x Bmax x Ac
N(prim) = 12 x 108 / 4 x 50000 x 1500 x 1.2
N(prim) = 3.2
Since 3.2 is a fractional value and can be difficult to implement practically, we'll round it off to 3 turns. However, before
finalizing this value, we have to investigate whether or not the value of Bmax is still compatible and within the acceptable
range for this new rounded off value 3.
Because, decreasing the number of turns will cause a proportionate increase in the Bmax, therefore it becomes imperative to
check if the increased Bmax is still within acceptable range for our 3 primary turns.
Counter checking Bmax by substituting the following existing values we get:
Vin(nom) = 12, f = 50000, Npri = 3, Ac = 1.25
Bmax = Vin(nom) x 108 / 4 x f x N(prim) x Ac
Bmax = 12 x 108 / 4 x 50000 x 3 x 1.25
Bmax = 1600
As can be seen the new Bmax value for N(pri) = 3 turns looks fine and is well within the acceptable range. This also implies
that, if anytime you feel like manipulating the number of N(prim) turns, you must make sure it complies with the
corresponding new Bmax value.

Oppositely, it may be possible to first determine the Bmax for a desired number of primary turns and then adjust the number
of turns to this value by suitably modifying the other variables in the formula.
Secondary Turns
Now we know how to calculate the primary side of an ferrite SMPS inverter transformer, it's time to look into the other side,
that is the secondary of the transformer.
Since the peak value has to be 310 V for the secondary, we would want the value to sustain for the entire battery voltage
range starting from 13 V to 10.5 V.
No doubt we will have to employ a feedback system for maintaining a constant output voltage level, for countering low
battery voltage or rising load current variations.
But for this there has to be some upper margin or headroom for facilitating this automatic control. A +20 V margin looks
good enough, therefore we select the maximum output peak voltage as 310 + 20 = 330 V.
This also means that the transformer must be designed to output 310 V at the lowest 10.5 battery voltage.
For feedback control we normally employ a self adjusting PWM circuit, which widens the pulse width during low battery or
high load, and narrows it proportionately during no load or optimal battery conditions.
This means, at low battery conditions the PWM must auto adjust to maximum duty cycle, for maintaining the stipulated 310
V output. This maximum PWM can be assumed to be 98% of the total duty cycle.
The 2% gap is left for the dead time. Dead time is the zero voltage gap between each half cycle frequency, during which the
MOSFETs or the specific power devices remain completely shut off. This ensures guaranteed safety and prevents shoot
through across the MOSFETs during the transition periods of the push pull cycles.
Hence, input supply will be minimum when the battery voltage reaches at its minimum level, that is when Vin = Vin(min) = 10.5
V. This will prompt the duty cycle to be at its maximum 98%.
The above data can be used for calculating the average voltage (DC RMS) required for the primary side of the transformer
to generate 310 V at the secondary, when battery is at the minimum 10.5 V. For this we multiply 98% with 10.5, as shown
below:
0.98 x 10.5 V = 10.29 V, this the voltage rating our transformer primary is supposed to have.
Now, we know the maximum secondary voltage which is 330 V, and we also know the primary voltage which is 10.29 V.
This allows us to get the ratio of the two sides as: 330 : 10.29 = 32.1.
Since the ratio of the voltage ratings is 32.1, the turn ratio should be also in the same format.
Meaning, x : 3 = 32.1, where x = secondary turns, 3 = primary turns.
Solving this we can quickly get the secondary number of turns
Therefore secondary turns is = 96.3.
The figure 96.3 is the number of secondary turns that we need for the proposed ferrite inverter transformer that we are
designing. As stated earlier since fractional vales are difficult to implement practically, we round it off to 96 turns.
This concludes our calculations and I hope all the readers here must have realized how to simply calculate a ferrite
transformer for a specific SMPS inverter circuit.
Calculating Auxiliary Winding

An auxiliary winding is a supplemental winding


that a user may require for some external
implementation.

Let's say, along with the 330 V at the secondary, you need another winding for getting 33 V for an LED lamp. We first
calculate the secondary : auxiliary turn ratio with respect to the secondary winding 310 V rating. The formula is:
NA = Vsec / (Vaux + Vd)
NA = secondary : auxiliary ratio, Vsec = Secondary regulated rectified voltage, Vaux = auxiliary voltage, Vd = Diode forward
drop value for the rectifier diode. Since we need a high speed diode here we will use a schottky rectifier with a V d = 0.5V
Solving it gives us:
NA = 310 / (33 + 0.5) = 9.25, let's round it off to 9.
Now let's derive the number of turns required for the auxiliary winding, we get this by applying the formula:
Naux = Nsec / NA
Where Naux = auxiliary turns, Nsec = secondary turns, NA = auxiliary ratio.
From our previous results we have Nsec = 96, and NA = 9, substituting these in the above formula we get:
Naux = 96 / 9 = 10.66, round it off gives us 11 turns. So for getting 33 V we will need 11 turns on the secondary side.
Wrapping up
In this post we learned how to calculate and design ferrite core based inverter transformers, using the following steps:
•Calculate primary turns
•Calculate secondary turns
•Determine and Confirm Bmax
•Determine the maximum secondary voltage for PWM feedback control
•Find primary secondary turn ratio
•Calculate secondary number of turns
•Calculate auxiliary winding turns
Using the above mentioned formulas and calculations an interested user can easily design a customized ferrite core based
inverter for SMPS application.
How to Calculate Ferrite Core Transformers

First and foremost, have all the required parameters in place. Our design here is a center tap push-pull topology. 
Calculate primary turns

3 is the primary turn. 


•Calculate secondary turns; Peak secondary value is constant at 310V. It helps in sustaining an operation voltage of 13V to
10.5V (lowest). An additional 20V to the 310V results in 330V, which is good enough for a maximum output peak
voltage. 
•Determine the maximum secondary voltage for PWM feedback control; PMW is 98% of the total duty cycle. So, when
the battery is at 10.5V, 310V at secondary, we use the calculation; 98% × 10.5 V = 10.29V. The final maximum secondary
voltage is at 330V while the primary voltage is 10.29V
•Find primary secondary turn ratio; Ratio is 330:10.29 = 32.1 
•Calculating a secondary number of turns is found by multiplying the primary turns (3) and the ratio of voltage ratings
(32.1). Now, 32.1 × 3 = 96.3 rounded off to 96. 
•Calculate the auxiliary number of turns
You’ll require the auxiliary winding for external implementation. The formula is as follows;
•Before beginning your transformer design process, ensure your requirements align with the desired application. Project
requirements may include current level, output voltage, operation frequencies, and input voltage. 
•Secondly, check other parameters including operation temperature, mounting style, isolation, spacing, leakage currents, and
size. 
•Then, proceed to core selection. You’ll need bobbins to fit the core of your choice, and they also help in mounting your
product once you finish it. 
•Fourthly, using the formulae under the subheading ‘how to calculate ferrite core transformers,’ calculate the power losses,
number of turns. Also, you can calculate other necessary parameters. 
•Next, you need to determine the sire size and primary winding current.
     The formula is – Primary current = total output power + transformer power losses divided by primary voltage. 
•Afterward, determine the number of turns the secondary winding needs. Here, you’ll check the wires from your mechanical
drawing. Then, ensure they fit into the winding area in the mean length of turns, height, and bobbin. Further, add some
insulation between the windings but also consider the total winding height.
•In addition, measure the loaded voltage and open-circuit crossway the secondary winding to verify your design. Again, use
the formulae in subheading four to calculate the resistance of each winding. Also, calculate the voltage drop crossway on the
same winding. Voltage drop= current × resistance. 
•Finally, finish by calculating the required temperature. Temperature rise in ferrite transformers results from winding power
losses and core power losses. Depending on your application, the calculation should determine an acceptable temperature. 
6mm X 5.5mm = 33mm2

= 0.33cm2
The design procedure is followed assuming that the following specification of a transformer are given:-
•Secondary voltage (Vs)
•Secondary  current (Is)
• Turns ratio (n2/n1)
From these given details we calculate Tongue width, stack height, core type, window area as follows:-
•Secondary Volt-Amps (SVA) = secondary voltage (Vs) * secondary current(Is)
•Primary Volt-Amps (PVA) = Secondary Volt-Amps (SVA) / 0.9 (assuming efficiency of the transformer as
90%)
•Primary voltage (Vp)= Secondary voltage(Vs)/ turns ratio(n2/n1)
•Primary current (Ip) =  Primary Volt-Amps(PVA)/ Primary voltage(Vp)
•The require cross-sectional area of the core is given by:-  Core area (CA) = 1.15 * sqrt (Primary Volt-
amps(PVA))
• Gross core area (GCA) = Core area(CA) * 1.1
•The number of turns on the winding is decided by the ratio given as:- Turns per volt (Tpv) = 1/(4.44 * 10-4 *
core area* frequency * flux density)
Winding data on Enameled copper wire
(@ 200A/cm²)
For operation on mains supply, the frequency is 50HZ, while the flux density can be taken as 1Wb/sq cm.
for ordinary Steel stampings and 1.3Wb/sq cm for CRGO stampings, depending on the type to be used.
Hence
•Primary turns (n1) = Turns per volt(Tpv) * Primary voltage(V1)
•Secondary turns (n2) = Turns per volt(Tpv) * secondary voltage(V2) * 1.03 (Assume that there is 3% drop
in transformer windings)
•The width of the tongue of laminations is approximately given by:-
Tongue width (Tw) = Sqrt * (GCA)
Designing a transformer using an example:
•The given details  are as follows:-
•Sec. voltage(Vs) = 60V
Sec current(Is) = 4.44A
•Turns per ratio (n2/n1) = 0.5
Now we have to calculations as follows:-
•Sec.Volt-Amps(SVA) =  Vs * Is = 60 * 4.44 =266.4VA
• Prim.Volt-Amps(PVA) = SVA / 0.9 = 296.00VA
• Prim.Voltage (Vp) = V2 / (n2/n1) = 60/0.5= 120V
• Prim.current (Ip) =  PVA/Vp = 296.0/ 120 = 2.467A
• Core Area(CA) = 1.15 * sqrt(PVA) = 1.15 * sqrt(296) = 19.785 cm²
• Gross core area(GCA) = CA * 1.1 = 19.785 * 1.1 = 21.76 cm²
• Turns per volt(Tpv) = 1 / (4.44 * 10-4 * CA *frequency *  Flux density) = 1 / (4.44 * 10-4 * 19.785 * 50 *1) =
2.272 turns per volt
• Prim.Turns(N1) =  Tpv * Vp = 2.276 * 120 = 272.73 turns
• Sec.Turns(N2) = Tpv * Vs * 1.03 = 2.276 * 60 * 1.03 = 140.46 turns
• Tongue width(TW) = Sqrt*(GCA) = 4.690 cm
• We are choosing the current density as 300A/cm², but the current density in the wire table  is given for
200A/cm², then
• Primary current search value = Ip / (current density/200) = 2.467 / (300/200) = 1.644A
• Secondary current search value = Is / (current density/200) = 4.44 / (300/200) = 2.96A
For these values of primary and secondary currents we choose the corresponding SWG and Turns per sqcm
from the wire table.
SWG1=19                                                                       SWG2=18
Turn per sqcm of primary = 87.4 cm²              turns per sqcm of secondary =60.8 cm²
• Primary area(pa) =  n1 / turns per sqcm(primary) = 272.73 / 87.4 =  3.120 cm²
• Secondary area(sa) =  n2 / turns per sqcm(secondary) = 140.46 / 60.8 = 2.310 cm²
• Total area(at) = pa + sa = 3.120 + 2.310 = 5.430 cm²
• Window area (Wa) = total area * 1.3 = 5.430 * 1.3 = 7.059 cm²
For the above calculated value of tongue width, we choose core number and window area from the core table
ensuring that the window area chosen is greater than or equal to the Gross core area. If this condition is not
satisfied we go for a higher tongue width ensuring the same condition with a corresponding decrease in the
stack height so as to maintain approximately constant gross core area.
Thus we get available tongue width (Twavail) and window area ((avail)(aWa)) from the core table:
• So tongue width available (atw) = 3.81cm
• Window area available (awa) = 10.891 cm²
• Core number = 16
• Stack Height = gca / atw = 21.99 / 3.810 = 5.774cm
For performance reasons, we approximate stack height to tongue width (aTw) ratio to the nearest following
figures of 1.25, 1.5, and 1.75. At the worst case we take the ratio equal to 2.
If the ratio is greater than 2 we select a higher tongue width ensuring all the conditions as above.
•Stack height(ht) / tongue width(aTw) =  5.774 / 3.81 = 1.516
• Modified stack height = Tongue width(aTw) * Nearest value of standard ratio  = 3.810 * 1.516 = 5.715cm
• Modified Gross core area = Tongue width (aTw) * Modified stack height = 3.810 * 5.715 = 21.774 cm²
Thus we find core number and stack height for the given specifications.
E Type Ferrite Core
SPWM or sinusoidal pulse width modulation
#include <avr/io.h>
#include <avr/interrupt.h>

// Look up tables with 200 entries each, normalised to have max


value of 1600 which is the period of the PWM loaded into register
ICR1.
int lookUp1[] = {
50 ,100 ,151 ,201 ,250 ,300 ,349 ,398 ,446 ,494 ,
542 ,589 ,635 ,681 ,726 ,771 ,814 ,857 ,899 ,940 ,
981 ,1020 ,1058 ,1095 ,1131 ,1166 ,1200 ,1233 ,1264 ,1294 ,
1323 ,1351 ,1377 ,1402 ,1426 ,1448 ,1468 ,1488 ,1505 ,1522 ,
1536 ,1550 ,1561 ,1572 ,1580 ,1587 ,1593 ,1597 ,1599 ,1600 ,
1599 ,1597 ,1593 ,1587 ,1580 ,1572 ,1561 ,1550 ,1536 ,1522 ,
1505 ,1488 ,1468 ,1448 ,1426 ,1402 ,1377 ,1351 ,1323 ,1294 ,
1264 ,1233 ,1200 ,1166 ,1131 ,1095 ,1058 ,1020 ,981 ,940 ,
899 ,857 ,814 ,771 ,726 ,681 ,635 ,589 ,542 ,494 ,
446 ,398 ,349 ,300 ,250 ,201 ,151 ,100 ,50 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
int lookUp2[] = {
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
50 ,100 ,151 ,201 ,250 ,300 ,349 ,398 ,446 ,494 ,
542 ,589 ,635 ,681 ,726 ,771 ,814 ,857 ,899 ,940 ,
981 ,1020 ,1058 ,1095 ,1131 ,1166 ,1200 ,1233 ,1264 ,1294 ,
1323 ,1351 ,1377 ,1402 ,1426 ,1448 ,1468 ,1488 ,1505 ,1522 ,
1536 ,1550 ,1561 ,1572 ,1580 ,1587 ,1593 ,1597 ,1599 ,1600 ,
1599 ,1597 ,1593 ,1587 ,1580 ,1572 ,1561 ,1550 ,1536 ,1522 ,
1505 ,1488 ,1468 ,1448 ,1426 ,1402 ,1377 ,1351 ,1323 ,1294 ,
1264 ,1233 ,1200 ,1166 ,1131 ,1095 ,1058 ,1020 ,981 ,940 ,
899 ,857 ,814 ,771 ,726 ,681 ,635 ,589 ,542 ,494 ,
446 ,398 ,349 ,300 ,250 ,201 ,151 ,100 ,50 ,0};
void setup(){
// Register initilisation, see datasheet for more detail.
TCCR1A = 0b10100010;
/*10 clear on match, set at BOTTOM for compA.
10 clear on match, set at BOTTOM for compB.
00
10 WGM1 1:0 for waveform 15.
*/
TCCR1B = 0b00011001;
/*000
11 WGM1 3:2 for waveform 15.
001 no prescale on the counter.
*/
TIMSK1 = 0b00000001;
/*0000000
1 TOV1 Flag interrupt enable.
*/
ICR1 = 1600; // Period for 16MHz crystal, for a switching
frequency of 100KHz for 200 subdevisions per 50Hz sin wave
cycle.
sei(); // Enable global interrupts.
DDRB = 0b00000110; // Set PB1 and PB2 as outputs.
pinMode(13,OUTPUT);
}
What is SPWM (Sinusoidal Pulse Width Modulation)?
As the name suggests, SPWM stands for Sinusoidal Pulse Width Modulation. As you may already know,
a PWM signal is a signal in which we can change the frequency of the pulse as well as the on-time and off-time,
which is also known as the duty cycle. If you want to learn more about PWM, you can read it here. So, by
varying the duty cycle, we alter the average voltage of the pulse. The image below shows that-
If we consider a PWM signal which is switching in between 0 - 5V which has a duty cycle of 100%, we will get
an average output voltage of 5V, again if we consider the same signal with a duty cycle of 50%, we will get
the output voltage of 2.5V, and for the duty cycle of 25%, it's half of that. That sums up the basic principle of the
PWM signal, and we can move onto understanding the basic principle of the SPWM signal.
A sine voltage is primarily an analogy voltage which alters its magnitude over time, and we can reproduce this
behaviour of a sine wave by continually changing the duty cycle of the PWM wave, the below image shows that.
If you look at the schematic below, it will see there is a capacitor connected at the output of the transformer.
This capacitor is responsible for smoothing out the AC signal from the carrier frequency.
The utilized input signal will charge and discharge the capacitor according to the input signal and load. As we
have used a very high-frequency SPWM signal, it will have a very small duty cycle which is like 1%, this 1% duty
cycle will charge the capacitor a little, the next duty cycle is 5%, this will again charge the capacitor a little more,
following pulse will have a duty cycle of 10% and the capacitor will charge a little bit more, we will apply the
signal until we have reached a duty cycle of 100% and from there, we will go back down to 1%. This will create
a very smooth curve like a sine wave at the output. So, by providing proper values of the duty cycle at the input,
we will have a very sinusoidal wave at the output.
int sinPWM[]={1,2,5,7,10,12,15,17,19,22,24,27,30,32,34,37,39,42,
44,47,49,52,54,57,59,61,64,66,69,71,73,76,78,80,83,85,88,90,92,94,97,99,
101,103,106,108,110,113,115,117,119,121,124,126,128,130,132,134,136,138,140,142,144,146,
148,150,152,154,156,158,160,162,164,166,168,169,171,173,175,177,178,180,182,184,185,187,188,190,192,193,
195,196,198,199,201,202,204,205,207,208,209,211,212,213,215,216,217,219,220,221,222,223,224,225,226,227,
228,229,230,231,232,233,234,235,236,237,237,238,239,240,240,241,242,242,243,243,244,244,245,245,246,246,
247,247,247,248,248,248,248,249,249,249,249,249,
250,250,250,250,
249,249,249,249,249,248,248,248,248,247,247,247,
246,246,245,245,244,244,243,243,242,242,241,240,240,239,238,237,237,236,235,234,233,232,231,230,229,228,
227,226,225,224,223,222,221,220,219,217,216,215,213,212,211,209,208,207,205,204,202,201,199,198,196,195,
193,192,190,188,187,185,184,182,180,178,177,175,173,171,169,168,166,164,162,160,158,156,154,152,150,148,
146,144,142,140,138,136,134,132,130,128,126,124,121,119,117,115,113,110,108,106,103,101,
99,97,94,92,90,88,85,83,80,78,76,73,71,69,66,64,61,59,57,54,52,49,47,44,
42,39,37,34,32,30, 27,24,22,19,17,15,12,10,7,5,2,1};

You might also like