sJOqU

STM32F030 Voltage and Current Meter

 
Overview
Power Supply:
This device can be powered in two ways:

DC power
supply and Type-C interface.

Component
Procurement Instructions:

Most components can be ordered directly from the LCSC online store using the BOM (Bill of Materials). If the price is too high, you can also purchase them yourself based on the BOM.

Note that
the following components may not be included in the BOM: 20P

jumper caps , 2M copper pin headers (models: M2*3+3 and M2*8+3), and M2 screws (recommended length 4-5MM) . These components can be purchased from the LCSC online store or Taobao. Button Design: The chosen buttons are relatively long, allowing the panel's elasticity to be used for easy button presses. For better tactile feedback, longer buttons can be selected, or the height of the top copper pin headers or the thickness of the acrylic panel can be appropriately reduced. 2. Hardware Design: Detailed information can be found in the training camp document: Hardware Design MCU Selection . This project uses the LCSC Diwenxing development board as the main controller, directly connected to the PCB via a 20P female header, which greatly reduces the difficulty of development and soldering. Advantages of CW32 : Wide operating temperature range: -40~105℃; Wide operating voltage range: 1.65V~5.5V (STM32 only supports 3.3V systems); Strong anti-interference: HBM ESD 8KV; All ESD reliability reaches the highest international standard level (STM32 ESD 2KV) ; Project focus - Better ADC: 12-bit high-speed ADC, achieving ±1.0LSB INL 11.3ENOB; Multiple Vref reference voltages (STM32 only supports VDD=Vref); Stable and reliable eFLASH technology. Power supply circuit, digital tube circuit, voltage sampling circuit . In this project, an additional voltage sampling circuit was added. Therefore, we can discuss the significance of range switching for improving measurement accuracy. Multimeters often have multiple ranges to achieve more accurate measurements. By adjusting different ranges, the optimal measurement accuracy of the measured point within the corresponding range can be obtained. This project requires a combination of hardware and software to achieve this function. When we first use the ADC_IN11 channel mentioned above to measure voltages within 30V... If the measured voltage is within 0~3V, the ADC_IN9 channel is used for measurement. At this time, due to the reduced voltage division ratio, the measurement accuracy is greatly improved. There are many ways to implement gear shifting, and the development board design provides more design possibilities. The selection of voltage sampling circuit and current sampling circuit mainly needs to consider the following aspects: the maximum value of the pre-designed measurement current (in this project, this is the voltage difference caused by the 3A current sensing resistor; it is generally not recommended to exceed 0.5V). The power consumption of the current sensing resistor should be selected based on this parameter. Considering the power consumption (temperature) problem under high current, a 1W packaged metal wire-wound resistor was selected in this project. The voltage amplification factor of the current sensing resistor: No operational amplifier was used to build the amplification circuit in this project, so the factor is 1. Then, the current sensing resistor value can be calculated using the above parameters. Selection: Since no amplification circuit was used in this project, therefore... A larger sampling resistor is needed to obtain a higher measured voltage for measurement. However, considering that a larger resistor would result in a larger voltage drop and higher power consumption, an unlimited selection of a larger resistor is not feasible. This project uses a 1W packaged resistor, corresponding to a power rise of 1W. Based on the above data, a 100mΩ current sensing resistor was chosen. According to the formula, 3A * 100mΩ = 300mV, 900mW. To handle different operating environments, especially high-current scenarios, the R0 resistor can be replaced with constantan wire or a shunt. The choice of alternative can be based on the specific application scenario. For safety and educational purposes, this project will not discuss measurements exceeding 3A, but the principle remains the same. The current sampling circuit has two current sampling interfaces, CN1 and CN2, for convenient debugging. For normal measurements, only CN2 needs to be connected. When a project requires connecting a multimeter or similar device in series for comparison and verification, pin 1 (red wire - current in) and pin 2 (black wire - current OUT) of CN1 are used simultaneously to simulate current measurement, calibration, and auxiliary circuitry for measurement calibration. The essence of current sampling is to collect the voltage drop across the sampling resistor when current flows through it, i.e., to collect the voltage value. This circuit uses RP2 to provide a voltage value in the range of 0 ~ 0.238V (5V ÷ 210K * 10K), which is connected to the chip's current sampling pin via the I+ network. In actual use, the voltage at I+ simulates the voltage drop across the unsoldered 100mΩ sampling resistor. At this point, the simulated measured current value Imeasured = the voltage value Vi + ÷ 100mΩ, which is also exactly equal to the measured voltage value multiplied by 10. That is, it provides a simulated current measurement of 0~2.38A. Set the multimeter or high-precision benchtop digital multimeter to the voltage measurement port, with a range within 3V. Insert the black negative probe into the T_GND interface next to the voltage measurement terminal, and the red positive probe into the TI+ port for current measurement to measure the actual voltage value of I+. This demonstrates that the circuit can not only accomplish the above design tasks but also provide a direct test of the accuracy of the MCU's ADC peripheral. You can write your own program to verify this. 3. Software Section : The board has three buttons, K1, K2, and K3. For detailed instructions on serial port firmware programming , please refer to the attached file. The compiled firmware (ending in hex) is provided; you can directly use CW Programmer V1.53 to flash the program onto the development board. Note: When programming via serial port, you need to switch the jumper cap on the development board to 1; after programming, you need to switch it back to 0. This was my first time participating in LCSC's training camp, and through this camp, I learned some basic principles of voltmeters and ammeters.





 






















 







 
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 02:40:04

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号