Smart test
Design scheme of RC measurement system using 555 timer and single-chip microcomputer
This article introduces a digital display resistance and capacitance measurement system design scheme based on timers and sums. The system uses the resistance or capacitance to be measured to form a multivibrator. By measuring the period of the output signal, the resistance or capacitance value is calculated according to the mathematical relationship between the period and the resistance or capacitance to be measured, and then displayed on the LCD1602. The simulation results show that the measurement system has the advantages of simple structure, convenience and practicality, and can measure resistance and capacitance values within a certain range.
1 Introduction
In the manufacturing and use industries of electronic instruments and meters, there are a large number of printed circuit boards that need to be debugged, measured and repaired, and the values of resistance and capacitance need to be tested.
This article introduces a digital display resistance and capacitance measurement system design scheme based on AT89C51 and 555 timers, and then fabricates the actual circuit to realize the functions of the system. The system uses the 555 timer and the resistance (or capacitance) to be measured to form a multivibrator. The period of the 555 output signal is measured by the microcontroller timer, and the resistance (or capacitance) is calculated based on the mathematical relationship between the period and the resistance (or capacitance) to be measured. ) Value, and then display it through the 1602 liquid crystal display. The simulation results show that the measurement system has the advantages of simple structure, convenience and practicality.
2. Design plan and principle
2.1 General design plan
The whole measurement system is composed of several circuit modules such as a single-chip microcomputer system, buttons, multivibrators composed of resistors, capacitors and 555, and liquid crystal display. As shown in Figure 1.
2.2 Principle of Multivibrator
As shown in Figure 2, when measuring capacitance, use 555 and the capacitance to be measured CX and resistances R1 and R2 (R1 and R2 are known resistances) to form a multivibrator, so that the output terminal Q of the 555 will output periodicity Wave, connected to the oscilloscope, as shown in Figure 2(b). The signal is not a square wave with a 50% duty cycle. According to Reference 2, the duration of the high level time in a period T is:
When measuring resistance, another 555 is used to form a multivibrator circuit, and the resistance to be measured RX is connected to the position of R1 (or RX and a known resistance are connected in series), and CX is replaced with a known capacitance C. Such a The cycle time is:
2.3 Single-chip timing principle
The periodic square wave signal output by 555 is sent to the single-chip microcomputer for timing, a cycle time T of the signal is measured, and then the above mathematical relationship is used for calculation and processing to obtain the capacitance or resistance value to be measured. The principle of single-chip timing is: use the external interrupt 0 of the single-chip microcomputer and the output signal of the timer 0.555 to receive the external interrupt 0 pin P3.2 of the single-chip microcomputer, and set it as a falling edge trigger. When the output signal of 555 is a falling edge, an external interrupt is triggered, and the timer 0 of the microcontroller is turned on to start timing. When the falling edge arrives, that is, a cycle is reached, stop timing. At this time, what the timer records is a cycle. length of time.
3. Hardware module design
3.1 Single-chip microcomputer system
The controller of the system uses AT89C51 single-chip microcomputer. Figure 3 shows the single-chip microcomputer system, which includes the crystal oscillator circuit and reset circuit required for the normal operation of the single-chip microcomputer and the single-chip microcomputer. In Proteus, the power and ground of the single-chip microcomputer have been connected by default, so it is omitted in the figure.
3.2 Button circuit
The button circuit is used to determine whether to measure capacitance or resistance. As shown in Figure 4, a single-pole double-throw button is used. When the key is hit to the top to connect to the P3.6 pin of the microcontroller, it is used to measure capacitance; when it is hit to the bottom P3.7 pin, it is used to measure resistance.
3.3 555 multivibrator
As shown in Figure 5, the multivibrator is composed of 555 and the capacitor or resistance to be measured. The periodic square wave generated by 555 is output from the Q pin, and then connected to the external interrupt INT0 pin of the microcontroller, that is, the P3.2 pin. . When measuring, only one of the two circuits is connected to the single-chip microcomputer, which is used to measure capacitance and resistance respectively.
3.4 Liquid crystal display circuit
The measurement results should be displayed. This system uses LCD1602 as the display. Figure 6 shows the connection circuit between LCD1602 and the single-chip microcomputer. Port P0 is connected with a pull-up resistor as a data port; the first 3 bits of port P2 are used for read/write and enable control. Pin.
4. Software design
The system software flowchart is shown in 7. Turn on the power, the first is the initialization work, including the initialization of timer T0, external interrupt 0 and LCD1602. Then start the 555 chip, judge whether there is an interrupt request through the microcontroller, if not, continue to wait for the interrupt request; if so, start the timer to start timing until there is an interrupt request to stop timing. After getting the timing value, that is, one cycle of the 555 output signal, determine whether to measure resistance or capacitance. After the judgment, the resistance or capacitance value is displayed by LCD1602.
5. Simulation results
Integrate the above-mentioned circuit modules together to form a measurement system. After the program is written with Keil without error, the circuit simulation is carried out in Proteus. The simulation results of measuring a 50kΩ resistor and a 150μF capacitor are shown in Figure 8. It can be seen that there is a certain error in the measurement, which is mainly because the approximate value is taken when the previous formula is used. After the simulation is passed, according to the simulation circuit, purchase the required components and make the physical circuit.
6. Conclusion
This article introduces a design scheme of resistance and capacitance measurement system based on 555 timer and single-chip microcomputer. In the design and simulation of the system, two softwares, Keil and Proteus, are used as platforms. In Keil, the program was written in C language, and then the function of the system circuit was simulated by Proteus. The measurement circuit is simple, reliable, and easy to implement, and can measure the resistance and capacitance values within a certain range, thus confirming the practicability of the design scheme.