GiWSozVa

CW32 Beginner's Guide to Voltage and Current Meters

 
Overview
I. Design Background
  I was pleased to learn about and become familiar with a domestically developed development board during the summer: the LCSC CW32F030C8T6 development board. My learning and practical focus was on a voltmeter and ammeter.
  Digital voltmeters and ammeters combine ADC technology with circuit measurement principles, accurately converting analog voltage and current signals into digital displays for easy reading and analysis by electronic engineers. This device not only improves the accuracy and efficiency of circuit measurements but also helps engineers better understand circuit behavior, making it a powerful tool for electronic design and troubleshooting, and playing a crucial supporting role in the work of electronic engineers. In product applications, digital voltmeters ensure the accuracy and safety of circuit design, while also providing strong support for product quality control and subsequent maintenance.
An ADC (Analog-to-Digital Converter)
  is an indispensable key component in electronic systems, converting continuous analog signals into digital signals, enabling digital processing and analysis. ADCs play a crucial role in signal conversion, measurement and data acquisition, control system input, and communication and signal processing. Their widespread application promotes the intelligent and precise control of electronic equipment in various industries and is one of the key factors driving modern technological progress.
II. Design Approach
   Learning to design and build a digital voltmeter and ammeter is highly beneficial for improving personal professional skills. The digital voltmeter and ammeter project covers multiple aspects, including microcontroller circuit design and implementation, signal acquisition and processing circuit design, user interface development and optimization, and product appearance design. It integrates knowledge from multiple fields such as electronic technology, microcontroller programming, circuit design, and industrial design. This project has the following highlights:

It adopts a core board plus expansion board design concept and uses plug-in device design, making learning simpler and exploration more in-depth;
the core board uses the domestic Wuhan Xinyuan Semiconductor CW32 as the main controller, while also being compatible with other similar development boards; however, the CW32 has advantages in ADC sampling.
The project has a high degree of integration and strong practicality; after completion, it can be used as a desktop everyday instrument;
the project has abundant learning materials, including circuit design tutorials, PCB design, code programming learning, and training for engineers' debugging abilities. III. Hardware Design
1. Power Supply Circuit


   This project uses an LDO as the power supply. Considering that most voltmeter products are used in industrial scenarios with 24V or 36V power supply, and the core circuit does not require high power consumption, this project selected the SE8550K2-HF with a maximum input voltage of up to 40V as the power supply. The SOT89 packaged chip provides better heat dissipation and can provide a maximum current of 250mA. In actual use, care should be taken not to exceed 40V.
   A Schottky diode D1 is also added to the circuit to prevent reverse connection of the input voltage, and fuse resistors (R1/F1) are used for voltage division and current limiting. The electrolytic capacitors and ceramic capacitors of the LDO are designed in parallel in a front-to-back sequence. The electrolytic capacitors filter out low-frequency interference, while the ceramic capacitors filter out high-frequency interference. The combination of the two can make the circuit have a good filtering effect in both high-frequency and low-frequency regions.
2. Circuit Design Points and Specifications
When drawing the power supply circuit, whether it is the schematic diagram or the PCB, the following points should be noted:


Schematic Diagram Specifications: GND should be facing down and the power supply should be facing up. Do not have the ground facing up.


Capacitor Design: In both the schematic and PCB design, electrolytic capacitors are placed first, followed by ceramic capacitors.


Grounding Design: Single-point grounding; the ground of the current power supply is connected to the GND of the main electrolytic capacitor of the current power supply; the ground of the main electrolytic capacitors of each stage power supply is connected to the GND of the main electrolytic capacitor of the preceding stage power supply. The


digital tube display area in this circuit uses a small board for in-line connection. Other spare pins are also brought out. Upgrades are planned using a small LCD board. The measurement interface uses a model aircraft battery interface, slightly protruding from the outer frame for easy insertion.


3. Key Advantages of CW32 in this Project

: Wide operating temperature range: -40 ~ 105℃;
Wide operating voltage: 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. (Flash0 pending).

4. Voltage Sampling Circuit:
  The voltage divider resistors in this project are designed to be 220K + 10K, therefore the voltage division ratio is 22:1 (ADC_IN11).
Considering the potential fluctuations in the measured power supply, a 10nF filter capacitor is connected in parallel with the low-side voltage divider resistor to improve measurement stability.
An additional voltage sampling circuit is also added. To achieve higher accuracy, multimeters are often equipped with multiple range settings. By adjusting these settings, the optimal measurement accuracy for the measured point within the corresponding range can be obtained. This project requires a combination of hardware and software to implement this function. When we first use the ADC_IN11 channel to measure voltages below 30V, if the measured voltage is within the range of 0~3V, we then use the ADC_IN9 channel for measurement. In this case, due to the reduced voltage division ratio, the measurement accuracy is significantly improved.
The voltage divider resistor selection
  design considers the maximum value of the measured voltage. For safety reasons, this project uses 30V (the actual maximum can be 99.9V or 100V).
The ADC reference voltage is 1.5V in this project, which can be configured through the program.
To reduce power consumption in the sampling circuit, the low-side resistor (R7) is usually chosen as 10K based on experience.
The high-side resistance of the voltage divider resistor can then be calculated using the above parameters.
The required voltage division ratio is calculated, i.e., the ADC reference voltage. The design input voltage can be calculated using known parameters: 1.5V/30V = 0.05.
The high-side resistance is calculated as: low-side resistance/voltage division ratio. Using known parameters, 10K/0.05 = 200K.
A standard resistor is selected: a resistor slightly higher than the calculated value of 200K is chosen. We typically choose E24 series resistors; therefore, in this project, 220K, which is greater than 200K and closest to the calculated value, is selected.
If, in practical use, the voltage to be measured is lower than 2/3 of the module's design voltage (66V), the voltage divider resistor can be replaced and the program modified to improve measurement accuracy. An example is provided below:
Assuming the measured voltage is no higher than 24V, and other parameters remain unchanged
, calculations show 1.5V/24V = 0.0625, 10K/0.0625 = 160K. 160K is a standard E24 resistor and can be directly selected, or a higher value 180K can be chosen with some redundancy.
If, in practical use, the voltage to be measured is higher than the module's 99V design voltage, the voltage divider resistor can be replaced or the reference voltage modified to achieve a larger voltage measurement range. An example is provided below:
Assuming the measured voltage is 160V, the solution is to increase the voltage reference to expand the measurement range.
Given that the voltage division ratio of the selected resistor is 0.0145, we can calculate 160V * 0.0145 = 2.32V by reverse calculation using the formula. Therefore, we can choose a 2.5V voltage reference to increase the measurement range (increasing the measurement range will reduce accuracy).

5. Current Sampling Circuit
  This project uses a low-side current sampling circuit for current detection. The low-side of the sampling circuit is designed to share a common ground with the meter interface on the development board. Therefore, do not solder the sampling resistor R10 during the internal calibration test of the meter! Solder it onto the PCB only after the test is completed and it is used in actual applications.
The sampling current designed for this project is 3A, and the selected sampling resistor (R0) is 100mΩ.
The design analysis and
  selection of the sampling resistor mainly considers the following aspects:

the maximum value of the pre-designed measurement current;
the voltage difference caused by the 3A current sensing resistor in this project;
and the power consumption of the current sensing resistor, which should generally not exceed 0.5V. A suitable package should be selected based on this parameter. Considering the power consumption (temperature) issue under high current, a 1W packaged metal wire-wound resistor was selected
. The voltage amplification factor across the current sensing resistor: no operational amplifier is used in this project, so the factor is 1. The current

sensing resistance value can then be calculated using the above parameters. Selection:

  Since no amplifier circuit is used in this project, a larger sampling resistor is needed to obtain a higher measured voltage for measurement. However, considering that a larger resistor will result in a larger voltage difference and higher power consumption, a larger resistor cannot be selected without limit. A 1W packaged resistor was selected in this project, corresponding to a power consumption rise of 1W.
  Based on the above data, this project selected a 100mΩ current-sensing resistor. 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.
6. Digital Tube Display:
  This project uses two 0.28-inch three-digit common-cathode digital tubes as display devices. Compared to displays, digital tubes offer better visibility in complex environments. Depending on the specific needs of the operating environment, smaller current-limiting resistors can be used to achieve higher brightness. Furthermore, digital tubes have better mechanical properties and are not as easily damaged by external forces as displays. They are commonly used in industrial applications requiring stability and reliability. From a development board learning perspective, this makes it easier to purposefully learn about electronic measurement principles and related development.
  In this project, actual testing showed that the current-limiting resistors (R1~R6) of the digital tube were configured to 300Ω. The corresponding brightness, whether for red or blue digital tubes, provided good visibility and a soft, non-glaring light.
This digital tube design uses a small board connection, as shown in the diagram below.
  In terms of software, this project uses dynamic scanning to drive the digital tube. Therefore, at any given time, only a maximum of 8 segments of the digital tube (or LEDs) are lit, or in other words, only one digit is lit. According to the design, the required driving current is approximately 11mA (IO port high-level voltage 3.3V ÷ 300Ω). The CW32 MCU's single I/O pull-up/sink current capability can reach 25mA (see the official datasheet). Therefore, this design is feasible.
7. LED Indicators
  This project also includes a power indicator and an I/O working indicator.
  One is PWR_LED, and the other is I/O_LED, which are marked on the circuit diagram. To reduce the current consumption of the LEDs, some LED brightness was sacrificed, and the number of device parameters was reduced. The current-limiting resistor for the LEDs was chosen to be 10K. This proved feasible in actual use.
8. Button Circuit Design:
  There are various design methods for the button control circuit. Thanks to the CW32's internal I/O ports which can be configured with pull-up and pull-down resistors, the button control circuit on the outside of the chip does not need to be configured. One end of the button is connected to the MCU's I/O, and the other end is grounded. When the button is pressed, the I/O is pulled low.
9. TL431 Circuit Design for Voltage Measurement and Calibration:
  This project added an extra TL431 circuit to provide a 2.5V reference voltage. This can be used to provide an external voltage reference for the chip to calibrate the AD converter. From a product design perspective, due to the inherent ADC performance advantages of the CW32, this circuit is not necessary. This circuit was designed on the development board for learning related application principles.
10. Other Functions:
  This circuit also includes a small board circuit for LCD connection, planned for later implementation of LCD display of voltage and current. The right side of the circuit board also has an interface for connecting to the KT6368A Bluetooth pass-through board, allowing for remote viewing of voltage and current displays and data acquisition via mobile phone or computer.
11. Brief Usage Instructions:
The circuit board has three large switches: K1 for switching display modes, K2 for setting and saving the reference value for the corresponding mode, and K3 for returning to normal mode.
Mode 0: Normal operating mode, displays the measured voltage and current values.
Mode 1: 5V voltage calibration value; the upper digital tube displays 5.05, and the lower tube displays the currently measured voltage value. Use a high-precision multimeter to measure and adjust the voltage potentiometer until 5V is displayed. Press K2 to write the current calibration value.
Mode 2: 15V voltage calibration value; the upper digital tube displays 5.15. Calibrate using the same method as for 5V, and press K2 to write the current calibration value.
Mode 3: Current 0.5A calibration value. The upper digital display shows A.0.5, and the lower display shows the currently measured current value. Use a high-precision multimeter to measure the current, adjust the external current value to 0.5A, press K2, and write the current calibration value.
Mode 4: Current 1.5A calibration value. The upper digital display shows A.1.5, and the lower display shows the currently measured current value. Use a high-precision multimeter to measure the current, adjust the external current value to 1.5A, press K2, and write the current calibration value.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 01:59:39

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号