Sine wave inverter power supply based on PICFxx microcontroller control

Publisher:LeishanLatest update time:2010-05-24 Source: 电子元器件应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

An inverter is a device that uses power electronics technology to convert electrical energy. With the development of power electronics technology, inverters are increasingly used, but the application system also places higher and higher requirements on the output voltage waveform characteristics of the inverter, because the output waveform quality of the power supply is directly related to the safety and reliability indicators of the entire system.

With the development of digital signal processing technology, inverter power supplies designed with SPWM control mode are becoming more and more popular. The SPWM inverter power supply introduced in this article uses PIC microcontroller to realize SPWM control and sine wave output, and the circuit is simple, the performance is safe and reliable, the flexibility is strong, and it can reduce harmonics and improve efficiency.

1 SPWM inverter structure

There are many forms of inverter power topology. Figure 1 shows the basic structure of SPWM inverter power, which is mainly composed of transformer center tap push-pull boost circuit, inverter circuit, filter circuit, drive circuit and control circuit. The control circuit mainly includes MCU controller, boost control, voltage detection and current A/D detection circuits.

The basic structure of SPWM inverter power supply

2 Working principle of SPWM inverter power supply

The front stage of this inverter power supply uses SG3525 to alternately output two PWM signals to control the switch tube, and then generates a 400 V voltage after high-frequency transformer step-up rectification and LC filtering. Then, a rectangular pulse wave equivalent to a sine wave is generated through single-chip microcomputer programming to control the on and off of the inverter bridge switch tube. So that it works in SPWM control mode. Figure 2 shows the electrical schematic diagram of its inverter circuit. The left bridge arm in Figure 2 works in high-frequency modulation mode, that is, Q1 and Q3 are turned on according to SPWM: the right bridge arm works in high-frequency modulation mode, that is, Q2 and Q4 are turned on according to SPWM, and finally a sine wave is obtained after filtering.

Electrical schematic diagram of inverter circuit

3 SPWM sine wave pulse width modulation method

SPWM sinusoidal pulse width modulation is a pulse width modulation method that uses a modulating wave as a sine wave and a carrier wave as a triangular wave. It can be widely used in inverter power supplies. The output waveform control algorithms of SPWM include area equivalent method, natural sampling method, symmetrical regular sampling method, asymmetrical regular sampling method, etc. This paper uses the area equivalent method of pulse width modulation wave to realize SPWM control. Figure 3 shows its SPWM waveform diagram. This method divides the half-cycle sine wave waveform into N equal parts, so that the sine wave is regarded as composed of N pulses connected to each other. These pulses have equal widths (all equal to π/N), unequal amplitudes, and the top of the pulse is not a horizontal straight line, but a curve. The amplitude of each pulse changes according to the sine law. If this pulse sequence can be replaced by the same number of rectangular pulse sequences with equal amplitude but unequal width, and the midpoint of the rectangular pulse coincides with the midpoint of the corresponding sine equal division. And the area pulse amount of the rectangular pulse and the corresponding sine part is equal, then the corresponding pulse sequence can be obtained. In this way, by making the width of each pulse change according to the sinusoidal law and making the rectangular wave equivalent to the sine wave, SPWM sinusoidal pulse width modulation can be achieved.

SPWM Waveform

4 Software Design

4.1 Generation of Sine Wave Pulse Width

According to the generation principle of sinusoidal pulse width modulation (SPWM), if the sine wave U=Urmsintωt is divided into N equal parts in half a period, and the area of ​​the i-th equally divided sine wave is Si, then:

formula

If the amplitude of the rectangular wave is equal to the amplitude Urm of the input sine wave, and the area of ​​each segment of the rectangular wave is equal to the area of ​​the corresponding segment of the sine wave, then the value of the rectangular wave pulse width can be obtained as:

formula

Since the pulse width changes according to the law of sine wave, the values ​​of these pulse widths DK can be compiled into a numerical table, and then the single-chip microcomputer can output the pulse sequence by looking up the table. In the experiment, the carrier frequency fc=25 kHz, AC frequency fs=50 Hz, and carrier ratio N=fdfs can be used to determine the number of discrete points of the sine wave, that is, the number of pulses in one cycle (assuming N=500). In order to save the storage space of the table, in actual programming, the discrete points of the sine wave in half a cycle can be saved, that is, N/2 points can be saved, and then the SPWM waveform can be output in an alternating manner to control the operation of the inverter bridge.

4.2 Software Implementation of SPWM

This system uses PIC16FXX microcontroller as the core, the crystal oscillator is 20 MHz, the instruction cycle is 0.2μs, and the operating frequency of the SPWM wave driving the switch tube is 25 kHz. Then, the initialization settings of the registers in the microcontroller are as follows:

First, set PORTC to output mode, that is, TRISC = 0X00. Set the CCP module to PWM function. At the same time, the CCP module must be set to PWM mode in the CCPXCON register, that is, CCPxM3:CPxM0 = 11XX.

Then PR2 is used to determine the PWM switching cycle register, and TSFMW = (PR2 + 1) × 4TOSC (TMR2 PrescaleValue), fSPWM = 1 / TSPMW. Because the operating frequency f = 25 kHz, PR2 = 0XC7; and the value of the operating cycle register CCPRxL is variable.

After the program is initialized, the timing register TMR2 in the system will start and start working. At this time, the pin output of the PWM unit is high level; when TMR2>CCPRxl, the pin of the PWM unit starts to output low level; when TMR2=PR2, TMR2 is reset to 0 and restarts the next cycle count, and the PWM unit outputs high level again. When the interrupt flag TMR2IF of TMR2 is set to high level, the system will execute the timing interrupt service program. Figure 4 shows its SPWM flow chart. After the interrupt program completes the search for the sine table value and the A/D sampling value, it performs PI adjustment to obtain the correction value and write the correction value into the CCPRxL register. Figure 5 shows the output waveform of the SPWM inverter power supply.

SPWM Flowchart

Output waveform of SPWM inverter power supply

5 Conclusion

The test shows that the inverter power supply based on HC single-chip microcomputer control can meet the requirements of small power inverters, and the single-chip microcomputer can be used to realize the control of digital SPWM waves. This method not only has certain advantages over the traditional analog control method, but also has higher efficiency and smaller size. It also has the advantages of flexible design, reliable performance, stable output, and small harmonics.

Reference address:Sine wave inverter power supply based on PICFxx microcontroller control

Previous article:Design of 5kV repetition frequency high voltage pulse power supply
Next article:Theory and practice of engineering design of power supplies in portable devices

Latest Power Management Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号