Smart test
Design and production of a simple digital voltmeter
Abstract: This article introduces the design and manufacture of a simple digital voltmeter based on 51 single-chip microcomputer. The design is mainly composed of three modules: a/d conversion module, data processing module and display module. The a/d conversion is mainly completed by the chip adc0808, which is responsible for converting the collected analog quantity into the corresponding digital quantity and then transmitting it to the data processing module. The data processing is completed by the chip at89c51, which is responsible for processing the digital quantity sent by adc0808 through certain data processing, generating the corresponding display code and sending it to the display module for display. The measurement of the digital voltmeter is divided into four gears: ov-1.999v, 2.000v-19.99v, 20.00v-199.9v, and 200.0v-1999v, which are displayed by a four-in-one 7-segment digital tube.
1 Introduction
In the measurement of electricity, voltage, current, and frequency are the three basic measurements, and the measurement of voltage is common. Now the digital multimeter used by students can measure a variety of electricity, and it has a certain accuracy and is easy to use. In order to allow students to better understand the working principle of the digital voltmeter, so as to stimulate their interest in the learning of single-chip courses. This article starts from several aspects of software and hardware design, proteus simulation, production of objects, and error analysis, expounds the working principle of digital voltmeter, the method of data program processing, and the principle of digital signal software filtering.
2. Hardware design
The hardware circuit design consists of 4 parts: a/d conversion circuit, at89c51 single-chip microcomputer system, led display system, and measurement voltage input circuit. The hardware circuit design block diagram is shown as in Fig. 1. The overall design block diagram is as follows:
The working principle of this circuit is: the +5v analog voltage signal is divided by the varistor vr1 and then entered from the in0 channel of adc08008 (due to the in0 channel used, adda, addb, and addc are all connected to low level), after the analog/digital conversion , The corresponding digital quantity is transmitted to the p0 port of the at89c51 chip through its output channels d0-d7. At89c51 is responsible for processing the received digital quantity through data processing to generate the correct display segment code of the 7-segment digital tube and transmit it to the four-digit LED, At the same time, it also generates bit selection signals through its four-bit i/o ports p2.0, p2.1, p2.2, and p2.3 to control the brightness of the digital tube.
The hardware circuit of the simple digital DC voltmeter has been designed, you can select the corresponding chips and components, use the pROTEUS software to draw the hardware principle, and carefully check and modify until a perfect hardware schematic diagram is formed. But to truly realize the function of measuring and displaying the voltage of the circuit, the corresponding software is needed to meet the design requirements.
3. Software design
"According to the principle of module division, the program is divided into initialization modules, a/d conversion subroutines and display subroutines. These three program modules constitute the main program of the entire system software, as shown in Figure 2.
The whole program is designed to process the a/d converted data, including digital filtering, processing of data decimal places, etc. The a/d conversion subroutine is used to control the acquisition and measurement of the input module voltage signal, and store the corresponding value in the corresponding memory unit.
The display subroutine uses dynamic scanning to realize the numerical display of the four-digit digital tube. When the dynamic scanning display mode is adopted, to make the LED display more uniform and have sufficient brightness, it is necessary to set an appropriate scanning frequency, when the scanning frequency is around 70hz When, it can produce a better display effect. Generally, the LED can be dynamically scanned at an interval of 10MS, and the display time of each LED is 1MS.
4. Results and error analysis
Because the microcontroller at89c51 is an 8-bit processor, when the input voltage is 5.00v, the output data value of adc0808 is 255 (ffh), so the numerical resolution of the microcontroller is 0.0196v (5/255). This determines that the resolution of the voltmeter can only reach 0.0196v. As can be seen from Table 1, the test voltage generally varies by 0.01v.
When the input voltage value of the in0 port is 13.5v, the display result is shown in Figure 3. The measurement error is 0.1v.
It can be seen from Table 1 that the value measured by the simple digital voltmeter is basically 0-0.01v larger than the standard voltage value. This can be solved by correcting the reference voltage of adc0808 or by software calibration to reduce the error. Because the voltmeter is designed directly with a 5v power supply as the voltage, the voltage may be deviated. When you want to measure a voltage greater than 5v, you can use a voltage divider resistor at the input port, and you only need to adjust the divisor of the calculation program in the program.
From the test data, the error is controlled below 1v, and the relative error is below 1%, which can meet the needs of most occasions. For example, the method of summarizing experimental data is used to draw the obtained data into a curve, and then Using a more reasonable algorithm will result in more accurate results. (Author: Shuai Jianghua, Li Zhiyi)