Design of Intelligent Leakage Relay Based on PIC Microcontroller

Publisher:Tiger8Latest update time:2009-10-22 Keywords:PIC18F6585 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A leakage relay is a protective device that can cut off the power supply of a protected line when the leakage current of the protected line reaches a set value. It plays a very important role in the power system and is the basis for ensuring power supply reliability. With the development of electronic technology and computer technology, the relay protection of power systems has broken through the traditional digital protection relays and has emerged as an intelligent protection relay with a microprocessor as the core [1-2]. This paper uses the PIC18F6585 microcontroller to design an intelligent leakage relay with multiple functions such as self-diagnosis, fault recording, and data communication, which facilitates fault analysis and has high reliability.

1 PIC series microcontroller features

PIC18F6585 is a PIC series microcontroller developed, manufactured and produced by Microchip. The technical performance of this series of microcontrollers has the following advantages [3]:

(1) Harvard bus structure. The PIC series of microcontrollers adopts a unique Harvard bus structure in terms of architecture. The data bus and instruction bus are separated inside the chip and different widths are used to facilitate instruction extraction, pipelining, and single-byte and single-cycle implementation of all instructions, thereby improving the speed at which the CPU executes instructions and ensuring data security.

(2) Reduced Instruction Set Computing (RISC) technology. The instruction set consists of only 35 instructions, which are easy to learn, remember, and understand. It also greatly facilitates program writing, reading, debugging, modifying, and communicating. It is easy to learn and use.

(3) The addressing mode is simple. There are only four addressing modes: register indirect addressing, immediate addressing, direct addressing, and bit addressing. These are relatively easy to understand and master.

(4) High operating speed. Due to the adoption of Harvard bus structure, the reading and execution of instructions adopt pipeline operation mode, which greatly improves the operating speed. The operating speed of PIC series microcontrollers is much higher than that of other microcontrollers of the same grade. Among all 8-bit microcontrollers, PIC series microcontrollers are one of the fastest in the world.

(5) Extremely low power consumption. Its I/O port has a strong load driving capability, and the maximum input and output current of each port can reach 25 mA, which can directly drive LEDs, optocouplers or micro relays.

(6) The PIC18F6585 chip has ADC, I2C and SPI serial bus ports, and has external circuits. It is simple, easy to develop, can be programmed in C language, and has strong program confidentiality.

2 Relay Hardware Structure and Working Principle

(1) Hardware structure

The CPU of the leakage relay uses the PIC18F6585 chip. The detection of the leakage signal is completed by the zero-sequence current transformer, which can convert the detected leakage current of the protected line into a millivolt-level AC voltage signal, and then obtain a DC voltage through signal rectification, amplification and filtering, and cooperate with the corresponding control circuit to drive the execution loop to achieve the control purpose of cutting off the power supply of the protection line. The implementation process is: signal detection → filtering → secondary amplification → control circuit → drive execution loop → cut off the power supply of the protected line. The hardware structure block diagram is shown in Figure 1.

Hardware Block Diagram

The functions of each part in Figure 1 are:

① Zero-sequence current transformer circuit. The current transformer of this device uses high-performance Permalloy as the magnetic material of the iron core to ensure that the current transformer output has good linearity within a certain range.

②Signal processing. The factors that affect system reliability are mainly the odd harmonic currents of the line power frequency, so this circuit uses a set of active low-pass filters, which mainly filter out the odd harmonic AC components, and then perform AC-DC conversion to ensure the correct operation of the leakage relay.

③CPU. This is the core component of the device. PIC18F6585 mainly includes FLASHROM, RAM, TM2RX, A/D conversion, serial communication, etc. It is the central processing unit of the entire system. The system's instruction fetching, judgment, and execution are all completed by it. Among them, the A/D converter is a 10-bit converter. When the main frequency is 20 MHz, its conversion time is 16μs; FlashROM and RAM are storage spaces for storing programs and data.

④Digital display and operation circuit. The digital display is used to display the line leakage current and the delay time of the system tripping. It is mainly composed of a digital drive circuit and an LED digital display. The execution circuit is mainly composed of a photoelectric isolation and a relay drive circuit.

⑤Serial communication interface circuit: MAX422 from MAXIM company is used to expand the serial communication port.

⑥ Human-machine interface circuit: The human-machine interface circuit is mainly used to set the protection setting value and the system delay tripping time.

⑦ Power supply circuit: Provides working power for the microcontroller system, one of which is an isolated power supply.

(2) Relay working principle

After the system is turned on, the system sets the TMR0 timer interrupt and generates a timer interrupt signal every 2 ms. The microcontroller responds to this interrupt signal and enters the interrupt processing subroutine. The interrupt processing subroutine determines whether it is an RB port interrupt or a TMR0 interrupt, and then calls the timer interrupt A/D processing subroutine or keyboard processing subroutine respectively. The system compares the A/D conversion result with the predetermined setting value. If it is greater than the setting value, it will perform tripping, accident alarm and other processing. All results are sent to the main program for display.

3 Software Design

3.1 Software Design Flowchart

This single-chip microcomputer system uses a 20 MHz main frequency, performs a timer interrupt processing every 1 ms, and has a simple software structure. The software design includes the main program, RB port interrupt service subroutine, timer service subroutine, A/D conversion subroutine, data processing subroutine, and display subroutine, and is designed in C language.

(1) System main program. It mainly completes the initialization of the system's ports, timers, A/D converters, constants, variables and other quantities, and also completes the leakage current cycle display. The main program flow chart is shown in Figure 2.

(2) Interrupt service subroutine. It mainly judges whether TMR0 overflows according to the data of T0IF bit of INTCON register. If overflow occurs, it will enter TMR0 interrupt entry subroutine. It also judges whether RB has input changes according to the data of RBIF bit of INTCON register. If changes occur, it will enter keyboard interrupt entry subroutine. The flow of interrupt service program is shown in Figure 3.

Program Flow

(3) Timing interrupt service subroutine and A/D conversion subroutine. It mainly completes the A/D conversion task, performs one processing every 1 ms, and samples 6 times in succession each time. The sampling results are stored in the specified memory unit. The flow of the timing interrupt service subroutine is shown in Figure 4, and the flow of the A/D conversion subroutine is shown in Figure 5.

Program Flow

(4) Data processing subroutine. It mainly completes digital filtering, improves the anti-interference performance of the system, calculates the average value of A/D conversion data, performs data comparison, determines whether to trip and alarm, etc. The data processing subroutine flow is shown in Figure 6.

Data processing subroutine flow

(5) Keyboard processing subroutine. It mainly provides a channel for human-computer dialogue and is used to set the protection setting value, delayed tripping time, etc.

3.2 Programming

The program is designed in C language. The core statements in the A/D conversion subroutine and data processing subroutine are given below [4].

(1) A/D conversion subroutine

program

The performance of the designed intelligent relay is far superior to that of traditional relay products. The designed system is based on the PIC18F6585 single-chip microcomputer to form a real-time data acquisition system, which can analyze, calculate and process the collected data in real time to obtain various protection characteristics. It is easy to modify and has good selectivity and coordination. It integrates measurement, monitoring and protection, and can be connected to the computer through the communication interface to form an intelligent monitoring protection and information management system, which has high industrial use value.

Keywords:PIC18F6585 Reference address:Design of Intelligent Leakage Relay Based on PIC Microcontroller

Previous article:Design and implementation of real-time wireless monitoring system for high-voltage switch contact temperature
Next article:Wireless sensor network construction and communication design based on CyFi

Latest Analog Electronics 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号