Flyback
Flyback
AIM
Design a flyback DC-DC converter with Vin=12V, Vo=50V, Output power= 20 W,
Bmax=0.225T, switching frequency=20KHz.
CIRCUIT DIAGRAM
DRIVE CIRCUIT
SOFTWARE USED:
Proteus, MPLAB XC8 Compile
INITIALIZATION FOR ADC MODULE
A port is set as input port
TRISA = 1
ADCON register controls the initialization of ADC module.
The conversion of an analog input signal results in a corresponding 10-bit digital
number.
The A/D module has four registers. These registers are:
• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
The ADCON0 register, shown in Register 11-1, controls the operation of the A/D
module. The ADCON1 register, shown in Register 11-2, configures the functions
of the port pins. The port pins can be configured
as analog inputs (RA3 can also be the voltage reference) or as digital input/ouput.
PROGRAM
#define _XTAL_FREQ 16000000
#include "configuration.h"
#include <xc.h>
void main()
{
TRISC = 0; //configure port C as output
//CCP pin RC2/CCP1 is on port C
PR2 = 199; // PWM frequency = Fosc/(16*(PR2+1)) = 5kHz
// PWM frequency = 16MHz/(16*200) = 5kHz
T2CONbits.T2CKPS = 0b01; // prescaler is 4 //00-1 //01-4
//1x-16
TMR2 = 0; // clear timer before turning on
T2CONbits.TMR2ON = 1; // timer 2 turned on
CCP1CONbits.CCP1X = 0; // LSB = 0
CCP1CONbits.CCP1Y = 0; // LSB = 0 CCP1CONbits.
CCP1M = 0b1100; //15- PWM turned on
TRISA = 1; //configure port A as input
ADCON1bits.ADFM = 1; //result format right shift
ADCON1bits.ADCS2 = 1; //clock Fosc/64
ADCON1bits.PCFG = 0; //V+ref = Vdd ; V-ref = Vss
ADCON0bits.CHS = 0; // channel AN0
ADCON0bits.ADON = 1; // ADC module ON
__delay_ms(1);
unsigned int adcReading = 0;
double dutyCycle = 0.0;
while(1)
{
ADCON0bits.GO = 1;
while(ADCON0bits.nGO)
{
} // wait while ADC finishes conversion
adcReading = (ADRESH * 256) + ADRESL; //getting 10 bit adc reading
dutyCycle = 0.4 + ((double)adcReading/1023)* 0.4 ;
CCPR1L = (unsigned char) (dutyCycle*200); // duty cycle = CCPR1L/(PR2+1)
// duty cycle = CCPR1L/200
__delay_ms(1);
}
}
DESIGN OF TRANSFORMER
Let us assume converter efficiency of .8
20
Energy stored= P = 0
= 1.25𝑚Joules
hf s 0.8×20000
S Dmax 1 - Dmax X
Ap=AwAc= K w2JB c 3 + 3
Dmax=0.4, Kw=0.4, J=4 A/cm2, B=0.225 T
Ap= 5.94 𝑚𝑚4
Select core as E/42/21/20
Ac= 2.35 𝑚𝑚2
𝑃 20
Output current= 0 = =0.4 A
𝑉0 50
Transformer Primary current= n× 𝐼0 = 6.3 × 0.4=2.5 A
𝐸1𝑚𝑖𝑛 𝐷𝑚𝑎𝑥
Primary Inductance L1= = .1m𝐻
𝐼1𝑃 𝑓
𝐿1 𝑁1 2
= (𝑁2) ; L2= 4mH
𝐿2
𝐿1𝐼1𝑃
Primary turnsN1= = 5 turns
𝐵𝐴𝑐
1−𝐷𝑚𝑎𝑥 𝑁1
Secondary turns N2= (𝑉0 + 𝑉𝐷 ) = 32 𝑡𝑢𝑟𝑛𝑠
𝐷𝑚𝑎𝑥 𝐸1𝑚𝑖𝑛
2. OUTPUT VOLTAGE
CONCLUSION
Design of flyback DC-DC converter is done.
Output voltage of flyback is obtained.