Design of diode characteristic tester based on 89C52

Publisher:eta17Latest update time:2011-08-25 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: Taking advantage of the intelligent program control characteristics of the single-chip microcomputer, a "diode characteristic tester" based on the STC89C52 single-chip microcomputer is designed, which can quickly test the general characteristics of the diode. A constant current is loaded on the diode through a stable linear current source, and then the voltage drop is tested by a high-precision analog-to-digital converter. Based on this, the quality of the diode can be judged, the polarity of the diode can be detected, and the volt-ampere characteristics of the diode can be tested, etc., avoiding the disadvantage that the multimeter test can only measure the polarity but not its characteristics. It can be used to quickly test the diode during the electronic design and production process to determine whether the tested diode meets the design requirements of the circuit.
Keywords: diode; characteristics; tester; single-chip microcomputer; current source

The diode is one of the most commonly used components in modern electronic design and manufacturing industries. Before use, it is necessary to determine whether its quality and volt-ampere characteristics meet the design requirements, so as to avoid connecting a damaged diode to the circuit or affecting the system due to improper selection of the diode. This device uses MCU (Micro Controller Unit) as the core unit to test the characteristics of the diode, which can quickly determine whether the relevant parameters of the diode meet the design requirements and reduce the workload of troubleshooting in the later stage of the design. This tester can judge the quality of diodes, identify the polarity of diodes and test the volt-ampere characteristics of diodes. In the characteristic test, the working current of the diode can be set, the voltage drop of the diode can be measured and displayed, and the forward volt-ampere characteristic curve of the diode can be drawn according to the needs of the tester. The hardware reserved serial port can communicate with the PC via serial port to return the test data to the PC for debugging and data analysis.
The single-chip microcomputer is one of the most widely used programmable devices in modern instrumentation, household appliances, industrial instruments and other fields. It has the advantages of low price, flexible programming, small size and strong scalability. Due to the rapid development of the single-chip microcomputer function, its application range is expanding day by day, from toys to robots, from data acquisition, process control, fuzzy control and other intelligent systems to human daily life, all of which are inseparable from single-chip microcomputers.

1 Hardware design and implementation of the system
1.1 Basic components of the system hardware
The system can be mainly divided into four parts: program control module, current control module, characteristic test module and display module. The basic block diagram of the system is shown in Figure 1.

a.JPG


Program control module: STC89C52 single-chip microcomputer is used as program control chip, which accepts user instructions and controls the coordinated work of various hardware parts. The program control module is the core control module.
Current control module: In order to obtain higher control accuracy, 12-bit precision DAC (Digital-to-AnedIogue Converters) TLV5613 is selected and the V/I conversion circuit is added to output a stable current value to load it into the measurement loop to control the working current of the diode.
Characteristic test module: In order to improve the measurement accuracy, 12-bit precision ADC (Analogue-to-Digital Converters) AD574A is used. AD574A is a single-chip high-speed parallel 12-bit successive comparison ADC with the characteristics of few external components, low power consumption, high accuracy, etc. It also has automatic zero calibration and automatic polarity conversion functions. Therefore, it is widely used in the interface design of microcomputers. In this device, it is used to measure the voltage of the diode under test in the loop, and provide data reference for the judgment of the quality, polarity discrimination and characteristic test of the diode. Human-computer interaction: It consists of buttons, which can manually set the diode current, choose whether to draw the volt-ampere characteristic curve, etc. Reserved serial port: RS232 serial port, which can return test data to the PC through the serial port for easy debugging. Display module: It uses MSG-G12232 LCD module, which has a resolution of 122x32, low power consumption, high display quality, small size, light weight, and an 8-bit data interface that can be easily connected to the microcontroller. It is very suitable for displaying system test results, volt-ampere characteristic curves and other information.
1.2 Design of main unit circuits
1.2.1 Current control circuit
The current control circuit uses the digital-to-analog converter chip TLV5613 plus the V/I conversion circuit to form a stable current source. The output of the required current can be controlled by the microcontroller program to power the measurement circuit to meet the current requirements of the system test. In the polarity test link, a suitable current value can be given, which is convenient for the system to measure the diode voltage value and judge the quality and polarity of the diode accordingly; in the characteristic test link, the loop current can be increased or decreased according to the set current value to make it consistent with the set value; in the volt-ampere characteristic curve drawing link, a current value that gradually increases from small to large can be given to facilitate system sampling and drawing.

c.JPG

Figure 2 is a V/I conversion circuit that converts the voltage output by TLV5613 into a stable current source. The circuit has a constant current function. The output voltage of TLV5613 is connected to the Vi terminal to obtain a stable current value Iout. When R1~R4 are accurately matched, the relationship between Iout and Vi is:
b.JPG
Where Vi=0~5 V, R6=20 Ω, so Iout=0~250 mA, which can be stepped by 1 mA. The actual measurement and analysis found that the VI linearity of this current source is very good. If a larger current is required, it can be achieved by modifying the hardware design, increasing the DAC output voltage or reducing the wind. Because the test current flows through R6 at the same time, when Iout=250 mA, the power of R6 is (0.25)2x20=1.25 W. At this time, R6 generates heat significantly, which affects the test accuracy. In the actual circuit, 5 100 Ω resistors are connected in parallel instead of R6 to disperse the power consumption and improve the test accuracy.
1.2.2 Characteristic test circuit
The voltage measurement uses the analog-to-digital conversion chip AD574A. In the circuit, the Iout pin of the current control circuit is connected to the analog voltage input pin 10VIN of AD574A.
The characteristic test circuit is shown in Figure 3. The left side of the figure is the relay control circuit. When the CTRL terminal is high, the transistor VT1 is turned on, and VCC is loaded to the relay 5 pin through VT1. The relay is activated, and the diode under test is connected to the polarity conversion. After the diode polarity matches, the characteristic test can be carried out.

d.JPG



2 System software design
The system software is developed based on Keil. The system mainly includes three modules: polarity detection, characteristic test and volt-ampere characteristic curve drawing.
The polarity detection module is mainly used to detect the quality and polarity of the diode, and provide a polarity reference for polarity matching before the characteristic test. During the test, the current control module first gives a suitable current value, and then the characteristic test module measures the diode voltage value, and then controls the relay to change the access polarity of the diode and test it again. When the polarity of the diode under test is consistent with the direction of the external current of the loop, the diode is turned on. At this time, the diode voltage value measured by the characteristic test module is between 0.6 and 3.6 V. When the polarity of the diode under test is opposite to the direction of the external current of the loop, the diode is cut off. The characteristic test module measures the voltage across its two ends to be about 10 V, and the ADC reading is full scale (0x0FFF). Based on this, the polarity of the diode can be judged. If the diode voltage values ​​measured in both cases are about 10 V or close to 0 V, it can be judged that the diode is damaged.
The characteristic test module is used to test the volt-ampere characteristics of the diode, that is, to set the working current of the diode and measure its voltage value. When entering the characteristic test link, first connect the diode to the measurement circuit with matching polarity and load the initial setting value (such as 50 mA). The setting value can be changed at any time during the measurement process. The current control module increases or decreases the loop current value to make it consistent with the setting value. Then the characteristic test module measures the forward voltage drop of the diode under test and displays the measurement results in real time on the LCD.
The volt-ampere characteristic drawing module is mainly used to draw the forward volt-ampere characteristic curve of the diode. After entering the program, the current control module loads an initial current of 1 mA to the diode and gradually increases it to the maximum, samples and records the voltage drop of the diode, and then displays the points corresponding to these values ​​on the display in turn, thus completing the drawing of the volt-ampere characteristic curve. During the drawing process or after the drawing is completed, you can choose to end the drawing or exit the volt-ampere characteristic curve display program at any time.

e.JPG


The main program flow chart is shown in Figure 4. During the test, the diode to be tested is first connected to the measurement circuit and the power is turned on. The program automatically starts to detect the quality and polarity of the diode. After the test is completed, the diode characteristic test phase is entered or an error is reported based on the test results. The characteristic test phase can measure and display the set working current value and forward voltage drop of the diode and other information. You can also choose to enter the diode volt-ampere characteristic curve drawing program according to the actual situation.

3 Problems and analysis encountered in the design
In the test phase after the hardware and software design was completed, it was found that the voltage value output by DA did not match the theoretical value at some points, with large differences and a certain periodicity (and the output value was smaller than the theoretical value). Through preliminary analysis, it was believed that the control word of DA was incorrectly written at some points, so the analog voltage input pin of AD on the hardware circuit was disconnected and directly connected to the voltage output pin of DA, and a small test program was written to write the control word corresponding to 0~5 V increasing by 0.02 V each time into DA, and use AD to measure its output voltage value and return the result to PC through the serial port, and then import all the differences between the theoretical value of voltage and the measured value into Excel, and then insert a scatter plot of these values ​​in Excel. The scatter plot is shown in Figure 5. The current value of 0~250 mA corresponds to the voltage value of 0~5 V (the 0~45 mA section is intercepted in the figure), and the vertical axis is the difference between the theoretical value of output voltage and the actual value.

f.JPG


By observing the scatter plot, it is found that these difference value points are indeed periodic, that is, the difference values ​​of each group of 8 points are larger or smaller at the same time. From the phenomenon, since the DA can output voltage normally at some points, it means that the control port is normal. Therefore, there should be a fault in a certain bit on the DA data port, causing the number written to the DA to always be 0 or 1. Because the output value is smaller than the theoretical value, it is judged that the bit is always zero. When the DA writes a number, if the bit is originally 0, the voltage is output normally; if the bit is originally 1, 0 is written to the DA incorrectly, resulting in the DA input voltage being smaller than the theoretical value. Further analysis shows that since there are 8 points in each group of large difference values, each step is 0.02V, 8 points are 0.16V, and the voltage value corresponding to the binary number 10000000B is 0.156V≈0.16V, so the fault should be D7. It is suspected that D7 is short-circuited to the ground. Through testing, it is found that the connection of this bit is completely correct, so it is suspected that there is a fault in the DA internal register or the microcontroller. The internal register fault of DA cannot be detected, so the microcontroller is tested to see if it is normal. A small program is written to set all data pins of the microcontroller to 1. Through the multimeter test, it is found that the P1.7 port of the microcontroller (ie, D7) is 0, and other pins are normal, so it is determined that the microcontroller is damaged. The microcontroller is replaced, the program is re-burned and tested again, and the fault is successfully eliminated.

4 System Test
The diode under test is 1N4118, and two Uni-T digital multimeters UT33D are used as measuring instruments to test the system. One is connected in series with the diode under test in milliampere range (range 200 mA), and the other is connected in parallel with the diode under test in DC voltage range (range 5V). The actual current and voltage of the diode are measured at different set current values. The test results are shown in Table 1.

g.JPG


Through the analysis of the test results, it can be seen that the measurement results of the tester are reliable, the error is small, and it can meet the general test requirements for diodes. The main sources of system errors are system errors, DA conversion errors, and AD conversion errors. In addition, when the current is large, although R6 is composed of 5 resistors in parallel, its heat generation also has a certain impact on the error.

5 Conclusion
This design uses the single-chip microcomputer STC89C52 chip as the hardware core component, and uses the corresponding characteristics of chips or devices such as TLV5613, AD574A, and 12864 LCDs. With certain software algorithms, a diode characteristic tester based on the STC89C52 single-chip microcomputer is produced, which realizes the rapid judgment and test of the polarity and characteristics of the diode. In the design process, we strive to make the hardware circuit simple, give full play to the convenient and flexible characteristics of software programming to meet the system design requirements, and reserve a serial port to return test data to the PC for easy analysis, which can be used in general diode characteristic test occasions.

Reference address:Design of diode characteristic tester based on 89C52

Previous article:Design of a new TPMS system based on SP37
Next article:Design of Intelligent Water Level Meter Based on MSP430 Single Chip Microcomputer

Latest Industrial Control Articles
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号