MID TERM PROJECT TOPIC: FLYBACK SOURCE Chapter 1 Introduction 1.1 Overview This application note describes the steps taken to design, build and test a 3W Flyback Switched Mode Power Supply (SMPS) that uses the STM32C8T6 to control the circuit. The purpose is to show how the Core Independent Peripherals (CIPs) of the microcontroller unit (MCU) can be used to implement the logic control for a SMPS while the core is free to do other functions. The reason for changing the dedicated flyback controller to a MCU with CIPs is to gain control, monitoring, communications and automated features, which are some of the demands in a new SMPS. The concept of CIPs can be tricky to understand for designers who have never worked with MCUs. Designers who have used only Application Specific Integrated Circuits (ASICs) may think of them as analog devices, such as op amps and comparators that are integrated in a microcontroller that does not need code supervision to work normally, but can be interconnected and configured in a sandboxtype environment. The flyback topology was chosen because it offers a simple design with few components while providing isolation. It can be used as a reference for more complex designs. The first part of this application note is dedicated to readers who are unfamiliar with the flyback design. It focuses on: • Theory • Logic • Equations and a thirdparty tool to solve them • Component design and selection • Compensation process and filtering 1.2 Introduction to Flyback source The flyback is the most ubiquitous in both ACDC and DCDC conversion with galvanic isolation between the input and any outputs. The flyback converter is a buckboost converter with the inductor split to form a transformer, so that the voltage ratios are multiplied with the additional advantage of isolation. The system is able to provide line isolation to maintain a safe environment for the user, thanks to the use of a transformer for power conversion and an optocoupler for output regulation. The most common applications are: Lowpower SMPS (cell phone charger, standby power supply in PCs) Lowcost multipleoutput power supplies (main PC supplies < 250W) Highvoltage generation (xenon flash lamps, lasers, copiers) The isolation offered by the flyback transformer can also be obtained by using a transformer at the line frequency of 5060 Hz, but this transformer’s weight and dimensions are inversely proportional to the frequency, so it is more convenient to incorporate it in the converter’s structure and work at tens to hundreds of kHz, thus significantly decreasing the physical dimensions. 1.3 Cost Advantages The assembly costs for the flyback regulator are low due to a low overall component count, singlemagnetic element for both energy storage and transformer action, and for the ease it provides in generating multiple outputs. 1.4 Performance Advantages 1. The flyback topology offers good voltage tracking in multiple output supplies due to lack of intervening inductances in secondary circuits. 2. Since there is no need to charge an output inductor every cycle, a good transient response is achievable. 3. Easy to have input dynamic range. 4. Simple driving
HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY School of Mechanical Engineering *** MID TERM PROJECT TOPIC: FLYBACK SOURCE Instructor Department : : Dr Nguyen Canh Quang SEE Student : Hoàng Việt Tùng -20185312 Đặng Hoàng Việt -20185315 Hanoi, July 2022 Ha Noi University of Science and Technology Midterm Report 7-2022 Designing and Implementing a Microcontroller-based Primary- side Sensing Flyback Converter Hoàng Việt Tùng-20185312 Đặng Hoàng Việt-20185315 Ha Noi University of Science and Technology ABSTRACT The fast development of electrical industry and its applications has required a new generation of power device with higher efficiency and long lifespan The flyback converter was chosen for its simplicity, competitive low cost, and its ability to provide a constant output current Meanwhile, the STM32 micro-controller series offer numerous advanced features which include but not limited to pulse-width modulation (PWM), Analog-to-Digital Converter (ADC) etc., which suitably meet the requirements for regulating a primary-side sensing flyback converter The design process was first conducted in simulation stage with aid from Proteus Professor and Altium Desginer The simulation results matched well with the intended design specifications: the output voltage is 3.3 VDC while the load current is 1A More importantly, the simulation results demonstrated the feasibility of deploying a primary-side sensing flyback converter in conjunction with a STM32 microcontroller Next, a demo printed-circuit board (PCB) was layout by using Altium Desginer Finally, the STM32 micro-controller was programmed The experimental results reflect the project’s success with all the parts of the driver harmoniously work as expected Chapter Introduction 1.1 Overview This application note describes the steps taken to design, build and test a 3W Flyback Switched Mode Power Supply (SMPS) that uses the STM32C8T6 to control the circuit The purpose is to show how the Core Independent Peripherals (CIPs) of the microcontroller unit (MCU) can be used to implement the logic control for a SMPS while the core is free to other functions The reason for changing the dedicated flyback controller to a MCU with CIPs is to gain control, monitoring, communications and automated features, which are some of the demands in a new SMPS The concept of CIPs can be tricky to understand for designers who have never worked with MCUs Designers who have used only Application Specific Integrated Circuits (ASICs) may think of them as analog devices, such as op amps and comparators that are integrated in a microcontroller that does not need code supervision to work normally, but can be interconnected and configured in a sandbox-type environment The flyback topology was chosen because it offers a simple design with few components while providing isolation It can be used as a reference for more complex designs The first part of this application note is dedicated to readers who are unfamiliar with the flyback design It focuses on: • Theory • Logic • Equations and a third-party tool to solve them • Component design and selection • Compensation process and filtering 1.2 Introduction to Flyback source The flyback is the most ubiquitous in both AC/DC and DC/DC conversion with galvanic isolation between the input and any outputs The flyback converter is a buckboost converter with the inductor split to form a transformer, so that the voltage ratios are multiplied with the additional advantage of isolation The system is able to provide line isolation to maintain a safe environment for the user, thanks to the use of a transformer for power conversion and an optocoupler for output regulation The most common applications are: - Low-power SMPS (cell phone charger, standby power supply in PCs) - Low-cost multiple-output power supplies (main PC supplies < 250W) - High-voltage generation (xenon flash lamps, lasers, copiers) The isolation offered by the flyback transformer can also be obtained by using a transformer at the line frequency of 50-60 Hz, but this transformer’s weight and dimensions are inversely proportional to the frequency, so it is more convenient to incorporate it in the converter’s structure and work at tens to hundreds of kHz, thus significantly decreasing the physical dimensions 1.3 Cost Advantages The assembly costs for the flyback regulator are low due to a low overall component count, single-magnetic element for both energy storage and transformer action, and for the ease it provides in generating multiple outputs 1.4 Performance Advantages The flyback topology offers good voltage tracking in multiple output supplies due to lack of intervening inductances in secondary circuits Since there is no need to charge an output inductor every cycle, a good transient response is achievable Easy to have input dynamic range Simple driving Chapter Methology 2.1 Flyback regulator 2.1.1 Transformer Operator A transformer is a device that has two or more magnetically-coupled windings The basic operation is shown in figure Figure Transformer Theory The action of a transformer is such that a time-varying (AC) voltage or current is transformed to a higher or lower value, as set by the transformer turns ratio The transformer does not add power, so it follows that the power (V X I) on either side must be constant That is the reason that the winding with more turns has higher voltage but lower current, while the winding with less turns has lower voltage but higher current The dot on a transformer winding identifies its polarity with respect to another winding, and reversing the dot results in inverting the polarity 2.1.2 Pulse Width Modulation (PWM) All of the switching converters that will be covered in this paper use a form of output voltage regulation known as pulse width modulation (PWM) Put simply, the feedback loop adjusts (corrects) the output voltage by changing the ON time of the switching element in the converter As an example of how PWM works, we will examine the result of applying a series of square wave pulses to an L-C filter (see Figure) Figure Basic Principle of PWM The series of square wave pulses is filtered and provides a DC output voltage that is equal to the peak pulse amplitude multiplied times the duty cycle (duty cycle is defined as the switch ON time divided by the total period) This relationship explains how the output voltage can be directly controlled by changing the ON time of the switch 2.1.3 Switching Converter Topologies The Flyback is the most versatile of all the topologies, allowing the designer to create one or more output voltages, some of which may be opposite in polarity Flyback converters have gained popularity in batterypowered systems, where a single voltage must be converted into the required system voltages (for example, +5 V, +12 V and –12 V) with very high power conversion efficiency The basic single-output flyback converter is shown in Figure Figure 3Single-output Flyback Regulator The most important feature of the Flyback regulator is the transformer phasing, as shown by the dots on the primary and secondary windings When the switch is on, the input voltage is forced across the transformer primary which causes an increasing flow of current through it Note that the polarity of the voltage on the primary is dot-negative (more negative at the dotted end), causing a voltage with the same polarity to appear at the transformer secondary (the magnitude of the secondary voltage is set by the transformer secondary-to-primary turns ratio) The dot-negative voltage appearing across the secondary winding turns off the diode, preventing current flow in the secondary winding during the switch on time During this time, the load current must be supplied by the output capacitor alone When the switch turns off, the decreasing current flow in the primary causes the voltage at the dot end to swing positive At the same time, the primary voltage is reflected to the secondary with the same polarity The dot-positive voltage occurring across the secondary winding turns on the diode, allowing current to flow into both the load and the output capacitor The output capacitor charge lost to the load during the switch on time is replenished during the switch OFF time Flyback converters operate in either continuous mode (where the secondary current is always > 0) or discontinuous mode (where the secondary current falls to zero on each cycle) 2.1.3 CCM and DCM of flyback source a) Continuous conduction mode (CCM) - Small ripple and rms current - Lower MOSFET conduction and turn-off loss - Lower core loss - Lower capacitors loss - Can have better “full load” efficiency -Smaller EMI and output filters Figure CCM graph b) Discontinuous conduction mode (DCM) - No diode reverse recovery loss - Lower inductance value - Better “no load” efficiency - First-order system -No PHPZ proplem -Slope compensation not needed in CMC Figure DCM graph 2.2 Design specifications The modern micro-controllers are not only extremely powerful but also small enough to be integrated in a power source They offer great flexibility with numerous built-in functions like pulse-width modulation (PWM), Analog-toDigital converter (ADC), timer etc., which allow designers to many tasks without equipping dedicated circuits More importantly, benefiting from the development of semiconductor industry, micro-controller is becoming cheaper The work of selecting the DC-DC switching converter candidate for an power source should consider some features like topology, performance, and implemented cost Flyback converter emerges as an optimized choice for its simplicity, excellent input voltage-input current relationship, and low cost The simplicity of the whole driver circuit will be greatly enhanced by regulating the output from the primary side of transformer Using primary side sensing and regulating not only helps to save the board size by getting rid of unnecessary component like optocoupler but also eliminates its unwanted instability effects The design specifications of a micro-controller based primary-side sensing flyback converter for power source is tabulated in Table 2.1 The schematic for this driver is illustrated in Fig.3 Input voltage (RMS) (Vin) 12 VDC Output voltage (Vout) 3.3 VDC Output current (Iout) 0.5A Switching Frequency (f) 50 ± kHz DC-DC converter type Flyback Primary-Side Sensing & Regulating Yes Transformer’s turn ratio (n) 2.79/1 Micro-controller STM32F103C8T6 Efficiency estimated (η) 0.8 Table Design specifications Figure – Schematic of the source driver with micro-controller and primary-side sensing flyback converter The design process of a power source will start with simulation, using Proteus Professor Next, the prototyped printed circuit board (PCB) will be designed using Altium Desgine The artwork files then will be transferred to a PCB manufacturer to fabricate For demonstration purpose, the components of PCB are selected based on technical specifications only Therefore, many of components are through-hole devices, which have larger footprint The board size should be shrunken considerably by using surface-mount devices (SMD) if the prototyped board worked flawlessly and was ready to be commercialized 2.3 Simulation Simulation is vitally an important stage at the beginning of any design process Fortunately, it is possible to set up a straightforward environment for STM32F103C8T6 micro-controller’s behaviors with available tools By exploiting the first order mathematical model for the flyback converter and using Proteus Professor and a PID based control scheme, several critical features of the micro-controller (PWM, counter etc.) can be simulated The simulation process will be discussed in Chapter 2.4 Demo board design In order to minimize any potential mismatch in design, the PCB design process will start with Proteus Prfessor for schematic drawing and then export to Altium desginer PCB Editor for layout Most passive components have defined footprints However, some components like transformer and micro-controller, whose footprints are not supplied by manufacturers, require manual footprint design This work becomes less difficult with Altium PCB Editor’s Footprint Wizard feature In fact, this feature allows designer to draw any type of footprint, as long as the component’s datasheet is available 2.5 Programming The official programming language that will be used for STM32F103C8T6 micro-controller is C The Integrated Development Environment and Compiler are Keil C and STM32 Cube MX Code will be conveniently loaded to the microcontroller using ST link V2 programmer through USB interface Chapter Preparation and desgin of micro-controller based primary-side sensing flyback converter for power source 3.1 Block diagram Figure 7Flyback Converter with MCU bock diagram The DC power source block is DC power source (12V, 3A) This source is connected to a voltage regulator to make the voltage input stable at 12VDC when the power change Next, the clamping circuit is used to reduce the leakage inductance from flyback converter PWM pulse is created by MCU via a darlington FET After transformer block, the current become AC, the rectifier comes to convert it to DC form again The feedback blocks include current voltage sensors (INA 219) and zero current detector (PC817 and TL431) By using transformer, the input and output have isolated each other 3.2 The Flyback Converter Figure - A Flyback converter Choosing the switching frequency as f = 50kHz Calculating the maximum value for the primary inductance working as DCM condition: L m= η × D ×V =223.42 μH × f × K FR × P0 The worst-case scenario occurs when the converter works at full power with a minimum input voltage and maximum duty cycle Next, the required turn ratio (nS1) is calculated To so, the same worst-case scenario is applied with a maximum VIN and maximum D The diode’s forward voltage drop is added to make the calculations more precise Estimate n: n= D ×V =2.79 0.8×(V +1)−D ×(V +1) 3.3 Micro-controller as a driver’s controller Dedicated mixed-signal switching controllers used to be a regular choice for flyback converter regulating work However, it is not as flexible as most of the modern micro-controller and is gradually being replaced by numerous modern, powerful, and multi-function micro-controller families [3] Having a lot of builtin functions, micro-controllers allow designers to add more features to the same current board by simply changing control algorithms No circuit is required to be added; therefore, the current board would not become more complicated It means that designers will be able to provide their customers with more utilities on the same product with not too much cost for upgrading The selected micro-controller for this current project is STM32F103C8T6 (Fig.2.2) The STM32 is a very common type of microcontroller used in numerous types of devices Figure STM32F103C8T66+ST link V2 Main features of chip These are some features of STM32 which are described here with the details Its operating voltage is from 1.8 volts to 3.6 volts The crystal oscillator of four to twenty-six megahertz is used in this module This module consists of by 12-bit 0.5 microsecond analog to digital converter having twenty-four channels It consists of 12 sixteen-bit and thirty bits timers It comprises of one thirty-six inputs and outputs having a frequency of sixty hertz It has one thirty-eight input and outputs operating at five volts This module consists of I2c interfacings 3.4 Zero-current detector Zero crossing detectors basically detect zero voltage points and inform the controller or controller circuit It helps to minimize high rate change of current with respect to time (dI/dt) as result less heating and start up current in the load which improves life time of load such as motors Figure 10 Zero Crosssing Detector WaveForm An op-amp detector that can detect the change from positive to negative or negative to a positive level of a sinusoidal waveform is known as a zerocrossing detector More specifically, we can say that it detects the zero crossing of the applied ac signal It is basically a voltage comparator whose output changes when the input signal crosses the zero of the reference voltage level Thus, it is named so It is also known to be a square wave generator as the applied input signal is converted into a square wave by the zero-crossing detector 3.5 ACS712 feedback sensor features Figure 11 ACS712 Pinout Output Analog Operating range – 5A Resolution 180 – 190mV/A Power 5V-DC Sampling time 5µs Operating temperature -40 – 85°C Isolated voltage 2100V (RMS) Inside registor 1.2mΩ 3.6 Schematic design 3.6.1 Snubber design The introduction of the snubber helps to solve the problem of an excessive voltage might be induced on the switching transistor during turn-off process due to the transformer leakage inductance It keeps the transient oscillation voltage in safe boundaries, thus lowering the power dissipation of the switching transistor Figure 12 The Snubber Dissipative Circuit When the switching transistor is switched off, diode is forward biased The energy from the transformer’s leakage inductance due to inductive kick phenomenon will be discharged to capacitor Therefore, the capacitor should be able to store its initial charged energy plus the energy transferred from transformer inductance According to reference resource, the minimum value for can be calculated from: LL × I 2pmax C= =0.23 nF ∆ V C (∆ V c +2 V ) where LL is the leakage inductance of the transformer With the intended EE-16 transformer, from its datasheet: LL = 0.60 µH ΔVC is the acceptable change of voltage across capacitor C10, that has range from 12 V to 48 V We can choose a value of 12 V for this calculation V is the secondary side voltage reflected to the primary side, which is calculated as N (= NP/NS) times of forward biased voltage of the secondary side diode (choose the value of 0.7 V) and the output voltage (3.3 V) Thus, V = 2.79×(3.3 + 0.7) = 11.16 V The value for resistor R should be chosen so that the time constant of R-C circuit is much larger than the switching period (1/100 kHz = 10-5 s) In addition, this resistor should be able to dissipate the total transferred energy from transformer’s leakage inductance as well as stored energy in capacitor Also according to reference source, the formula to calculate power for this resistor is: L ×I ×f V2 P R= L pmax + =5.88 mW R The value of C and R are tested and adjusted, if necessary, in order to minimize their impacts on the transient response Finally, with C = 47 nF and R = 100 kΩ all the required specifications are justified The circuit’s time constant is (47×10-9 )×(100×103) = 470×10-5 s, which is much larger than the switching period of 10-5 s 3.6.2 MOSFET and diode design The next step is to select the right MOSFET for the application To so, calculate the maximum current and voltage that the switch will have to withstand Calculate the maximum voltage with: V DS−MAX =V ¿−MAX + D ×V ¿ =20V + 20 % safety margin=24 V 1−D Note that a 20% security margin has been added to VDS_MAX to ensure the converter’s safe operation Estimate the maximum current for MOSFET and diode with: I FET− pk = D ×V =2.06 A f × Lm I diode−pk =n× I FET− pk =5.75 A And the maximum reverse voltage applied to the MOSFET and Diode can be calculated as follows: V FET − pk =V ¿ +n ×V 0=21.21 V V diode− pk = V¿ +V 0=7.60 V n According to the calculation, we can choose the N-channel IRF640N MOSFET with FR207 pulse diode specially for pulse source Assume that the expected ripple voltage output is Vripple = 100mV, calculating the necessary capacitance of the capacitor C 0> I max × D =80 uF V ripple × f The larger the capacitor, the more stabalize the output of the source Choose bigger than 80uF so we can consider using some 4700uF/35V capacitance 3.6.3 Transformer core Choose the core of the transformer according to the following formula: A P= A E × A W = P0 ×0.25 =5,5 mm f ×∆B×k×η Ae, Aw – The boundary area of the core, the coil area (Check the datasheet of the ferrit core) P0 – Output capacity f – Switching frequency ΔB – Flux density K – Dependency coefficient η – Efficiency factor Calculating the number of revolutions of primary coil: N p= L p × I pk =59,26 revolutions=60 revolutions Δ B × Ae Ns= Chapter Np =21.5revolutions=22 revolutions n ... primary-side sensing flyback converter for power source 3.1 Block diagram Figure 7Flyback Converter with MCU bock diagram The DC power source block is DC power source (12V, 3A) This source is connected... 1.2 Introduction to Flyback source The flyback is the most ubiquitous in both AC/DC and DC/DC conversion with galvanic isolation between the input and any outputs The flyback converter is a buckboost... conversion efficiency The basic single-output flyback converter is shown in Figure Figure 3Single-output Flyback Regulator The most important feature of the Flyback regulator is the transformer phasing,