Design of Power Factor Measuring Instrument Based on P89V51RD2

Publisher:自由思想Latest update time:2010-08-11 Source: 盐城工学院Keywords:P89V51RD2 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

Power factor is one of the important parameters of the power supply system, which will directly affect the power supply quality of the power grid. With the development of power electronics technology, various power switching devices are widely used in industrial sites, making the high-order harmonic pollution of the power grid very serious, and even affecting the measurement of power factor.

Here we introduce a power factor meter with P89V51RD2 single-chip microcomputer as the control core, which uses the "zero-crossing detection" technology of the threshold voltage value of the current and voltage signals to achieve the measurement of the signal power factor. The meter has the characteristics of simple hardware circuit structure, practicality, high measurement accuracy, strong anti-interference ability, etc., and can be used for power factor measurement in various power applications.

2 System Design

2.1 System Design Technology

The power factor is the cosine of the phase difference φ between the voltage and current in an AC circuit. The power factor measurement includes two parts: AC voltage and current phase measurement and cosine value calculation. The former mainly includes direct phase-time conversion method and indirect sampling calculation method; while the latter uses table lookup method and decimal compensation algorithm.

For phase measurement, the indirect sampling calculation method is a software-based phase difference measurement method. The sampling and holding amplifier and A/D converter are used as analog front ends. Under the control of a microprocessor, the analog signal is quickly sampled and the phase relationship implicit in the discrete sampled data is calculated according to a certain data calculation method. However, this calculation method has high performance requirements for the microprocessor and A/D converter, and the software design is relatively complex. It is only applicable to applications with low precision requirements. The direct phase-time conversion method is a hardware-based phase difference measurement method. The positive (or negative) zero-crossing moments of two sinusoidal signals with a certain phase difference are compared, and the time interval (or pulse width) between the two represents the phase difference. The principle of the direct phase-time conversion method of phase is classic, the hardware is easy to implement, and the circuit has higher anti-interference ability and stability, so the direct phase-time conversion method is used to measure the phase.

2.2 Working Principle

FIG1 is a block diagram of the phase-time conversion method for power factor measurement.

Since the power frequency cycle in the power system is 20 ms, the measurement accuracy of the phase difference between voltage and current depends on the measurement of the high-level width of the phase difference signal. The voltage and current signals Ui and Ii with a phase difference of Φ are respectively passed through a voltage converter and a low-pass filter. Then they are converted into square waves by the corresponding zero-crossing comparator, and finally a high-level square wave proportional to the phase is obtained by the phase-time conversion circuit. Figure 2 shows the signal waveforms of each node in Figure 1.

The Φo obtained by the phase-time conversion method has a certain phase difference with the actual phase, which is caused by the low-pass filter and can be compensated by software. The Φo signal is measured by the microcontroller timer counting the high level, and its phase difference Φ is:

Where △t is the high level width.

Since the oscillation frequency of the P89V51RD2 microcontroller is 24 MHz, the measurement resolution of △t can reach 0.5μs, so the phase accuracy can reach 0.018°, which has a high phase measurement accuracy.

The calculation of the cosine value uses a table lookup and decimal compensation algorithm. First, the calculated phase integer degree is looked up in the table to obtain the cosine value of the current value and the next integer value; then, the incremental value of the decimal cosine value is calculated as the difference between the two integer cosine values ​​multiplied by the decimal part, and finally, the integer phase cosine value of the current value is added to the decimal value for correction and compensation. In this way, a power factor with higher accuracy can be obtained. [page]

3 System Hardware Structure and Working Principle

Figure 3 is a circuit diagram of a power factor meter based on the P89V51RD2 single-chip microcomputer. The meter consists of modules such as a signal preprocessing circuit, a phase detection circuit, a power supply, a display, and a single-chip microcomputer system. The nodes Ui, Ii, Uo, Io, and Φo in Figure 3 correspond to the points in Figure 1.

3.1 Signal preprocessing circuit

The voltage preprocessing circuit is composed of a voltage conversion circuit and a zero-crossing comparator. Experiments have found that the use of an isolation transformer for voltage signal conversion will cause phase shift, and the phase shift is not stable enough. Therefore, the voltage conversion circuit is composed of a photoelectric isolator. Since the light-emitting tube has a certain hysteresis characteristic, the voltage conversion circuit composed of a photoelectric isolator has the characteristics of no phase shift and also has high stability and reliability of zero-crossing point detection.

The current preprocessing circuit consists of a low-pass filter and a zero-crossing comparator. The power system is usually interfered by sudden pulses, high-order harmonics, and noise caused by the switching and control of power equipment. These interference frequencies are usually higher than the power frequency and are mainly reflected in the current. In order to filter out or reduce interference, a second-order Butterworth low-pass filter composed of U21 is set in the current preprocessing circuit. Its transfer function is:

Where ωo is the inherent angular frequency of the circuit, that is, the cut-off frequency of the low-pass filter; ζ is the damping coefficient of the circuit.

When R21=R22=R, C11=C21=C, ξ= /2 is the optimal damping coefficient of the circuit. At this time, the cutoff frequency of the low-pass filter is:

f0= (3)

The current threshold detection circuit is composed of a half-bridge filter composed of VD31 and C31 and a comparator U31. Only when the current reaches a certain value, the comparator output is high level. The microcontroller starts the power factor detection by detecting that the state of the P3.7 pin is 1. In Figure 3, U13 and U22 respectively constitute two zero-crossing comparators. Since the comparator uses a single 5 V power supply, it meets the TTL level requirements. The output of the zero-crossing comparator is a square wave with the same frequency as the input signal.

3.2 Phase Detection Circuit

Since the phase difference between voltage and current in the power system is greater than -90° and less than 90°, the square wave signal output by voltage signal preprocessing and the square wave signal output by current signal preprocessing can be directly XORed to obtain a series of pulse waves with a pulse width proportional to the phase.

3.3 Display and microcontroller small system circuit

In order to achieve high-precision phase detection and display, a highly integrated enhanced P89V51RD2 microcontroller with SoftICE and ISP functions is used. The circuit schematic is shown in Figure 4. The display circuit consists of a seven-segment code integrated circuit 74LS47, a 3-8 decoder 74LS138, and a 6-bit common anode seven-segment code. Among them: 1 bit (D31) displays ±, 1 bit (D32) displays 0 or 1 and a decimal point, and the remaining 4 bits (D33) display 4 valid bits after the decimal point.

In addition to the oscillation circuit and reset circuit, the microcontroller system also has an RS-232 communication interface, because the P89V51RD2 microcontroller has SoftICE function and ISP function.

The SoftICE function of P89V51RD2 can be activated through FlashMagic software, and the microcontroller has the self-debugging function of this system. Connect the system hardware to the PC through the serial communication cable, and perform online program debugging in the Vision microcontroller software integrated development environment. When the system program debugging is completed, the debugged program can be downloaded to the microcontroller through FlashMagic software, and then the system can work normally by pressing the reset button or re-powering on. Therefore, when using the P89V51RD2 microcontroller design, the entire system design can be completed without an emulator and a programmer. [page]

4 System Software Design

The hardware circuit provides a high-precision pulse signal for detecting the phase angle. Using the T1 timer/counter inside the P89V51RD2, the △t value can be accurately calculated. Set the timer T1 to the timer mode and work in the working mode 1 state (i.e. 16-bit counter).

A 24 MHz crystal oscillator is used, so the timer pulse period is 0.5 μs. Set TR1 and GATE1 = 1, then whether T1 counts depends on the signal: when it changes from 0 to 1, T1 starts counting; when it changes from 1 to 0, T1 stops counting.

Set IE=81H, IT0=1. When it changes from 1 to 0, an interrupt is triggered. In the interrupt program, first, turn off the general interrupt, set TR1=0 to stop counting, and read the 16-bit count value of timer 1, where the high 8 bits are in TH1 and the low 8 bits are in TL1; then, set the 16-bit count value of timer 1 to 0; finally, turn on the general interrupt, set TR1=1 and timer 1 is ready to count. Therefore, as long as the △t signal is applied to the sum, the value of △t in μs can be obtained, that is:

When this method is used to measure △t, the resolution and maximum absolute error are both 0.5μs. The system software program flow is shown in Figure 5. The current signal preprocessing circuit has a certain time delay. Although it causes an error in the measured phase, since the delay time is fixed, the microcontroller only needs to read the phase value into the memory and use software to correct the measurement result to eliminate the channel phase error caused by this and improve the measurement accuracy of the phase difference.

In order to avoid random interference and unstable measurement results and improve the phase measurement accuracy, the phase difference median filter measurement method is adopted: first, the N measurement values ​​are sorted by bubble sorting using sorting technology, and then the middle (N-2) measurement values ​​are taken and the average value is calculated as the phase difference value.

This method can greatly improve the anti-interference ability of the measuring instrument.

5 Test Results

The key technology of the power factor meter lies in the accurate measurement of the phase. After completing the hardware circuit design, a digital oscilloscope is used to test the voltage and current signals in the phase detection circuit. The test results are shown in Figure 6.

Through the analysis of the test voltage and current waveforms, it can be seen that when the current signal is severely distorted, the system hardware can perform filtering and shaping well, thereby ensuring the precision and accuracy of phase detection. Since the median filtering technology is used in the system software, the measurement results have high stability and measurement accuracy during actual testing in industrial sites.

6 Conclusion

The high-performance power factor meter based on P89V51RD2 single-chip microcomputer adopts the improved voltage conversion circuit design and the highly integrated enhanced P89V51RD2 single-chip microcomputer with SoftICE and ISP functions. It reduces the system development cost and accelerates the development process. In addition to the simple hardware structure, high measurement accuracy, stable and reliable measurement, the whole system also has the functions of system debugging and online software upgrade. This power factor meter can be widely used in departments that require real-time detection of power factor in power supply and distribution systems, and can also be used in production, scientific research and other occasions where power factor monitoring is required.

Keywords:P89V51RD2 Reference address:Design of Power Factor Measuring Instrument Based on P89V51RD2

Previous article:Application of PIC16LF874 single chip microcomputer in capacitance measurement module
Next article:Multifunctional electric energy meter circuit based on LPC916 and CS5463

Latest Test Measurement 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号