6TjCt

CW32 Voltage and Current Meter

 
Overview
I. Function Introduction
1. Measures and displays 0-30V DC voltage and 0-3A current.
2. Prints information via Bluetooth serial port.
3. Manual calibration for current and voltage measurements.
4. Automatic switching between 0-3V and 3V-30V ranges for voltage measurement; automatic switching between 0-1000mA and 1A-3A ranges for current measurement.
II. Circuit Design
1. Uses CW32F030 as the main control chip
. 2. Display circuit (both digital tube and OLED displays are acceptable):
This project uses two 0.36-inch common anode digital tubes as display devices, and employs an SN74HC595PWR8 shift register to reduce the pin usage of the main control chip.
3. Power supply circuit (LDO)
: Uses 12V power supply. In actual applications, the LDO section generates significant heat; it is recommended to increase the copper plating area for heat dissipation.
4. Current and voltage sampling circuit and interface
III. Software design
1. Switch modes by button 1
(1) Voltage and current data display
(2) Voltage 3.0V calibration
(3) Voltage 15.0V calibration
(4) Current 500mA calibration
(5) Current 1.5A calibration
(6) Voltage 0V and Current 0mA calibration
(7) Voltage 8V calibration
2. Perform data calibration by button 2
3. Return to the data page and store the data by button 3
IV. Effect diagram
0958dff3905bab5c2c529bcdb524e97d.mp4
31f355da24aa661b863c5dbf3bff137a.mp4
voltammeter_Project.zip
PDF_CW32 Voltage and Current Meter.zip
Altium_CW32 voltage and current meter.zip
PADS_CW32 Voltage and Current Meter.zip
BOM_CW32 Voltage and Current Meter.xlsx
92922
CW voltage and current meter project
This is a voltage and current meter based on the CW32F030, with calibration functionality. For the display, two 0.28-inch three-digit common-cathode LED displays can simultaneously show voltage and current.
Main functions:
Voltage has two levels: 0-3Vdc, 0-30Vdc;
Current range: 0-3A.
Environment configuration:
Install the CW32 pack. The firmware library can be downloaded from the Wuhan Xinyuan official website:
https://www.whxy.com/gujianku.html?keyword=f030.
If compilation errors occur, try installing ARM.CMSIS5.7.0.pak. Experiment
9 Code description:
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 the display mode. The K2 key sets the parameter value in 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 the digital tube displays the voltage value *.V or .*V automatically switches, and the lower row displays the current value _.**A).
Mode 1: Voltage 5V calibration value setting. The upper row of the digital tube displays 5.05. The lower row displays the current voltage value _.V or ._V. In this mode, the multimeter should be set to 5.00V when measuring the measured bit. After pressing the K2 key, the current value is calibrated as a 5V voltage value.
Mode 2: 15V voltage calibration setting. The upper digital display shows 5.15. The lower display shows the current voltage value as _V or ._V. In this mode, the multimeter should be set to 15.0V when measuring the measured bit. After pressing the K2 key, the current value is calibrated as a 15V voltage value.
Mode 3: 0.5A current calibration setting. The upper digital display shows A.0.5. The lower display shows the current current value as _.**A. After pressing the K2 key, the current value is calibrated as a 0.5A current value.
Mode 4: 1.5A current calibration setting. The upper digital display shows A.1.5. The lower display shows the current current value as *.**A. After pressing the K2 key, the current value is calibrated as a 1.5A current value.
Measurement Interface Description:
Note: For more information, please refer to the tutorial document: CW32 Digital Voltmeter and Ammeter Training Camp Project Tutorial Document
CW32x030_UserManual_CN_V2.5.pdf
CW32F030_DataSheet_CN_V1.8.pdf
Voltage and current modeling.zip
Experiment Nine + Digital Voltmeter and Ammeter with Calibration Function.rar
VID_20240821_182050_0_COMPRESSED.mp4
PDF_CW Voltage and Current Meter Project.zip
Altium_CW voltage and current meter project.zip
PADS_CW Voltage and Current Meter Project.zip
BOM_CW Voltage and Current Meter Project.xlsx
92923
Voltage and current meters based on LCSC GeoStar CW32
Voltage and current meters based on LCSC GeoStar CW32
1. Introduction:
This project selects the LCSC CW32F030C8Tx development board (core board) as the main controller. Compared to the STM32F103C8T6, the CW32F030C8Tx has a better ADC: a 12-bit high-speed ADC with ±1.0LSB INL, 11.3ENOB, and multiple Vref reference voltages.
Wuhan Xinyuan Semiconductor also provides a comprehensive and detailed datasheet to assist developers.
 
2. Functionality:
This voltmeter and ammeter, based on the LCSC CW32, measures a maximum voltage of 30V for safety and a maximum current of 3A.
It also features a calibration function to ensure more accurate measurements. Calibration compensates 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 the voltmeter and ammeter, calibration is required.
 
3. Schematic Diagram Explanation:
During schematic drawing, pay attention to the connection of net numbers. Even though JLCPCB EDA provides powerful DRC checks, it's still important to avoid missing net numbers.
 
4. Physical Component
Diagram: When soldering, pay attention to the positive and negative terminals of the components.
 
5. PCB Design Explanation:
In PCB design, power supply traces should be as wide as possible, approximately 20-60 mil. Ordinary signal lines: around 10 mil. ADC signal traces: 10 mil or 8 mil. Too wide a trace may affect signal integrity when the line is too long.
 
6. Key Program Explanation:
Voltage and Current Meter Main Program
 
7. Important Component Procurement:

When purchasing components, the original plan selected the SE8550K2-HF, but it was not in stock at the LCPCB online store. After comparing data and packages, the similar TX7550-M was used instead. So far, no problems have occurred during use.
The button section uses 6*3.6*2.5mm surface mount tactile switches, saving space.
The digital display uses an SP420361N three-digit LED instead of the unavailable LED-SEG-TH_FJ2381AH in the original design

. Assembly Instructions:
Regarding the banana plug connector, since there is no suitable package in LCSC EDA, attention must be paid to the size of the mounting holes in publicly available packages. Most banana plug connectors on the market have a 5.8mm hole diameter. Because I chose a 2mm package, the banana plug could not be installed, causing inconvenience in using the multimeter.
 
Demonstration Video
 
 
 
Voltage and current meter program.zip
WeChat_20240821174253.mp4
PDF_Voltage and Current Meter Based on LCSC GeoStar CW32.zip
Altium-based voltage and current meter using LCSC CW32.zip
PADS_Voltage and Current Meter Based on LCSC CW32.zip
BOM_Voltage and Current Meter Based on LCSC CW32.xlsx
92924
Voltmeter and Ammeter
Voltmeter and Ammeter
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. A 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 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 is highly beneficial for improving one's 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 after completion, it 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 CW32 in this project

: 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.

3. Voltage sampling circuit : The voltage
divider resistor in this project is designed as 220K+10K, therefore the voltage division ratio is 22:1 (ADC_IN11).
The voltage divider resistor selection

design measures the maximum value of the measured 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, one can choose to replace the voltage divider resistor or modify the reference voltage. The following example illustrates this:

Assuming the measured voltage is 160V, the solution is 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 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 for 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 earlier to measure voltages up to 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 the 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 that the low-side of the sampling circuit shares a common ground with 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.
Calculating the required current for the digital tube:
This project actually uses dynamic scanning to drive the digital tube, so 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 (IO port high-level voltage 3.3V ÷ 300Ω).
At this point, it is important to ensure that the selected MCU has sufficient current sinking/pulling capability.
6. LED Indicator Lights:
This project additionally designed a power indicator light and an IO operation indicator light.
Since chip I/O often has a greater current sinking capability than current pulling capability, LED1 is designed to be active low (lit).
To reduce the current consumption of the LED, some LED brightness was sacrificed, and the number of device parameters was reduced. The current-limiting resistor for the LED was chosen to be 10K.
7. 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.
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 for learning the relevant application principles.
The L431 is a relatively "old" device, very classic, and widely used; it is still found in many electronic products.
Many beginners may be encountering this device for the first time. We will briefly explain the principles of this product to help everyone better apply the TL431.
TI defines it by its name as a precision programmable reference. On the first page of the references, we can focus on several key characteristics.
**Precision:** Precision indicates its highly accurate output voltage. The TL431 I used has ±0.5% accuracy, and at room temperature, it measured 2.495V on the board. This is a world of difference in accuracy compared to common Zener diodes. In application circuit diagrams, the TL431 is internally 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 too high, as this will cause unnecessary power consumption.
 
Voltmeter and Ammeter (Final). 7z
fe6992ac5b7eec6605879d517a85777e.mp4
PDF_Voltage and Current Meters.zip
Altium_voltmeter_currentmeter.zip
PADS_Voltage and Current Meter.zip
BOM_Voltage and Current Meter.xlsx
92925
0718 Voltmeter and Ammeter Training Camp
Based on CW32F030 voltage and current meter
Design Background: ADCs (Analog-to-Digital Converters) are indispensable key components in electronic systems. They convert 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. The key advantages of the CW32
MCU
in this project include

: wide operating temperature range (-40~105℃)
, wide operating voltage (1.65V~5.5V, STM32 only supports 3.3V systems)
, superior anti-interference capabilities (HBM ESD 8KV, all ESD reliability meets the highest international standard (STM32 ESD 2KV))
, and a superior ADC (12-bit high-speed ADC with ±1.0LSB INL 11.3ENOB), multiple Vref reference voltages (STM32 only supports VDD=Vref), and
stable and reliable eFLASH technology. (Schematic and PCB

diagrams are also available.)
CW32 digital voltmeter and ammeter with calibration function.hex
BOM_Board1_PCB3_2024-08-08.xlsx
PDF_0718Voltmeter & Ammeter Training Camp.zip
Altium_0718 Voltmeter and Ammeter Training Camp.zip
PADS_0718 Voltage and Current Meter Training Camp.zip
BOM_0718 Voltage and Current Meter Training Camp.xlsx
92926
#Training Camp# LCSC Oscilloscope
Thanks to JLCPCB's LCPCB training camp for giving me this opportunity to learn about
the oscilloscope project.



 
 
 
 
Inverting Amplification Analysis:
When the voltage comparator IN+ > IN-, the output is VCC.
When the inverting amplifier IN is 1V, because IN- > IN+, the output is the maximum negative voltage. The output is fed back to IN- through R2 (R1 and R2 divide the voltage, R2 is 2/3 of VCC, the output is fed back to IN- through R2, which is equivalent to a pull-down, IN to R1 is equivalent to a pull-up). The IN- voltage is pulled low.
When IN- is less than GND, the output OUT is VCC. At this time, OUT and R2 form a pull-up, and IN- is pulled up again.
This process is repeated until the op-amp is stable.
 
When IN+ > IN-, OUT = VCC, OUT pulls up IN- through R2.
IN+
repeats until the op-amp is in steady state, IN+ = IN-; //This is the concept of virtual open circuit
 
(the return resistor is connected to the negative terminal, which is negative feedback).
 
In fact, it fixes the voltage difference between the inverting and non-inverting input terminals within a very small range, so that the amplifier works in the linear operating region, reducing the amplification factor A, which is no longer infinite.
 
 
 
I1 = I2 = IN/R1; Based on the virtual short circuit IN-=IN+ being GND,
Vout=(IN-) -V2=0v-IN/R1*R2; =-R2/R1*IN (amplification factor) // Adjusting R1 and R2 can change the amplification factor
and IN to 1v, OUT to -2v; Note that if the output is ±12V, the power supply must also be ±12V (dual power supply).
 
 
 
 
 
 
 
 
 
 
 
 
In-phase amplification analysis:
IN=IN+=IN-
, so I1 flows from R1 to GND. Due to the virtual short circuit characteristic of the op-amp, I1 will not flow into or out of the op-amp, so the current can only flow out from OUT.
I1=I2 =IN/R1, U2=I1*R2.
Vout=IN+U2=IN+IN/R1*R2
=(1+R2/R1)*IN.
 
Voltage follower analysis:
Vout=(1+R2/R1)*IN.
R1 is infinite.
Vout=(1)*IN
 
 
 
 
 
 
 
 
input connected to IN+ is positive amplification
input connected to IN- is negative amplification
When analyzing, the input can be assumed to be 0; or the analysis can start from the ground terminal.
 
 
 
 
Because it is assumed that the circuit satisfies the ohmic characteristic, the two power supplies can be regarded as independent ideal power supplies. Here, the circuit can be divided into a reverse circuit and a forward circuit for analysis. Finally, the two analysis results are added in the agreed direction to obtain the final result.
 
 
 
 
When the voltage division ratio is 35:1 680k+2k—20k
        165~-56
When the voltage division ratio is 30:1                 
        150~-48
When the voltage division ratio is 5:1 750k~39+11k
        25~-8
 
Single limit comparator
Generally speaking, the comparator only outputs high and low levels. If the op-amp is used as a comparator, it does not need to work in the linear region. Because operational amplifiers (op-amps) have very high amplification, if the voltage at the non-inverting input is slightly larger than the voltage at the inverting input, the op-amp will output its maximum voltage. For rail-to-rail op-amps, this maximum voltage will be close to the supply voltage Vcc. Conversely, if the voltage at the inverting input is larger than the non-inverting input, the op-amp will output its minimum voltage. If the supply voltage includes a negative voltage, the minimum voltage will be -Vcc; otherwise, it will be 0. Some circuits add output voltage limits, restricting the maximum and minimum values ​​to specific values. For ease of description, this section will use Vcc for the maximum output voltage and -Vcc for the minimum output voltage.
  We can connect one input to a reference voltage U_REF and the other to the voltage to be measured u_I to compare the magnitudes of the reference voltage and the voltage to be measured. The reference voltage is the threshold at which the output voltage transitions from high to low, or from low to high. This circuit has only one threshold voltage and is called a single-threshold comparator.
 
 
In
  a hysteresis comparator, any tiny change in the input voltage near the threshold voltage will cause a jump in the output voltage, regardless of whether this tiny change originates from the input voltage or external interference. Therefore, although a single-threshold comparator is very sensitive, its noise immunity is poor. Adding positive feedback to a single-threshold comparator and connecting the inverting input to the input voltage creates a hysteresis comparator. It has inertia, appears to react relatively "slowly," is insensitive to tiny changes, and has some noise immunity; hence the name hysteresis comparator.
  When an operational amplifier (op-amp) is used as a hysteresis comparator, it can be seen that without negative feedback, the op-amp does not operate in the linear region. When the output voltage jumps, it passes through the linear region; the positive feedback speeds up the process. A comparator circuit containing positive feedback is also called a Schmitt trigger.
 
 
When analyzing the working principle of a hysteresis comparator, we can discuss different cases based on the magnitude of the input voltage:
1. When the input voltage u_I is very small, the output voltage u_O = Vcc. At this time, the voltage u_N at the non-inverting input terminal can be calculated using the resistor voltage divider formula.
 
 
  For ease of description, we let vh equal this formula.
2. As the input voltage u_I gradually increases, but is still less than v_h, since the non-inverting input terminal of the op-amp is always greater than the inverting input terminal, the output voltage u_O remains equal to Vcc.
3. When the input voltage u_I continues to increase and momentarily exceeds v_h, since the non-inverting input terminal of the op-amp is less than the inverting input terminal, the output voltage u_O becomes its minimum value -Vcc. After this, even if u_I continues to increase, the output voltage remains unchanged.
  At this point, the voltage at the non-inverting input terminal can be calculated:
 
 
  For ease of description, we let vl equal this formula.
4. The input voltage u_I begins to decrease.
  When u_I > v_h, u_O jumps; however
, if the input voltage u_I continues to decrease, at the instant it is slightly less than v_l, the voltage at the inverting input terminal is less than that at the non-inverting input terminal, so u_O becomes its maximum value. If we want u_O to return to its minimum value, u_I > v_h. That is, u_I fluctuates slightly around v_l without affecting the output.
  At the instant the output voltage is about to jump, the voltages at the non-inverting and inverting input terminals are exactly equal, so we can let u_P = u_N. The u_I calculated at this time is the threshold voltage. The v_h and v_l mentioned above are these two threshold voltages. Adjusting the values ​​of resistors R1 and R2 can change the threshold voltage.
  As can be seen from the voltage transfer characteristic curve, when the voltage
 
at the non-inverting input of the hysteresis comparator
  with reference voltage v_l is changed from ground to a certain reference voltage U_REF, the two threshold voltages can be shifted to the left or right.
 
  Let u_P = u_N, the threshold voltages can be calculated:
 
  The above is a general formula for analyzing the threshold voltage of a hysteresis comparator. In practical applications, it may be simpler. R1, R2, and U_REF together determine the horizontal shift of the voltage transfer characteristic curve. If a negative power supply is not used, the "-R1/(R1+R2) Vcc" in v_l can be omitted.
 
 
A hysteresis comparator, also called a threshold comparator, is triggered
when the input exceeds a certain value, and is used in waveform detection
 
 
 
 
 
hardware circuit experiments.






 
 
 
 



 
WeChat_20240817032339.mp4
PDF_#Training Camp#LCSC Oscilloscope.zip
Altium_#Training Camp#LCSC Oscilloscope.zip
PADS_#Training Camp#LCSC Oscilloscope.zip
BOM_#Training Camp#LCSC Oscilloscope.xlsx
92928
The discontinued OpenMV4 H7 R1 from StarEye Technology
This project involves the PCB board of the discontinued OpenMV4 H7 R1 from StarEye Technology, intended for repair and replication.
The BOM (Bill of Materials) is incorrect!!!
The BOM is incorrect!!!
The BOM is incorrect!!! (
Important: I'm saying it three times! )
This file contains the official open-source PCB for the OpenMV4 R1 board. It can be used for replacing damaged pins and for replicating designs. Please do not use it for commercial purposes.
OpenMV4 H7R1 schematic diagram.pdf
PDF_Discontinued XingTong Technology OpenMV4 H7 R1.zip
Altium (discontinued) OpenMV4 H7 R1.zip
PADS_Discontinued StarEye Technology OpenMV4 H7 R1.zip
BOM_Discontinued StarEye Technology OpenMV4 H7 R1.xlsx
92929
CC Table - CW32
CC meter, without deception, displays voltage, current and power.
This document describes
the use of an LDO to power a microcontroller
, an INA226 as the voltage and current acquisition chip,
and an OLED screen for display.
Issues and subsequent optimizations
: 1. Using an LDO for power supply can easily cause system restarts when the USB-B voltage changes; a DC-DC converter is planned for the next version.
2. There was a bug in the OLED screen circuitry (now fixed).
3. A resistor divider network using the CW32's built-in ADC has been added for functional verification.
4. The overall current flowing through the board is relatively low; the power supply issue for the Type-C port still needs to be addressed.
5. Reserved buttons have been removed.
PDF_CC Table-CW32.zip
Altium_CC table-CW32.zip
PADS_CC table-CW32.zip
BOM_CC table - CW32.xlsx
92930
Voltage and current meter – based on CW32F030C8T6
LCSC GeoStar CW32 Digital Voltage and Current Meter Expansion Board
I. 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 achieve a wider voltage measurement range, one can choose to replace the voltage divider resistor or modify the reference voltage. The following example illustrates this:

Assuming the measured voltage is 160V, the solution is 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 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 for 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 earlier to measure voltages below 30V... If the measured voltage is within 0~3V, use the ADC_IN9 channel for measurement. In this case, the measurement accuracy is greatly improved due to the reduced voltage division ratio. There are many ways to implement gear shifting, and the development board design provides more design possibilities.
Physical diagram:
PDF_Voltmeter & Ammeter - Based on CW32F030C8T6.zip
Altium voltage and current meter - based on CW32F030C8T6.zip
PADS Voltage and Current Meter - Based on CW32F030C8T6.zip
BOM_Voltage and Current Meter - Based on CW32F030C8T6.xlsx
92931
electronic
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-26 17:00:10

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号