newlandmark

#The7thLiChuangElectricityContest#DesktopPowerSupply

 
Overview
 1. Project function introduction
       When I DIY some gadgets at home during the summer vacation, I need some low-voltage power supplies. There is no convenient
       one at home, and the power supplies on the market are expensive and relatively large, and I don’t want to buy cheap ones, so I designed this desktop power supply. Desktop power supply, as the name suggests, is a power supply commonly used on the desktop. This power supply supports the following functions:
       (1) It can display information such as voltage, current and power       
       (2) 3.3V and 5V regulated power supply
       (3) 1.25-10V adjustable power supply
       (4) A USB_A port that supports fast charging
       
 
2. Project properties
       This project is made public for the first time and is my original creation.
 
3. Open source agreement
       GPL3.0 open source agreement.
 
*4. Hardware part
       First, let’s explain the power input part. Since this project contains a fast charging USB_A port, when using fast charging, the current may reach up to 3.6A, so when choosing the power input, it is best to choose a power supply that can output more than 4A. However, since the rated voltage of the voltage regulator chip used in this project is 18V, the power supply voltage should not exceed 18V. The power supply I use is 12V5A.
       Then expand based on the four functions of this project.
       (1) Ability to display information such as voltage, current and power
      . This function uses the chip N32G430C8L7 as the main control. The N32G430C8L7 microcontroller product uses a high-performance 32-bit ARM Cortex™-M4F core, integrates a floating-point unit (FPU) and digital signal processing (DSP), and supports parallel computing instructions. The maximum operating frequency is 128MHz, and it integrates up to 64KB of on-chip encrypted storage Flash, supports multi-user partition authority management, and supports 16KB of embedded SRAM. It has an internal high-speed AHB bus, two low-speed peripheral clock buses APB and bus matrix, supports 40 reusable I/Os, provides rich high-performance analog interfaces, including 1 12-bit 4.7Msps ADC, supports 16 external input channels and 3 internal channels, and provides a variety of digital communication interfaces, including 4 U(S)ARTs, 2 I2Cs, 2 SPI/I2Ss, and 1 CAN 2.0B communication interface. The N32G430C8L7 microcontroller product can work stably in the temperature range of -40°C to +105°C, with a supply voltage of 2.4V to 3.6V, and provides a variety of power consumption modes.
      The figure below is the core circuit of the N32G430C8L7. When designing the circuit, it should be noted that each power pin must be connected to a 100nF capacitor for filtering. And the 1 pin needs to be connected to an additional 4.7uF capacitor. At the same time, in this design, an LED is connected to PB0, which can be used as a light to verify whether the circuit chip is available.
       The voltage and current information is collected through the ADC pin of N32G430C8L7, and the power information is obtained by N32G430C8L7 through calculation. The display is realized by a 0.96-inch screen, which communicates with the main control N32G430C8L7 through I2C, so that the power supply, current and power information are displayed on the screen. The figure below is the screen connection circuit.
       (2) 3.3V and 5V regulated power supply
       This function uses AMS1117 as a voltage regulator chip, and the maximum output current of this chip is 800mA. In this design, in order to ensure that the two voltages can output a maximum current of 800mA at the same time during operation, the design of first stabilizing the power supply to 5V and then stabilizing 5V to 3.3V is not used. Instead, the power utilization efficiency is sacrificed and the design of directly using the power supply for stabilization of both voltages is adopted. The figure below is the voltage regulator circuit.
       (3) Adjustable power supply within 1.25-10V
       This function also uses AMS1117 as a voltage regulator chip. The reason why the lower limit of the adjustable power supply range is set to 1.25V is that the basic voltage of the chip is 1.25V, and the regulated voltage is a multiple of 1.25V (not an integer multiple), and the upper limit is set to 10V because the power supply I use is 12V, and the chip is a step-down voltage regulator chip, so it cannot be adjusted to the voltage value of the power supply. The maximum adjustable voltage measured in this design can reach 10.42V. The figure below is the voltage regulator circuit of the adjustable power supply.
       V_CHA=1.25*(1+R6/R5)
       So by adjusting the resistance of the sliding rheostat, we can get the voltage value we need.
       If you want to learn more about the principle of this part of the circuit, I strongly recommend Yang Jianguo's new concept analog circuit. The power supply part is in Chapter 6. The course for adjustable power supply is about 13 minutes and 20 seconds in this video->Integrated three-terminal voltage regulator (adjustable + expansion voltage + expansion current)_bilibili_bilibili.
       In addition, it should be noted that the resistance value of R5 should not be too low. It is recommended to use 200Ω without making any changes. The specific instructions are in the chip manual and will not be repeated here. In addition, the rated voltage of this chip is 18V. For a 12V power supply, the voltage value can be appropriately increased to expand the voltage adjustment range of the adjustable power supply, but the resistance value of the sliding resistor R6 should also be increased.
       (4) A USB_A port that supports fast charging.
       The fast charging chip used in this function is IP6505. IP6505 is a buck converter with integrated synchronous switch and supports 11 output fast charging protocols. IP6505 has a built-in power MOS, an input voltage range of 4.5V to 32V, an output voltage range of 3V to 12V, and a maximum output power of 24W. It can automatically adjust the output voltage and current according to the recognized fast charging protocol. The typical output voltage and current are: 4V@3.6A, 5V@3.4A, 7V@3A, 9V@2.5A, 12V@2A. The step-down conversion efficiency of IP6505 is as high as 97%. The output of IP6505 has CV/CC characteristics. When the output current is less than the set value, the output is in CV mode and the output voltage is constant; when the output current is greater than the set value, the output is in CC mode and the output voltage is reduced. The output voltage of IP6505 has a line compensation function. When the output current increases, the output voltage will increase accordingly to compensate for the voltage drop caused by the impedance of the connection line. IP6505 has a soft start function to prevent the impact current at startup from affecting the stability of the input power supply. IP6505 integrates various fast charging protocols. It can automatically identify the fast charging protocol supported by the output terminal access device through DP/DM, and then automatically adjust the output voltage and current. The fast charging protocols supported by IP6505 are: DCP (Apple, Samsung and BC1.2), Qualcomm QC2.0/QC3.0, MTK PE1.1/2.0, Huawei fast charging protocol FCP/SCP, Samsung fast charging protocol AFC, Spreadtrum fast charging protocol SFCP. In addition, IP6505 has a variety of protection functions, including input overvoltage, undervoltage protection, output overcurrent, overvoltage, undervoltage, short circuit protection, etc. The figure
       below shows the fast charging circuit.
Common mode range: –0.3V to 26V
Offset voltage: ±150μV (maximum)
Supports 10mV full-scale shunt voltage drop
Quiescent current: 100μA (maximum)
       To describe the work of this chip in plain language, it is that the chip amplifies the voltage across the current-sensing resistor (R14 in this circuit) by a certain multiple and outputs it. The chip INA199A1DCKR used in this design amplifies it by 50 times, collects the output voltage, and calculates it according to the resistance value of the current-sensing resistor to obtain the current information on the line. The calculation formula is as follows:
       I=(OUT1/50)/0.01=2OUT1
       Note: OUT1 is the output voltage of INA199A1DCKR, 50 is the amplification factor of INA199A1DCKR, and 0.01 is the resistance value of the current-sensing resistor. At the same time, if other current detection chips in this series are used, please adjust the above formula according to the amplification factor of the chip.
 
*5. Software part
       The software part of this project is relatively simple and is obtained by changing the official routine.
       The development software used in this project is keil. In the schematic diagram of this project, the SWD debug pin and USART1 pin of the main control are brought out for debugging and downloading the program. I use the SWD pin and the debugger is ST_LINK V2.
       The following figure is a program flow chart.
       From the flow chart, we can see that the program first enables the system clock and the clocks of all peripherals used, then initializes the log (the log will send error information through the serial port when the program reports an error, which is a function in the official routine), followed by the initialization of I2C, which should be placed before the initialization of OLED to ensure that OLED can communicate with the main control, and finally the initialization of peripherals, including OLED, DMA, ADC and LED.
       Then enter the while loop, in the main function, first convert the data collected by ADC into actual voltage value, current value and power value according to the formula, and then display these values ​​on the OLED, and finally flip the LED to make it flash to prove that the program is running, and then enter the while loop again to achieve real-time refresh on the OLED.
       The following is a program introduction:
1. Functional description
(1). ADC samples and converts the analog voltage of the PA1, PA2 and PB12 pins
(2). The ADC conversion result is read into the variable ADCConvertedValue through the DMA_CH1 channel
(3). The OLED receives the voltage value, current value and power value through I2C and displays them
(4). The LED flashes once every second
2. Usage environment
Software development environment: KEIL MDK-ARM V5.34.0.0
Hardware environment: Based on the desktop power supply development of #7th Lichuang Electric Competition#
3. Instructions for use
System configuration:
(1). Clock source:
Hse = 8m, pll = 128m, ahb = 128m, apb1 = 32m, apb2 = 64m, adc clk = 128m /16, adc 1m clk = Hse /8
(2). Port configuration:
Select PA1, PA2 and PB12 as analog functions of ADC conversion channels
(3). Direct memory access:
DMA_CH1 channel loopback mode passes the half-word ADC conversion result to the ADCConvertedValue variable
(4). ADC:
ADC continuous conversion, scan mode, software trigger, 12-bit data right alignment, conversion channel PA1, PA2 and PB12 analog voltage data
(5). I2C:
Select PA4, PA5 and OLED for I2C communication
Usage:
(1). After compiling correctly, use ST_LINK to download the program
(2). Press the reset button and the program starts running
 
*6. BOM list
       Note: Some components purchased on Taobao can also be purchased, but compared to LiChuang Mall, Taobao purchases are cheaper. If you find it troublesome, it is recommended to search and purchase in LiChuang Mall.
 
*7. Competition LOGO verification
 
 
* 8. Demonstrate your project and record it as a video to upload
 
       . The demonstration video has been attached.
 
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-21 04:46:54

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号