ATMEGA16 realizes the production of switching power supply

Publisher:TechVoyagerLatest update time:2014-03-04 Source: elecfansKeywords:ATMEGA16 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 time ratio of the switch on and off to maintain a stable output voltage. With the ATMEGA16 microcontroller as the control core, a switching power supply with adjustable output voltage step was designed and manufactured. Its hardware consists of rectification, filtering, microcontroller power supply, DC-DC conversion and LED display. According to experimental measurements, the output voltage is adjustable from 0 to 9.9 V in steps of 0.1 V, and the output current is 1.5 A. When the output voltage is 9 V and the output current is 1.5 A, the voltage regulation rate is less than 0.67%, and the efficiency can reach 78.78%.

  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.

  

Figure 1 System composition block diagram

  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.

Microcontroller power supply circuit

Figure 2 MCU power supply circuit

  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 equations, we can see 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.

  1.4 Keyboard and display circuit

  The input and display circuit uses 4 buttons and function switching to complete the setting of the 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. [page]

Keyboard and display circuit

Figure 3 Keyboard and display circuit

  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.

  DC-DC Circuit

Figure 4 DC-DC circuit

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

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. A/D sampling of the output voltage is realized, and the circuit is shown in Figure 5.

Output voltage sampling circuit

Figure 5 Output voltage sampling circuit

  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. [page]

  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).

Figure 6 PID control flow chart with dead zone

  △P(k)=Pxe(k)-Ixe(k-1)+Dxe(k-2) (3)

  In the formula: △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, with a step of 0.1 V, and the output current can reach 1.5 A;

  2) The voltage control accuracy range is 3%~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%~1.1%;

  5) At full load, the voltage regulation rate is less than 0.67%;

  6) The ripple voltage accounts for 0.73%~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 LCD display and PCB board wiring are used, it is expected to further improve the power supply efficiency and reduce ripple interference.

Keywords:ATMEGA16 Reference address:ATMEGA16 realizes the production of switching power supply

Previous article:Power supply circuit composed of MC34063A
Next article:Design of support structure safety monitoring system based on ZigBee and GPRS

Latest Microcontroller 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号