fish001

STM32 Digital Multimeter

 
Overview

Design requirements
Design and make a practical digital display multimeter that can measure voltage, current, resistance, etc.
(1) Measurable voltage range: DC 0~30V, error ±1%;
(2) Measurable current range: DC 0~2A, error ±1%;
(3) Measurable resistance range: 0Ω~100KΩ, error ±1%;
(4) Use OLED display, and the main control uses STM32 series microcontroller;
(5) The power supply uses +12V power supply;
(6) Automatic range switching can be achieved;
(7) Other parts;
System block diagram
Hardware design
1. Power supply circuit
This circuit uses two stages of LM1117 LDO chips in series. The first stage converts the input voltage to 5V output; the second stage converts the 5V voltage to 3.3V, thereby meeting the power supply requirements of each module of the system.
2. The voltage detection circuit
uses an LM324 op amp, which takes 3 paths to form an amplifier, attenuator, and follower to adapt to different voltage level inputs. The op amp output is connected to the CD4052 analog switch for range switching.
3. The current detection circuit
uses max4080 as the current sensing amplifier chip, and its amplification factor is 20 times. The range switching function is realized by selecting different sampling resistors through relays.
4. The resistance detection circuit
realizes resistance measurement through the principle of resistance voltage division, and selects different range voltage division resistors through MOS tubes.
5. Other circuits
include OLED display interface (OLED uses Zhongjingyuan Electronics 1.91-inch display), matrix keyboard interface, etc.
The software design
initialization configuration is carried out using the STM32CubeMX tool. The main purpose of the logic code is to realize the control of the range switching circuit, read the button status, process the measurement results, and send them to the OLED screen for display.
Accuracy optimization and test
accuracy optimization plan:
1. Use high-precision voltage division resistors: All voltage division resistors use 0.1% precision sampling resistors.
2. Software enable self-calibration: Use HAL library function:
HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef* hadc)
3. Increase the number of ADC cycles: This design has low real-time requirements when measuring voltage, current, and resistance, so the number of ADC cycles can be increased as much as possible to improve measurement accuracy. It is currently set to the maximum value (239.5Cycles)
4. Software filtering: The design uses a sliding window filter to ensure filtering effect and real-time performance.
5. Linear fitting correction: By recording the device readings and the standard multimeter readings, linear fitting is achieved through the MatLab program. The fitting achieves a correction effect with a correlation coefficient of 0.9999981, and the accuracy is further improved.
Test results:
The test was compared with the UNI-T UT71C model multimeter, and the average

mode was measured 20 times to take the average value.


The average error


voltage was


0.74%


, current was


0.96% ,


and resistance


was 0.85% . For details on the

statistical function introduction and demonstration of the three modes of measuring the average error,
 
please see the video. Provide stm32 axf burning file.
 
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-19 11:03:36

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号