Project Overview:
The digital voltmeter and ammeter combines 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, serving as a powerful tool for electronic design and troubleshooting, and playing a crucial supporting role in the work of electronic engineers. In product applications, the digital voltmeter and ammeter ensures the accuracy and safety of circuit design while also providing strong support for product quality control and subsequent maintenance.
Project Functionality:
This design is a voltmeter and ammeter based on the CW32 microcontroller; it features three independent buttons with functions of mode, calibration, and return, enabling more accurate measurement of calibrated voltage and current;
the project
adopts a core board plus expansion board design concept, using plug-in components to simplify learning and deepen exploration;
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.
The project is highly comprehensive and practical, and the completed design can be used as a desktop instrument.
It offers abundant learning materials, including circuit design tutorials, PCB design, code programming instruction, and training for engineers' debugging skills.
The principle of calibration
involves compensating for instrument system errors by measuring the deviation of a standard, thereby improving the accuracy and precision of the instrument or system. To improve the measurement accuracy and precision of voltmeters and ammeters, voltage and current calibration is necessary.
The common calibration principle is as follows:
Assume a sampling system where the AD section can obtain digital quantities, corresponding to physical quantities such as voltage (or current).
If an AD value point Xmin is calibrated at the "zero point" and an AD value point Xmax is calibrated at the "maximum point", according to the principle that "two points form a straight line", a straight line connecting the zero point and the maximum point can be obtained. The slope k of this line is easy to obtain. Then, by applying the equation of the straight line to solve for each point X (AD sample value), the physical quantity (voltage value) corresponding to the AD value can be obtained:

k = (Ymax-Ymin)/(Xmax-Xmin) (because the first point is the "zero point", Ymin = 0 above).
Therefore, the physical quantity corresponding to the AD value at any point in the above figure is:
y = k×(Xad-Xmin)+0.
The above algorithm only performs calibration between the "zero point" and the "maximum point". If the intermediate AD sample value is used, it will bring a large error in the corresponding physical quantity. The solution is to insert more calibration points.
As shown in the diagram below, four calibration points (x1, y1), (x2, y2), (x3, y3), and (x4, y4) are inserted.

This results in a line that is no longer a straight line but a "reflected line" (equivalent to segmented processing). To calculate the voltage value corresponding to a point Xad between x1 and x2:
y = k × (Xad – X1) + y1.
It can be seen that the more calibration points inserted, the higher the accuracy of the physical value.
Voltage and current measurements can be calibrated using a voltage and current calibration board, a multimeter, or other suitable equipment. The more calibration points, the more accurate the measurement. Calibration is performed using
button operations. The specific operation method is as follows:
Define 5 working modes. The K1 key is used to switch display modes. The K2 key sets the parameter value for the corresponding mode and saves it to FLASH. The K3 key returns to mode 0.
Mode 0: Displays normal voltage and current values (the upper row of digital tubes displays the voltage value in .V or .V automatically, the lower row displays the current value in _.**A).
Mode 1: 5V voltage calibration setting. The upper row of digital tubes displays 5.05. The lower row displays the current voltage value in _.V or ._V. In this mode, the multimeter should be set to 5.00V when measuring the measured position. Pressing the K2 key will calibrate the current value to 5V.
Mode 2: 15V voltage calibration setting. The upper row of digital tubes displays 5.15. The lower row displays the current voltage value in _.V or ._V. In this mode, the multimeter should be set to 15.0V when measuring the measured position. Pressing the K2 key will calibrate the current value to 15V.
Mode 3: 0.5A current calibration setting. The upper row of digital tubes displays A.0.5. The lower row displays the current current value in _.**A. Pressing the K2 key sets the current value to 0.5A.
Mode 4: Current calibration value setting of 1.5A. The upper row of the digital tube displays A.1.5. The lower row displays the current value *.**A. Pressing the K2 key sets the current value to 1.5A.
Software code
attached,
physical diagram.
BOM_CW32 Voltage and Current Meter.xlsx
Voltage and Ammeter Project.zip
PDF_CW32 Voltage and Current Meter.zip
Altium_CW32 voltage and current meter.zip
PADS_CW32 Voltage and Current Meter.zip
92765
TPS7A4701/3301 Linear Power Supply
Linear power supply module based on Texas Instruments' TPS7A4701/TPS7A3301 low-noise LDO.
The positive power supply voltage can be adjusted via a DIP switch, and the negative power supply voltage can be adjusted via a variable resistor. Specific parameters and performance of the chip can be found on TI's official website. It is ideal for powering analog circuits.
PDF_TPS7A4701-3301 Linear Power Supply.zip
Altium_TPS7A4701_3301 Linear Power Supply.zip
PADS_TPS7A4701_3301 Linear Power Supply.zip
BOM_TPS7A4701_3301 Linear Power Supply.xlsx
92766
CW32 Voltage, Current, and Resistance Meter
I'm very happy to participate in this training camp.
1. Project Function Introduction:
This is a voltage and current meter designed based on the LCSC CW32F030C8T6 development board. It can collect and display voltage, current, and resistance data, and a multimeter connection is provided to test the accuracy of the collected data.
2. Problems Encountered:
Because some circuits were self-designed, problems arose during testing, such as: 1. The 12V USB signal could not be triggered (optimized). 2. The lack of grounding in the resistance measurement circuit caused 3.7V interference with other ADC measurements (optimized). 3. There were issues with the LED and buzzer packaging (resolved).
3. Physical Product Images

4. LCSC Development Board Open Source
: LCSC CW32 Digital Voltage and Current Meter Expansion Board
5. Keil Project
(attached). The code is somewhat rough, and some functions are not yet implemented, such as calibration.
Voltage and Ammeter.zip
PDF_CW32 Voltage, Current, and Resistance Meter.zip
Altium_CW32 Voltage, Current, and Resistance Meter.zip
PADS_CW32 Voltage, Current, and Resistance Meter.zip
BOM_CW32 Voltage, Current, and Resistance Meter.xlsx
92767
My voltage and current meter
Based on the JLCPCB training camp, I made my own voltage and current meter for easy use.
1. Project Background
This project is a CW32 voltmeter and ammeter training camp jointly conducted by JLCPCB and Sinyuan Semiconductor. This is my first time participating in such a project organized by LCPCB EDA. I essentially completed the entire product development process by following along. Next, I will introduce and test the board I built. 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 Sinyuan Semiconductor CW32 as the main controller, while also being compatible with other similar development boards; however, the CW32 has advantages.
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 skills.
2. Project Attributes:
This project is based on an official case study and improved upon from a training camp jointly organized by JLCPCB and Wuhan Xinyuan Semiconductor. This version is being publicly released for the first time.
3. Introduction to the Open Source License :
GPL 3.0
is the GNU General Public License. If a product under the GPL license is used in a project, then that project must also use the GPL license, meaning it must be open source and free.
The GPL's premise is the open-source and free use of code, and the open-source and free use of referenced, modified, and derived code, but it does not allow the release and sale of modified and derived code as closed-source commercial software.
The most significant characteristics of the GPL are "viral distribution" and "disallowing closed-source commercial distribution." Linux, which we are familiar with, uses the GPL license.
The basic spirit of GPL 3.0
allows free use, copying, modification, and distribution of protected programs, but the source code must be provided during distribution.
Fees can be charged. For example, fees can be charged for the distribution of object code and source code, and for software maintenance (mainly providing technical support, hereinafter referred to as "maintenance"); however, license fees, royalties, patent license fees, and authorization fees cannot be charged.
All contributors to GPL programs automatically and freely provide patent licenses, promising not to sue for patent infringement (provided you comply with the GPL).
GPL programs allow others to crack them. If used on consumer hardware, modification and installation programs must be permitted.
4. Hardware Part
1. Voltage Sampling Circuit
This project uses a voltage divider circuit to achieve high voltage acquisition, designed to acquire voltages up to 100V, currently configured to acquire voltages of 0-30V. The voltage divider resistors in this project are designed to be 220K+10K, therefore the voltage division ratio is 22:1 (ADC_IN11).

This project also includes circuits used to simulate voltage measurement, measurement calibration, and measurement calibration aids.

2. The current sampling circuit
in 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 development board's meter interface.
The sampling current in this project is 3A, and the selected sampling resistor (R0) is 100mΩ. The selection of the sampling resistor mainly needs to consider the following aspects:
the maximum value of the pre-designed measurement current; in this project,
the voltage difference caused by the 3A current sensing resistor; generally, it is 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) 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 to build the amplification circuit, therefore the factor is 1.
Then... Based on the above parameters, the current sensing resistor value is selected
as follows: Since this project does not use an amplifier circuit, a larger sampling resistor is needed to obtain a higher measured voltage for measurement.
Considering that a larger resistor will result in a larger voltage drop and higher power consumption, an unlimited selection of a larger resistor is not possible.
This project uses a 1W package resistor, corresponding to a power rise of 1W.
Based on the above data, a 100mΩ current sensing resistor is selected. According to the formula, 3A * 100mΩ = 300mV, 900mW.
To cope with 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 made based on the actual application scenario. For safety and educational purposes, this project will not discuss measurements exceeding 3A, but the principle remains the same. 3.
Auxiliary circuits for simulating current measurement, calibration, and verification.

The digital tube display circuit

uses two 0.28-inch three-digit common-cathode digital tubes as display devices in this project. Compared to displays, digital tubes have better visibility in complex environments. The brightness of the digital tubes can be increased by using smaller current-limiting resistors to meet the needs of the actual usage environment. Furthermore, digital tubes have better mechanical properties and are not as easily damaged by external forces as displays. They are widely used in industrial applications requiring stability and reliability. From a development board learning perspective, this makes it easier to learn electronic measurement principles and related development in a targeted manner.
In this project, after actual testing, the current-limiting resistors (R1~R6) of the digital tubes were configured to 300Ω. The corresponding brightness, whether for red or blue digital tubes, had good visibility and was soft and not glaring.
3. TL431 Circuit Design for Voltage Measurement Calibration:

This project adds 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.
5. Software:
The software was designed by JLCPCB and Wuhan Xinyuan Semiconductor. Detailed official documentation is available, so I won't elaborate further here. I will only describe some key points, such as the function and usage of the three buttons on the board.
Calibration Operation Method:
This example uses button operation for calibration. The specific operation method is as follows:
Define 5 working modes. The K1 key is used to switch display modes. The K2 key sets the parameter value for the corresponding mode and saves it to FLASH. The K3 key returns to mode 0.
Mode 0: Displays normal voltage and current values (the upper row of digital tubes displays the voltage value *.V or .*V automatically switching, the lower row displays the current value _.**A).
Mode 1: 5V voltage calibration value setting. The top row of the digital display shows 5.05. The bottom row displays the current voltage value in .V or ._V. In this mode, the multimeter should be set to 5.00V to measure the voltage level. After pressing the K2 key, the current value will be calibrated as 5V.
Mode 2: 15V Voltage Calibration Setting. The top row of the digital display shows 5.15. The bottom row shows the current voltage value in _V or ._V. In this mode, the multimeter should be set to 15.0V when measuring the measured bit. Pressing the K2 key will calibrate the current value to 15V.
Mode 3: 0.5A Current Calibration Setting. The top row of the digital display shows A.0.5. The bottom row shows the current current value in _.**A. Pressing the K2 key will calibrate the current value to 0.5A.
Mode 4: 1.5A Current Calibration Setting. The top row of the digital display shows A.1.5. The bottom row shows the current current value in *.**A. Pressing the K2 key will calibrate the current value to 1.5A.
For detailed software tutorial documents, please click >>> Software-related Design
6. BOM List Notes
1. This circuit design uses the LCSC Diwenxing development board as the main controller, employing a modular design for learning purposes. You can purchase it from the LCSC development board website.
2. This circuit design uses a 0.28-inch common cathode digital tube; you can choose the color yourself.
3. This circuit uses an 8550LDO with a maximum input voltage of 40V, which is very convenient with VP power supply. 4.
This circuit design uses a 2mm banana-head female connector for easy insertion of multimeter probes for measurement; please do not purchase the wrong specification!
5. Note! Please double-check the BOM list when placing your order to ensure nothing is missing. Out-of-stock items may be removed from the store, and purchasing materials will extend your learning time.
7. Demonstrate the project and record a video for uploading. For a
detailed video explanation, please click >>> This is a video
Digital voltmeter and ammeter with calibration function.zip
Gerber_PCB1_2024-08-26.zip
PDF_My Voltage and Current Meters.zip
Altium_MyVoltage and Ammeter.zip
PADS_MyVoltage and Ammeter.zip
BOM_My Voltage and Current Meters.xlsx
92768
ammeter and voltmeter
This project was completed entirely following the JLCPCB voltmeter and ammeter tutorial without any major modifications.
Due to technical limitations, this project was largely completed following tutorials. I hope to improve my skills in future projects.
I. Design Background
An ADC (Analog-to-Digital Converter) is an indispensable key component in electronic systems. It converts 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 across various industries, and is one of the key factors driving modern technological progress. 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, serving as a powerful tool for electronic design and troubleshooting, and playing a vital 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. Learning to design and build a digital voltmeter and ammeter

using an Agilent 34401A desktop digital multimeter
is highly beneficial for enhancing personal professional skills. This 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 electronics, microcontroller programming, circuit design, and industrial design. Considering the learning pace and knowledge absorption capacity of beginners, we have specially launched this introductory-level digital voltmeter and ammeter project, which is very suitable for beginners in electronics and those who want to learn more about microcontroller applications. This project has the following highlights:
it adopts a core board plus expansion board design concept and uses plug-in components, 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.
The project is highly comprehensive and practical, and the completed design can be used as a desktop instrument;
the project has abundant learning materials, including circuit design tutorials, PCB design, code programming learning, and training for engineers' debugging skills.
II. Hardware Design
1. Power Supply Circuit

LDO (Low Dropout Linear Regulator) Selection This project uses an LDO as the power supply. Considering that most voltmeter products are used in industrial scenarios with 24V or 36V power supplies, the SE8550K2 with a maximum input voltage of up to 40V was selected as the power supply. The main reason for not using a DC-DC step-down circuit to handle the large voltage drop is to avoid introducing DC-DC ripple interference during the design process, and the secondary reason is to reduce project costs.
2. MCU Selection Analysis
To reduce the learning cost for everyone, this project uses the LCSC CW32F030C8Tx development board (core board) as the main controller, but this does not mean that we will talk less about this section. From the perspective of training engineers, the correct selection of the main controller is very important, as it relates to the overall advantage of the project. Regarding the voltmeter and current meter, the author used STM32/CW32 and some other 32-bit microcontrollers for some debugging and testing. This comparison is only with the STM32F103C8T6 as a reference for device selection, primarily aimed at providing ideas and improving understanding.
Avoid blind selection. When selecting an MCU (Microcontroller Unit) for this project, multiple aspects need to be considered to ensure the chosen MCU meets project requirements.
Clearly define your project needs: Understand the required computing power, including clock speed, processor core type, and whether a floating-point unit is needed.
Identify the required I/O ports and important peripherals, such as ADC peripherals. Since this is a development board project, primarily for debugging and learning, there are no strict limitations on the number of I/O ports: i.e., the associated costs are not considered.
Key advantages of the CW32 in this project
: Wide operating temperature range: -40~105℃;
Wide operating voltage range: 1.65V~5.5V (STM32 only supports 3.3V systems)
; Superior interference immunity: HBM ESD 8KV; All ESD reliability meets the highest international standard (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.
A detailed explanation of these advantages will be provided in the chapters on ADC sampling and related extensions.
The main characteristics of the CW32 ADC: This project requires a focus on the 4 reference voltage sources. (Content from the "CW32x030 User Manual")

3. 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).
The voltage divider resistor selection
is designed to measure the maximum voltage. For safety reasons, this project uses 30V (the actual maximum display value can be 99.9V or 100V).
The ADC reference voltage is 1.5V in this project, and this reference voltage can be configured through the program.
To reduce the power consumption of the sampling circuit, the low-side resistor (R7) is usually chosen as 10K based on experience.
Then, the high-side resistance of the voltage divider resistor can be calculated using the above parameters.
The required voltage division ratio is calculated, i.e., the ADC reference voltage. The input voltage is designed; using known parameters, 1.5V/30V = 0.05 can be calculated.
The high-side resistance is calculated as the low-side resistance/voltage division ratio; using known parameters, 10K/0.05 = 200K can be calculated.
A standard resistor is selected: a resistor slightly higher than the calculated value of 200K is chosen. We usually choose E24 series resistors; therefore, in this project, 220K, which is greater than 200K and closest to the calculated value, is selected.
If, in actual 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. The following example illustrates this:
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 actual use, the voltage to be measured is higher than the module's 99V design voltage, a different resistor can be selected. To expand the voltage measurement range, you can choose to replace the voltage divider resistor or modify the reference voltage. The following example illustrates this:
Assuming the measured voltage is 160V, we can choose to increase the voltage reference to expand the range.
Given that the voltage division ratio of the selected resistor is 0.0145, we can calculate 160V * 0.0145 = 2.32V using the formula. Therefore, we can choose a 2.5V voltage reference to expand the range (increasing the range will reduce accuracy).
Considering the potential fluctuations in the measured power supply, a 10nF filter capacitor is connected in parallel with the low-side voltage divider resistor in the circuit design to improve measurement stability.
(Range switching )
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 range settings 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 implement this function. When we first use the ADC_IN11 channel mentioned earlier to measure voltages below 30V, if the measured voltage is within 0~3V, then we use the ADC_IN9 channel for measurement. At this time, due to the reduced voltage division ratio, the measurement accuracy is greatly improved. There are many ways to implement range switching; the development board design provides more design possibilities.
4. Current Sampling Circuit
This project uses a low-side current sampling circuit for current detection. When learning the common ground between the low-side of the sampling circuit and the development board's meter interface, please do not solder R0!!!

The design analysis
for this project involves a sampling current of 3A, and the selected sampling resistor (R0) is 100mΩ. The selection of the sampling resistor mainly needs to consider 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 dissipation 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 dissipation (temperature) issue under high current, a 1W metal wire-wound resistor package was chosen
. The voltage amplification factor across the current sensing resistor is also important. Since no operational amplifier is used to build the amplification circuit in this project, the factor is 1.
The current sensing resistor value can then be calculated using the above parameters
. Since no amplifier circuit is used, a larger sampling resistor is needed to obtain a higher measured voltage for measurement.
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 package resistor, corresponding to a power consumption of 1W.
Based on the above data, a 100mΩ current sensing resistor was selected. According to the formula, 3A * 100mΩ = 300mV, 900mW can be calculated.
To cope with different operating environments, especially high-current scenarios, the R0 resistor can be replaced with constantan wire or a shunt. The replacement can be selected according to the actual application scenario. For safety and educational purposes, this project will not discuss measurements exceeding 3A in detail, but the principle is the same.
5. Digital Tube Display
This project uses a digital tube as the display unit.

This project uses two 0.28-inch three-digit common-cathode LED displays as the display device. Compared to a display screen, LED displays offer better visibility in complex environments. The brightness of the LED displays can be increased by using smaller current-limiting resistors, depending on the specific needs of the application environment. Furthermore, LED displays have better mechanical properties and are not as easily damaged by external forces as display screens. They are widely used in industrial applications where stability and reliability are crucial. From a development board learning perspective, this makes it easier to learn electronic measurement principles and related development in a targeted manner.
In this project, actual testing showed that the current-limiting resistors (R1~R6) for the LED displays were configured to 300Ω. The corresponding brightness for both red and blue LED displays was good and the brightness was soft and not glaring.
Strictly speaking, the current-limiting resistors should be added to the segments; adding them to the digits would affect the display effect. Our actual design places them in the digits to save a few resistors, but the impact on the display is not significant. Therefore, we add them to the digits for convenience.
The

driving principle of LED displays mainly involves controlling the switching state of each segment of the LED display to display numbers, letters, or symbols. The following is a detailed explanation of the driving principle:
Basic Structure of a Digital Tube:
A digital tube typically consists of seven or eight LED segments (eight segments in this project). Each segment represents a part of the digital tube and can display numbers 0-9, letters AF, etc.
Digital tubes come in two types: common cathode and common anode. The difference lies in whether the common terminal COM (the end connecting all LEDs) is connected to the negative or positive terminal of the power supply.
Driving Methods:
Segment Selection: The desired number or character is displayed by controlling the on/off state of each segment of the digital tube. Each segment corresponds to a control signal; when the control signal is on, the segment lights up, and vice versa. (a, b, c, d, e, f, g, dp)
Bit Selection: The digital tube to be displayed is selected by controlling the bit lines of the digital tube. Bit line control sets the bit line of the digital tube to be displayed to a high level, and the bit lines of other digital tubes to a low level. By continuously switching the state of the bit lines, the display switching between multiple digital tubes can be achieved.
Driving Circuit:
The driving circuit for a digital tube can be implemented using hardware circuits, such as integrated circuits like digital signal processors (DSPs), microcontrollers (MCUs), or shift registers, to generate control signals suitable for the LEDs.
These control signals can be in the form of pulse width modulation (PWM) signals, serial data signals, etc. By controlling the frequency, width, and amplitude of these signals, the brightness of the digital tube can be controlled, thereby displaying the desired numbers or letters.
Software Control:
In addition to hardware driving circuits, the driving of digital tubes can also be implemented through software control. By programming to generate control signals suitable for the digital tubes, more flexible and complex display effects can be achieved, such as scrolling or alternating display of numbers.
Driving Common Cathode and Common Anode Digital Tubes:
For common cathode digital tubes, the common cathode pin is connected to the negative terminal of the power supply, and the control pin is connected to the output pin of the control chip. When a certain number needs to be displayed, the control chip outputs the corresponding encoded signal to the control pin, causing the corresponding LED segment to light up.
For common anode digital tubes, the working principle is similar to that of common cathode digital tubes, except that the common anode pin is connected to the positive terminal of the power supply, and the control pin is connected to the output pin of the control chip.
Encoded Display:
In order for the digital tube to display the corresponding numbers or characters, the segment data port must output the corresponding character encoding. For example, to display the number "0", the character code for a common anode seven-segment display is 11000000B (i.e., C0H), while the character code for a common cathode seven-segment display is 00111111B (i.e., 3FH). The specific code depends on the actual seven-segment display.
Dynamic and Static Display:
Seven-segment displays can use either static or dynamic display methods. In static display, each of the eight segments of each seven-segment display is connected to an 8-bit I/O port address. As long as the I/O port outputs a segment code, the corresponding character is displayed and remains unchanged. Dynamic display, on the other hand, lights up each segment of the seven-segment display one by one, achieving simultaneous visual display through rapid switching.
In summary, the driving principle of seven-segment displays is to control the switching state of each segment of the seven-segment display to display numbers, letters, or symbols, and to achieve display switching between multiple seven-segment displays through segment selection and digit selection. Furthermore, the driving of seven-segment displays can be implemented through hardware circuits or software control, and common cathode or common anode seven-segment displays can be selected as needed.
This project actually uses dynamic scanning display to drive the seven-segment display.
To estimate the current required for the digital tube display,
this project actually uses dynamic scanning to drive the digital tubes. Therefore, at any given time, only a maximum of 8 segments of the digital tube (or LEDs) can be lit, or in other words, only one digit can be lit. According to the design, the required driving current is approximately 11mA, which is the high-level voltage of the I/O port: 3.3V ÷ 300Ω.
At this point, it is important to ensure that the selected MCU has sufficient current-source/current-sinking capability.


Analysis of the datasheet shows that the CW32 has no issues. (Some chips do not work.)
6. LED Indicators
This project additionally designed a power indicator and an I/O operation indicator.

LD_PWR is the power operation indicator

. Since the chip's I/O often has a greater current sinking capability than a current pulling capability, LED1 is designed to be active low (on).
To reduce the current consumption of the LED, some LED brightness is sacrificed, the number of component parameters is reduced, and the current-limiting resistor for the LED is selected as 10K.
7. Button Circuit Design

There are various design methods for the button control circuit. Thanks to the fact that the CW32's I/O port can be configured with pull-up and pull-down resistors internally, 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.
8. TL431 Circuit Design for Voltage Measurement and Calibration:
This project adds 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 is designed on the development board to learn the relevant application principles.

The TL431 is a relatively "old" device, a classic, and widely used one, still found in many electronic products.
Many beginners may be encountering this device for the first time, so we will briefly explain its principles to help everyone better apply the TL431.
TI defines it as a "Precision Programmable Reference." On the first page of the references, we can focus on several key characteristics.
Precision: Precision indicates that its output voltage is very accurate. I used a ±0.5% accuracy TL431, which measured 2.495V on the board at room temperature. Compared to common Zener diodes, the accuracy is vastly different. In the application circuit diagram, the TL431 is represented by a Zener diode symbol.
Adjustable Output Voltage: The adjustable output voltage is between Vref and 36V. In our project, we use the output Vref voltage, which is approximately 2.5V. Therefore, we use 2.5V in the description, which is approximately equal to Vref.
Sinking Current Capability: This refers to how much current the output voltage pin can provide. This is greatly influenced by the resistance value (R13) in the application circuit. It should not be less than 1mA. If there is no need for sinking current, do not design the current to be too high, as this will cause unnecessary power consumption.
WeChat_20240824174102.mp4
Voltage and Ammeter.zip
PDF_Ammeter and Voltmeter.zip
Altium_current_voltmeter.zip
PADS_Ammeter and Voltage Meter.zip
BOM_CurrentVoltage Meter.xlsx
92769
LCSC GeoStar CW32 Digital Voltage and Current Meter Expansion Board
LCSC GeoStar CW32 Digital Voltage and Current Meter Expansion Board
I. Design Background
Digital voltmeters 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, serving as 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.
II. Hardware Design
Main Circuit
Digital voltmeter and ammeter with calibration function.rar
VID_20240823_205238.mp4
PDF_LCSC GeoStar CW32 Digital Voltage and Current Meter Expansion Board.zip
Altium_LCSC·Diwenxing CW32 Digital Voltage and Current Meter Expansion Board.zip
PADS_LCSC·Diwenxing CW32 Digital Voltage and Current Meter Expansion Board.zip
BOM_LCSC·Diwenxing CW32 Digital Voltage and Current Meter Expansion Board.xlsx
92770
electronic