Resistance and capacitance measuring instrument based on single chip microcomputer

Publisher:xinyi9008Latest update time:2014-09-12 Source: ednchina Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction

When using electronic components, you must first understand its parameters. Resistors have resistance values ​​and capacitors have capacitance values. This requires the ability to accurately measure the parameters of components. The resistance value of a resistor is relatively easy to measure, and it can be accurately measured using the volt-ampere method. However, measuring capacitance is more troublesome. Initially, people used a multimeter to estimate the capacitance value. This method is not only troublesome but also has low measurement accuracy. With the rapid development of microelectronics technology, computer technology, and software technology and their application in electronic measurement technology and instruments, new test theories, new test methods, new test fields, and new instrument structures are constantly emerging. People's requirements for instruments are also gradually increasing. This article designs a more intelligent, smaller, and more powerful portable RC measuring instrument.

2. Hardware circuit design and implementation

The overall hardware circuit mainly includes four parts: sinusoidal signal circuit, front-end control circuit, single-chip microcomputer control circuit and LCD display circuit.

2.1 Main control chip

This system uses PIC16F877 microcontroller as the control core. PIC16F877 microcontroller is a mid-level product of PIC series microcontrollers. It uses RISC instruction system, with only 35 single-word instructions in total, which is simple and easy to use; it has a fast working speed, can receive DC-20MHz clock input, and the instruction cycle can reach 200ns; it has a large storage space, with up to 8K words of FLASH program memory and 368 bytes of data memory. In addition, it has 14 internal/external interrupt sources and 8-level hardware stacks for easy programming; it has a monitoring timer with an on-chip RC oscillator to ensure its reliable operation; different oscillator working modes can be selected according to different needs to reduce power consumption, and at the same time, many functions such as A/D, internal EEPROM memory, comparison output, capture input, PWM output, SP1 interface, asynchronous serial communication (USART) interface, analog voltage comparator , LCD driver, etc. are added under the premise of keeping the price low.

2.2 Sinusoidal signal circuit design

The measuring instrument uses sine wave as the measurement signal for orthogonal sampling by the single-chip microcomputer. The frequency of the sine wave directly affects the measurement accuracy. The sine wave frequency accuracy is required to be high, and the spectrum purity and stability must also be high. Therefore, this system uses the DDS synthesis chip AD9850 to generate sine waves. AD9850 is a highly integrated DDS synthesis chip produced by AD Company in the United States. It uses a 32-bit phase accumulator, truncated to 14 bits, input into the sine lookup table, and the lookup table output is truncated to 10 bits and input into the DAC. The DAC outputs two complementary analog currents and connects to the filter. However, the signal amplitude directly generated by AD9850 is only about 2V, and it is unipolar. What is needed during the test is a bipolar sine signal, so the signal output by DDS must be isolated and amplified. The signal output by AD9850 passes through an RC high-pass filter to filter out the DC component and output an AC signal, which is then amplified by an amplifier, and the voltage follows the output, and a signal source with appropriate amplitude and strong load capacity is output. The circuit is shown in Figure 1.

Figure 1 System circuit schematic diagram 1
Figure 1 System circuit schematic diagram 1

Figure 2 System circuit schematic diagram 2
Figure 2 System circuit schematic diagram 2

2.3 Front-end circuit module

The front-end circuit is mainly used to switch the range resistor and control the gain. This solution uses the resistor voltage division method. The range resistor and the element to be measured are divided, and then the single-chip microcomputer controls the analog switch to select the signal channels of the range resistor and the element to be measured respectively, and the signals obtained by their voltage division are sent to the differential amplifier circuit respectively. The sine wave from the differential amplifier circuit passes through the potential boost circuit and is then collected by the single-chip microcomputer. In this process, the automatic switching of the range resistor and the reduction of the error caused by the analog switch to the test process are the difficulties of the design. The front-end circuit is the key to affecting the measurement range and measurement accuracy of the system. [page]

Figure 3 Software Flowchart
Figure 3 Software Flowchart

2.3.1 Design of range resistance selection scheme

The switching of the range resistance R is achieved by controlling the analog switch CD4052 through a single-chip microcomputer. The analog switch has on-resistance and leakage current. If it is too large, it will have a great impact on the test accuracy. When RS+Zx is small, the on-resistance of the analog switch cannot be ignored. Therefore, it is very important to eliminate the influence of the on-resistance on the circuit. Through experiments, the principle circuit shown in Figure 2 is adopted. In Figure 2, a 4X2 analog switch is selected, Ron(1,2,3,4) and Ron(1,2,3,4) are the on-resistances of the analog switch; RS(1,2,3,4) is the standard resistance; and Z is the component under test. The use of this circuit reduces the influence of the on-resistance on the test accuracy.

2.3.2 Gain Control

During measurement, if the amplitude of the sinusoidal signal becomes smaller for some reason, it is possible that the signal obtained by a certain component during voltage division will be very small. Since the microcontroller can perform 8-bit A/D conversion on analog signals of 0-5V, the accuracy of A/D conversion can be calculated as 5/256=0.02V, which means that if the signal is too small and lower than 0.02V, the A/D conversion will produce conversion errors, so we need to control the gain so that the measuring instrument can still work normally when the amplitude of the sinusoidal signal changes.

The gain control circuit is shown in Figure 2. The signals after voltage division are sent to a differential amplifier circuit composed of an integrated operational amplifier. Because the differential amplifier circuit amplifies the difference between the two input terminals and has a strong inhibitory effect on the common-mode signal of the interference signal input, using it as an amplifier circuit can effectively improve the measurement accuracy and the anti-interference ability of the measuring instrument.

2.4 Potential boost circuit

This design uses the PIC's ADC module to realize data acquisition of analog signals, and selects the power supply voltage (5V) as the reference voltage, so the microcontroller can only correctly collect voltages between 0 and 5 volts, and the sine wave input is an AC signal, which has a negative potential in the negative half cycle, making it impossible for the microcontroller to sample correctly. Therefore, before sending the signal to the microcontroller, the AC signal needs to be boosted so that the potential of the entire sinusoidal signal at any time is greater than or equal to 0, and the potential boosting circuit.

The input signal passes through an integrated operational amplifier with an amplification factor of 1. R1 and R3 provide a DC potential at the signal input pin 3 of the operational amplifier. The DC potential is adjusted to 2.5V by changing the resistance value of R1. In this way, the sinusoidal signal can be adjusted to the shape shown in Figure 2 and then supplied to the microcontroller for sampling.

The values ​​obtained by the microcontroller sampling the signal after the potential is increased cannot be calculated directly, but it is necessary to subtract the DC potential of 2.5V from these values ​​before they can be calculated.

2.5 LCD Display Circuit

The display circuit uses the LCD module RC1602, which is mainly composed of three parts: dot matrix liquid crystal display (LCD), microcontroller, and drive circuit. The circuit is shown in Figure 1.

3. Software design and implementation

According to the functional requirements of each part, the software program of the whole system consists of subroutines such as initialization program, range resistance selection program, AD conversion program, gain control program, data processing program, ASII code conversion program and display program. Finally, each module is called and connected to form an organic whole, so as to realize the full management function of the instrument. Based on the ideas described above, the flow chart of the whole software program design is finally obtained through research, as shown in Figure 3.

4. Conclusion

This measuring instrument can automatically identify whether the component to be measured is a resistor or a capacitor. The single-chip microcomputer controls the automatic conversion to the appropriate reference resistance level according to the reactance value of the component to be measured, so as to realize the automatic conversion of the measuring range. This solves the problem that the old measuring instrument needs to manually judge the parameter range of the component to be measured before measurement, and then manually select the appropriate range level.

Reference address:Resistance and capacitance measuring instrument based on single chip microcomputer

Previous article:Design and simulation of digital thermometer based on PIC microcontroller
Next article:Design of automobile switch box based on CAN bus and PIC microcontroller

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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号