蓝猫淘气

[Single-chip microcomputer] CNC adjustable voltage stabilized power supply design-V1.0

 
Overview

1 Project Introduction

Hello everyone, my name is Lei Chaolin. The circuit I designed this time uses STC’s microcontroller analog DAC to control the output voltage of the BUCK chip through the conditioning circuit. The input voltage is 4-32V, the output voltage is adjustable from 0-32V, and the output current is 0-3A. (Maximum 5A). 3-digit digital tube displays real-time voltage and current. This circuit uses the knowledge of microcontrollers, analog circuits, high-frequency signal processing, etc. It can well train students' circuit analysis ability, and the difficulty level is medium to high. I will point out the relevant circuit knowledge in detail in this article. If there are any omissions, please let me know.

2 Overall design plan

If we want to control the output voltage of the BUCK chip, we must change its voltage feedback. How to change its voltage feedback? We need an op amp to control our threshold voltage and the actual comparison output. During the voltage regulation process, the op amp is always in a comparison state until the voltage reaches stability. At the same time, closed-loop sampling should be added.
According to Kirchhoff's law, the node voltage is changed. The corresponding node voltage will change accordingly. This is how the feedback side of this circuit works. This system is in a closed loop state. Since the output voltage does not change linearly, we also add PID adjustment.
The sampling end passes through the op amp. Scale down the voltage by a factor of 10. The current sampling terminal amplifies the current signal on the sampling resistor ten times through calculation.
This circuit belongs to BUCK circuit. Increasing the switching frequency helps reduce voltage ripple. At the same time, the freewheeling inductance can be reduced. The efficiency of this circuit can reach 95%. Maximum power 50 watts.

cw08MBPbeSuveXawYTUQLTtvAY3eTVczy3Eqrz4E.png

3 Schematic design

3-1 Microcontroller circuit

K7rY3fuFZQm6jFWbr9xPFuW2MSUIIoS1G691m6Z1.png

This system uses STC's 8A8K64S4A12 microcontroller, which is simple to program and supports 3.3V-5V power supply. SMD packaging, small footprint and powerful pin functions.

3-2 Digital tube display circuit

Qqz1pVLQHRx0m0sC3Dxu8vx8w8xSLyeBLeyvn3oQ.png

Two 3-digit red digital tubes are used. One digital tube displays voltage, and the other digital tube displays current. Due to the limited ability of the microcontroller to drive high levels, a 74HC245 is used to drive the digital tube at the same time to improve the display effect and drive this digital tube. The tube mode is dynamic scanning

3-3 Voltage reference source circuit

SDWvAGLAz5wIFGmuTurwrOLjdpFeIOOYWuR9s2fy.png

Conduct a principle analysis of the core circuit, compare the schematic diagram with the text, and introduce the core device selection.

The reference circuit uses the TL431 voltage stabilizing chip. According to the voltage stabilizing formula in the manual, Vo=Vref*(1+R1/R2), Vref=2.5V, R1=5k, R2=10k, so Vo=3.75V. This circuit provides a voltage reference for the ADC sampling of the microcontroller.

3-4 Reset and independent button circuit

1MtgVsZabiQfkO73oc4yUgdBkHhehbHARYYsqsfP.png

I don’t need to say much about the reset circuit. The independent button uses 5 buttons, two coarse adjustment, two fine adjustment, and one confirmation button.

3-5 Microcontroller download circuit

cIMGaodrl2QPe5mHzTXXMzO8Bl0jRhtHRpNYMqOV.png

This circuit uses the USB-to-TTL CH340C, which does not require an additional crystal oscillator. What we should note here is that the power supply of CH340 must be powered separately, otherwise the CH340C will also be powered on again when the download requires repowering, causing the download to fail.

3-6 Auxiliary power supply circuit

yFUDSTPRw7hQKqBbbj0t2D32mW88yqtvTXbn7C4q.png

This circuit uses a linear voltage regulator chip 7805, with a maximum voltage of 36V. Our input must not exceed the maximum limit voltage of the 7805. Since this step-down chip is a linear regulator, heat will be generated on the chip. We must not touch it with our hands.

3-7 Analog DAC circuit

uMhRDSrUdojvbj71joULk0Je33ZfTUfUEoEdplpB.png

This circuit is a low-pass filter circuit. Its function is to convert the PWM signal generated by the microcontroller into a voltage signal, which can be converted between 0-5V.

3-8 Main power circuit

z8azQepWBA5XJQEMPv21uORUOa10hnnVv5fi1REU.png

The picture above shows the main circuit of the power supply. The lower part is the current loop, which samples the output current and controls it with a microcontroller to achieve closed-loop control of the current. The function of U7.1 is to convert the current signal sampled at 0.1om into a voltage signal that is amplified 10 times. , if 1A current flows out, then the output voltage of U7.1 is 1V. The function of U7.2 is to compare the current controlled by the microcontroller with the actual current to achieve current control.

8AvvvLetXE2BWA8iVQaBM8tL4gdarrjTjSHSOPl1.png

The picture above shows the main circuit of the power supply. The upper part is the voltage loop, which samples the output voltage and controls it with a microcontroller to achieve closed-loop control of the voltage. The function of U7.3 is to convert the voltage signal on the output voltage into a voltage signal that is reduced by 10 times. If the output voltage is 10V, then the output voltage of U7.3 is 1V. The function of U7.4 is to compare the voltage controlled by the microcontroller with the actual voltage and output it to the FB pin of the buck chip to achieve voltage control.

3-9 Schematic display

98LwlVO89lUU0GvHYnfaKcTcMJWpnn8JDdS8bgCv.png

7jU43MSKkjp4Dn1DQitQGDBYsrKyGA1NhfrbBSs6.png

4 PCB design

4-1 Border design

CKW7vrjfUVBNfx7BVrC8RX6HvFEpw0yQ8ZwS9Tmf.png

4-2 PCB layout

doFniyGRCzvJxjKL3qSPWdcLjOou9xeRjH4ZAAYQ.png

Regarding the placement of components, we must pay attention to the FB pin of the power supply chip being kept away from the inductor. The high-frequency signal on the inductor will interfere with the voltage feedback. At the same time, our ground loop must be the shortest loop. The components in the power part should be separated from the components in the analog part by a certain distance to prevent interference.

4-3 PCB routing

On the PCB wiring, we must pay attention to the power wiring as thick as possible, and at the same time, the power ground should be connected to the analog ground at a single point, especially near the inductor, and the wiring should be as few as possible to prevent interference from the inductor.

g6tGOGDc4OplNeUdIlMOTbyBKE46Q4XPnnd4LTIk.png

EKbTur3at5h9kuB1psUKRk0EU2vycE0wGx4iGC8P.png

4-4 Copper coating and silk screen printing

When pouring copper, we need to separate the power ground and analog ground to achieve the best effect. The distance between the copper pours of the power supply should be large.

5 Software introduction

5-1 Software flow chart

wt1HpGUXzWRH055B73yvUg4BEQzz0gaepghzISyI.png

5-2 Core code analysis

gCn9Gs2FQGoNUkC4MtH8dHz9cro9rSMWYNiWs84P.png

J9kjZECTNu9GDpKUtXRnwEu7wiiB2VmbeVb3MU6B.png

6 Debugging instructions

6-1 Hardware debugging

(1) Hardware welding

When welding, we must pay attention to raising the temperature of the soldering iron when welding power devices such as inductors. Otherwise, it will affect the firmness of the welding and cause abnormalities in the components. At the same time, there is a heat dissipation pad under the BUCK chip. We must remember to connect the

(2) Hardware debugging

When debugging the hardware, we should pay attention to the value of the resistor of the op amp, which can be adjusted appropriately, especially the current feedback end. Maybe you have a 1A current flowing through it, but the actual sampling end of the resistor is 1V, and the sampling end of the resistor is 1.2V. , this is when our resistance is increased. When the voltage we collect does not change linearly, it means that the capacitance has been increased. These values ​​must be adjusted appropriately. The performance of each chip is different.

6-2 Software debugging

(1) Software environment

Use keil C51 version

(2) Firmware burning

When downloading using STC ISP, remember to uncheck RESET for the IO port.

(3) Code debugging

Debugging is mainly about PID adjustment. The sampling voltage and current of each board are slightly different. We must patiently debug every small parameter. Be careful not to set the voltage too high at the beginning.

7 project information

7-1 Physical picture display

 

dtrH0hc2WGtOdcHAfQxZToJx2UNLpT88ilHJCIEM.jpeg

7-2 Video demonstration

Video link https://www.bilibili.com/video/BV1tL4y1G7zw?spm_id_from=333.999.0.0

 

 

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-22 13:40:01

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号