Design and production of switching power supply based on ATMEGA 16

Publisher:心灵之舞Latest update time:2012-02-24 Source: 电子设计工程 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A switching power supply is a power supply that uses modern power electronics technology to control the ratio of the time when the switch is turned on and off to maintain a stable output voltage. A switching voltage-regulated power supply has the advantages of high efficiency, good voltage regulation performance, and complete protection measures. Since the control signal is generally obtained through precision voltage regulators such as TL4331 and optocouplers, it is difficult to adjust the output voltage within a wide range. In particular, it cannot output low voltage (<3 V). Applying the ATMEGA16 microcontroller to power supply control can improve the output voltage control accuracy of the switching power supply. At the same time, by using the calculation function of the ATMEGA16 and software programming, feedback control is used to make the voltage output tend to be constant.

1 Power supply hardware circuit design and calculation
1.1 Overall system design

The block diagram of the system is shown in Figure 1. The AC power outputs DC through the rectifier and filter circuit, and the EMI common mode filter is used to suppress the interference in the AC power; the +5 V microcontroller power supply is composed of MC34063; the system output voltage is sent to the A/D port of the microcontroller ATMEGA16 through the feedback circuit. The microcontroller performs PWM control on the DC-DC according to the change of the output voltage to make the output voltage stable; at the same time, the system display and keyboard control are also realized by the microcontroller ATMEGA16.

a.jpg


1.2 Rectification and filtering circuit

The rectifier and filter circuit is mainly composed of a rectifier transformer (30 W, 18 V), an EMI filter, an RS207 rectifier bridge (2 A) and a filter capacitor of 2 000 μF. The main function of the EMI filter is to filter out switching noise and harmonics introduced by the input line. The windings on the magnetic core in the filter are wound in the same direction. Because the AC current flowing through the windings is in reverse phase, the AC magnetic flux generated by the two currents in opposite directions in the magnetic core cancel each other out, thereby achieving the purpose of suppressing common-mode interference.

1.3 MCU power supply

In order to improve the efficiency of the power supply, the chip MC34063A is used to connect simple external components to form a step-down circuit, which outputs 5 V voltage to provide power for the microcontroller ATMEGA16. The circuit is shown in Figure 2.

b.jpg


Where R1 is the current limiting resistor, C1 is the timing capacitor, C2 is the output filter capacitor, R2 and R3 are resistors for setting the output voltage, and the calculation formula is shown in formula (1). Rst is the current limiting resistor. When the voltage of the current limiting resistor reaches 330 mV, the current limiting circuit starts to work. The calculation formula is shown in formula (2), where IMax_out is the maximum output current.

From the above two formulas, it can be seen that when the output voltage is 5V, the values ​​of Rst, R2 and R3 are 0.5 Ω, 1.2 kΩ and 3.6 kΩ respectively. [page]

1.4 Keyboard and display circuit

The input and display circuit uses 4 buttons and function switching to complete the setting of output voltage and display switching. The display part uses a common anode digital tube for dynamic display, as shown in Figure 3. The single-chip microcomputer ATMEGA16 uses an internal 8 MHz crystal oscillator.

d.jpg


1.5 DC-DC Circuit

The DC-DC circuit is shown in Figure 4. This module is an SR-Buck converter, and the switch tube uses the MOSFET tube IRF540. The maximum drain current ID of IRF540 is 33 A, the on-resistance RDS(on) is 44 mΩ, and the drain-source breakdown voltage VDSS is 100V. MOSFET is a voltage-controlled current source. In order to drive the MOSFET into the saturation region, it is necessary to add enough voltage between the gate and the source so that the drain can flow through the expected maximum current. Therefore, a transistor is used to drive IRF540. The main switch tube Q6 is driven by the NPN transistor Q5, and the synchronous rectifier tube Q9 is driven by the PNP transistor Q10.

e.jpg


The filter circuit uses an LC series circuit, which consists of a 220μH inductor and two 470μF ESR capacitors in parallel. A 0.1μF ceramic capacitor is used to absorb the high-frequency components at the output end.

[page]

1.6 Output voltage sampling circuit

Connect the two ends of the 50 kΩ potentiometer (voltage sampling resistor) to the power supply output end (V0 end and ground end), and connect the middle pin to the ADC0 pin of the microcontroller to realize A/D sampling of the output voltage. The circuit is shown in Figure 5.

f.jpg



2 Feedback Programming

The system collects the output voltage value and compares it with the set output voltage value. According to the size and polarity of the deviation, the duty cycle of the PWM terminal signal in Figure 4 is controlled, thereby changing the on-time of the switch tube to achieve voltage closed-loop negative feedback. In order to avoid oscillation caused by frequent actions, a PID control algorithm with dead zone is applied in the software.

g.jpg


The program flow chart is shown in Figure 6. The actual output voltage c(k) is obtained through A/D detection, and the set voltage r(k) is compared with the measured voltage c(k) to obtain the current deviation value e(k). When |e(k)|≤ε (ε is the dead zone deviation), no adjustment is performed; when e(k) is not within the dead zone range, PID adjustment is performed, and the calculation formula is shown in formula (3).

△P(k)=Pxe(k)-Ixe(k-1)+Dxe(k-2) (3)
Where: △P(k) is the output adjustment amount, e(k) is the current deviation, e(k-1) is the previous deviation, e(k-2) is the previous two deviations, p, I, D are the proportional coefficient, integral coefficient, and differential coefficient respectively. After experimental setting, P, I, and D are 27, 3, and 1 respectively.

3 Power supply function test results

When the output voltage is set to 3 V, 5 V and 9 V respectively, the performance parameters of the power supply are as follows:

1) The output voltage is adjustable from 0 to 9.9 V in steps of 0.1 V, and the output current can reach 1.5 A;
2) The voltage control accuracy range is 3% to 0.71%;
3) When the output voltage is 9 V and the output current is 1.5 A, the efficiency of the power supply is 78.78%.
4) When the output voltage changes from 3 V to 9 V, the load regulation rate is 2.7% to 1.1%;
5) At full load, the voltage regulation rate is less than 0.67%;
6) The ripple voltage accounts for 0.73% to 0.62% of the output voltage.

4 Conclusion

From the above test results, it can be seen that the power supply output voltage is adjustable from 0 to 9.9 V with high accuracy and efficiency. If the value of the dead zone deviation ε is reduced, the constant voltage characteristics and control accuracy of the power supply can be further improved; when the output power is low, the power supply microcontroller control and LED display module will consume a certain amount of power, resulting in a decrease in the efficiency of the power supply. If an LCD display and PCB board wiring are used, it is expected to further improve the power supply efficiency and reduce ripple interference.

Reference address:Design and production of switching power supply based on ATMEGA 16

Previous article:USB interface design based on ATmega128 and CH374
Next article:Design of wireless data acquisition system based on ATmega128

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号