Delay-type leakage relay based on P87LPC764 microcontroller
2026-04-06 07:40:22··#1
Abstract: This paper introduces a design scheme for a time-delay type leakage current relay based on the P87LPC764 microcontroller. This scheme allows users to select different delay times for rated operating current and 5 times the rated operating current, and also includes a reclosing setting selection function. It solves the drawbacks of large delay time dispersion and lack of implementation caused by traditional discrete components. Keywords: Delay time, leakage current relay, microcontroller design 1 Introduction A leakage current relay is a protective device that cuts off the power supply to the protected circuit after the leakage current reaches a set value (rated operating current IΔ). The leakage signal detection is accomplished by a zero-sequence current transformer, which converts the detected leakage current of the protected circuit into a millivolt-level AC voltage signal. This signal is then rectified, amplified, and filtered to obtain a DC voltage, which, in conjunction with a corresponding control circuit, drives the execution circuit to achieve the control purpose of cutting off the power supply to the protected circuit. The simplified implementation process is: signal detection → filtering → two-stage amplification → control circuit → drive execution circuit → cut off the power supply to the protected circuit. The time-delayed leakage current relay solution presented in this paper uses a P87LPC764 microcontroller to form a control circuit to replace the traditional circuit. This circuit can achieve different delay action times and other related functions under different IΔ conditions. 2. Functions of the relay According to the leakage current protection standard and the driving requirements of the time-delayed leakage current relay, this protection device can achieve the following functions: (1) The user can select 3 rated operating currents (denoted as IΔ1, IΔ2, and IΔ3 respectively), which are determined by the user according to the actual condition of the protected circuit. Generally, IΔ1 can be set. 3. Introduction to P87LPC764 The P87LPC764 is an improved version of the 51 core microcontroller from Philips. Its operating speed is twice that of the standard 80C51. Its rich and flexible port definitions and built-in two precise analog comparators are the reasons for its selection. The main functions of this microcontroller are as follows: · High operating speed; · 4KB OTP (programmable once) program memory, 32B user code area; · Two 16-bit timers/counters; · Two precise analog comparators; · Programmable I/O port output modes; · 20mA I/O line drive capability. 4. Hardware Circuit4.1 Signal Detection and Amplification Circuit Figure 1 shows a partial circuit of the signal detection and amplification section in the leakage current protection device. The device uses a zero-sequence current transformer to detect the leakage current, converting the detected leakage current of the protected line into a millivolt-level AC voltage signal. The linear circuit, composed of operational amplifiers, then rectifies and amplifies the voltage, and through a second-stage amplification, a DC voltage U20 is obtained. Clearly, by setting the zero-sequence current transformer and corresponding circuit parameters, U20 can be made proportional to the leakage current within a certain range. Thus, processing the leakage current signal in the circuit is transformed into processing U20. As mentioned earlier, the user can select three rated operating currents. In practice, this is achieved by adjusting R28, R29, and R30 to set U20 to three different voltages, using a three-way selector switch S2A (provided to the user), with only one option available at a time (one option must be selected). The settings for the times T1a, T1b, and T1c under the rated operating current, and the settings for the times T2a, T2b, and T2c under five times the rated operating current, are both determined by the three-way selector switch S3A, again with only one option available at a time (one option must be selected). Reclosing is set using a single-selector switch S1. The specific circuit is shown in Figure 2. The reference potential VREF can be set by connecting an external resistor divider to pin 16 of the P87LPC764. It can be understood that the U20 corresponding to the three different rated operating currents selected by the user is different, while the reference potential VREF has only one standard, which cannot be changed once set. Therefore, the function of S2A is to adjust the U20 signal to an appropriate value through the guidance of the switch and the voltage division of the potentiometer, and then compare it with the set reference potential VREF. 4.2 Peripheral Circuit of P87LPC764 Figure 2 shows the peripheral circuit of the P87LPC764, where pin 16 is the VREF voltage setting terminal. According to the reference in the figure, VREF = 2V. Pin 12, P1.0, is used for reclosing judgment. The user can select whether the device performs reclosing. When P1.0 is 0, the device has the reclosing function. P1.1, P1.2, and P1.3 are used for judging and selecting the time T1a, T1b, and T1c under the rated operating current and T2a, T2b, and T2c under 5 times the rated operating current. The U20 after two-stage amplification is sent directly to the input terminal (pin 17) of comparator CIN1A, and another one is sent to the input terminal (pin 19) of comparator CIN2A through a resistor divider, so as to input U20 under the rated operating current and U20 under 5 times the rated operating current respectively. P0.0 drives the relay in the execution circuit. The initial state is set to 0 (low level, relay is energized). Connecting it to the subsequent execution circuit will keep the relay in the energized state, and work with the AC contactor to maintain the power supply to the protected line. 5. Software Design The software design mainly revolves around setting the delay time under different states. First, the outputs of comparator 1 and comparator 2 are judged to determine the current leakage current magnitude. Specifically, there are three cases: 1) less than the currently set rated operating current; 2) greater than the currently set rated operating current but less than 5 times the rated operating current; 3) greater than 5 times the rated operating current. These can be controlled in the software by judging the outputs of comparator 1 and comparator 2. Furthermore, the actual reclosing and different operating times can be determined based on the states of P1.0, P1.1, P1.2, and P1.3. The program flow is shown in Figure 3. 6. Conclusion To distinguish between various delay times, a microcontroller implementation scheme is adopted, overcoming the drawbacks of large dispersion and difficulty in control brought by traditional discrete components. The P87LPC764 contains a voltage comparator, which can easily control the operating time under rated operating current and 5 times the rated operating current. In software development, delay time is mainly implemented through "software delay and timer timing". By passing different variables, various delay times can be controlled. In fact, this has proven to be a good software implementation solution.