Implementation of Online Resistance and Capacitance Testing Based on a Microcontroller
2026-04-06 06:27:01··#1
[Abstract] Online resistance and capacitance testing automates resistance and capacitance measurements, expands the testing range, and improves measurement accuracy. This paper presents the hardware and software design for online resistance and capacitance testing. [Keywords] Microcontroller, Online resistance and capacitance testing. When debugging, testing, and repairing circuit boards, it is often necessary to measure the resistance or capacitance values on the printed circuit board. The traditional approach is to unsolder the component to be tested from the printed circuit board before measurement to avoid interference from other components on the board. This method is not only cumbersome but also slow and may even damage the printed circuit board and components. This paper introduces an online resistance and capacitance testing technology controlled by a microcontroller. This technology can directly measure the parameters of each component without unsoldering it from the circuit board, preserving the integrity of the printed circuit board and greatly improving the testing speed and accuracy. 1. Hardware Design of the Online Resistance and Capacitance Testing System The principle block diagram of the online resistance and capacitance testing system controlled by a microcontroller is shown in Figure 1. This system utilizes an 8051 microcontroller, a 2732 EPROM, a 74LS373 latch, and an 8155 expander to automate online resistance and capacitance testing. Automatic range switching expands the testing range, and software anti-interference measures further improve testing accuracy. The entire testing system consists of two parts: online resistance testing and online capacitance testing. Figure 1 shows the schematic diagram of online resistance and capacitance testing. 1.1 Online Resistance Testing The process of online resistance testing is as follows: The resistor Rx to be tested is converted into a DC output voltage Vo by an Rx/Vo conversion circuit. This Vo is then sent to an A/D converter via the range selection button K, converting the analog voltage into a digital value, which is then sent to the microcontroller system. The microcontroller selects the optimal range based on the input data and controls the range switching switch to select a suitable reference resistor, achieving automatic range switching. Under the control of the microcontroller, multiple sampling tests are performed, and the average value of each measured Vo is calculated. Then, the resistance Rx is calculated, and finally, the value of the measured resistance is displayed on the screen. The schematic diagram of online resistance testing is shown in Figure 2. In the figure, Rx is the resistor to be tested on the circuit board, R1 and R2 are the equivalent resistances on both sides, VREF is the reference voltage, and Rr is the reference resistance. It can be determined that Vo = -VREFRx/Rr (1). From the above formula, under the premise that the reference voltage VREF and the reference resistance Rr are constant, Vo depends only on Rx and is independent of R1 and R2, that is, Rx is electrically isolated. This realizes the direct conversion of the resistor Rx on the printed circuit board into the corresponding output voltage Vo. In order to expand the measurement range, the circuit in Figure 2 was improved by introducing reference resistors Rr1-Rr4 and corresponding switches K1-K4 to switch the range. The microcontroller selects the appropriate Rr according to Rx and automatically switches the range by controlling K1~K4. The circuit diagram is shown in Figure 3. Figure 2 Schematic diagram of online resistance test Figure 3 Schematic diagram of online resistance test with extended range 1.2 Online test of capacitor The schematic diagram of online capacitor test is shown in Figure 4. The diagram shows the capacitor under test, Cx, where Rx is the resistor connected in parallel with Cx on the circuit board, Z1 and Z2 are the equivalent impedances on both sides, VREF is the effective value of the reference sine wave signal source voltage, and Rr is the reference resistor. Let Zx be the equivalent impedance of Cx and Rx in parallel. The online capacitance test process is as follows: Through the Cx/Vo conversion circuit, under the action of the sine wave signal generator, the value of Cx is converted into an AC output voltage Vo. This is then sent to the A/D converter via the measurement selection button K to be converted into a digital quantity, which is then sent to the microcontroller. The microcontroller controls the range selector switch to select the optimal range and obtain the Vo value corresponding to Cx. The microcontroller controls the frequency of the sine wave signal generator via a frequency conversion switch, starting from the lowest setting and increasing the frequency in increments of 10 times. Simultaneously, it reads the corresponding Vo value for each setting and calculates the quotient of VOL and VOH for adjacent frequency settings. It checks if VOL/VOH is greater than 7.1. If not, it continues calculating the quotient until VOL/VOH exceeds 7.1. The microcontroller then calculates Cx based on this fH and VOH and displays the measured capacitance value on the screen. Figure 4 shows the schematic diagram of the online capacitance test. 2. Software Design for Online Resistor and Capacitor Testing The main program flowchart for online resistor and capacitor testing is shown in Figure 5: Figure 5 Main Program Flowchart for Online Resistor and Capacitor Testing 3. Conclusion Online resistor and capacitor testing utilizes the "electrical isolation" technology of online testing, enabling rapid measurement of arbitrary resistance and capacitance values on a circuit board with high accuracy. However, interference is often severe when measuring large resistances. In such cases, under the control of the microcontroller, the number of sampling tests can be appropriately increased to improve measurement accuracy. The online capacitance test method uses a high-frequency approximation method for measurement. Under the premise that VOL/VOH≥7.1, the error in calculating Cx is no greater than 0.5%. If the error caused by other factors in the measurement is taken into account, the total error is no greater than 3%, which meets the accuracy requirements of general applications.