Design of single-phase multi-rate electric energy meter with software calibration function

Publisher:心若清泉Latest update time:2015-03-16 Source: eechina Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Traditional mechanical energy meters measure electricity with a meter driven by an aluminum disk driven by magnetic torque. This metering method has many defects such as short life, large error, regular debugging, easy electricity theft, on-site meter reading, etc. The reliability of operation is not guaranteed, and it brings great difficulties to the construction, planning and analysis of urban power grids. In order to solve the above problems, electronic energy meters with anti-electricity theft function, LCD display, infrared communication and 485 communication are gradually being used and will gradually become the mainstream of the market.  

System composition  

The system structure of the one-way payment rate meter with software calibration function is shown in Figure 1. The implementation principle is: the current and voltage signals of the power grid are sampled by the sampling chip through the shunt, and output to the single-chip microcomputer in the form of pulses (CF). The single-chip microcomputer collects and analyzes the high-frequency pulse CF of electric energy, outputs the electric energy indication pulse signal for the pulse lamp and the meter calibration, and uses the CF signal to calculate the collected electric quantity, send it to the LCD driver, display it on the LCD, and write it to the EEPROM at the same time; in addition to storing the electric quantity information, the EEPROM also has information such as the meter number, which can be read and set through infrared and 485 communication, and can also be displayed on the LCD.  


  
Hardware Design  

The hardware design is shown in Figure 1, which is divided into clock supply module, data storage module, pulse acquisition module, software meter calibration module, power-off detection module, infrared output module, 485 communication module, battery voltage detection module, and switch control module. The main control chip uses NEC single-chip microcomputer UPD78F0485, and its basic characteristics are as follows: 1.8" 5.5V wide voltage power supply; internal integrated PLL phase-locked loop crystal oscillator circuit, temperature drift is very small; low power consumption, when the sub-clock is working, the power consumption is as low as 1uA; internal integrated power-on reset circuit and low voltage detection circuit, convenient for power-off data storage; internal integrated A/D, can be used for battery voltage detection; edge-triggered external interrupt, can collect power pulses; internal integrated IIC circuit and two UART circuits, convenient for 2-way communication; and integrated 2 16-bit timers, 2 8-bit timers, and many general I/O ports. These resources are the important reasons why UPD78F0485 is used to design electric energy meters.  


  
The following is a brief analysis of the design of some major hardware circuits in the electric energy meter.  

1) 485 communication circuit design:  

In the electric energy meter system, the meter reading system has only fixed centralized methods when reading the meter: 485, carrier, infrared. 485 is the most widely used method for meter reading due to its low cost, reliable operation, and fast meter reading speed. Figure 2 shows the basic structure of the 485 circuit. This circuit uses an optical coupler to isolate the signal output by the microcontroller and output it to the 3085 chip, which then converts the signal into a differential signal and sends it to the bus. The received signal must also be sent back to the microcontroller through optical coupler isolation. The characteristic of this circuit is that the RE and DE pins of the 3085 are controlled by one lead, saving an I/O port of the microcontroller. This connection method is conditional, that is, the communication on the electric energy meter is not absolutely full-duplex. Since the differential signal transmission distance of the 485 circuit is relatively long and the general wiring environment is relatively harsh, the 485 line must have a varistor for high voltage protection, and a TVS tube to prevent transient high voltage interference and lightning strikes. [page]


  
2) Infrared communication circuit structure:  

Infrared communication circuits are widely used in electric meters because the infrared handheld meter reading method is still used in many areas. Driven by this market demand, it is necessary for the microcontroller to have two UART ports for communication. As shown in Figure 3, in the infrared transmission circuit, two transistors are superimposed, where the TXD network is used to send data signals and the 38K network is used to send carrier signals. In this way, due to the logic and function of the hardware circuit, LED3 sends out the expected data. This circuit is just a connection method for the infrared transmission circuit. It is also possible to use a transistor to perform the AND operation of TXD and 38K in the program.  

3) Metering circuit:  


  
Figure 4: Structure of metering circuit  

The metering circuit has ADE7755 as a sampling chip. It collects voltage and current through the shunt, which is the manganese pain chip in the figure, calculates it internally into active power, and then outputs it in the form of pulses (CF). The microcontroller collects this pulse and calculates the power. The many resistors at the bottom of the figure constitute the precision adjustment circuit of the meter.  

Software design  

The meter operation state is divided into normal state and low power state. An idle flag is set in the program. When the power is off, the idle flag is set to 1. The main program continuously detects this flag. When this flag is set to 1, it enters the sleep state to reduce power consumption.  

The realization of software functions is completed by various subroutines, mainly composed of infrared communication subroutines, 485 communication subroutines, software calibration subroutines, power calculation subroutines, power-off processing subroutines, etc. The main program flow chart is shown in Figure 5.  


  
Figure 5: Main program software flow chart  

In this system, the main programs are concentrated in initialization, UART communication and software calibration, which are briefly introduced here. [page]

1) Initialization program:  

NEC single-chip microcomputer UPD78F0485 itself has rich internal resources, which can greatly reduce the number of peripheral devices, thus reducing the probability of failure. The places that need to be initialized are: internal RAM, option bytes, interrupt control register, serial port control register, timer control register, LVI circuit control register, watchdog control register, IIC circuit control register, LCD driver control register, etc.  

2) UART transceiver program:  

UART transceiver is completed by the serial port module built into the single-chip microcomputer. In the program, we only need to query the transceiver completion flag, continuous transceiver, error flag detection and error correction. It greatly simplifies the program running process and reduces the pressure of program timing.  

3) Software calibration program:  

The process of software calibration is as follows: We collect pulses, collect high-frequency pulses output by ADE7755, and the number of high-frequency pulses output for 1 kWh is an integer multiple of the low-frequency pulses. The process of software calibration is to adjust the number of high-frequency pulses corresponding to 1 kWh through serial communication, so as to achieve the purpose of accurate measurement.   Design specification format  

of communication protocol   : Figure 6: Byte format   Figure 7: Frame format   Byte transmission format: 0 (1 start bit) XXXXXXXX (8 data bits) 1 (1 end bit), the idle gap allowed for each byte during data transmission is Communication baud rate: 1200 baud.   3 to 5 FEH as synchronization header, a 16H end word.   For detailed command format and technical bureau return format, please refer to 645 specification (DL/T 645-1997).   Frame format, as shown in Figure 7.   During communication, if no response frame is received within the time limit, it is considered that the transmission is wrong and the previous command frame is resent. Resend up to 3 times. If the response frame is still not received after 3 resends, the corresponding fault prompt information is issued.   Conclusion   From the above, it can be seen that the paid rate meter designed based on NEC single-chip microcomputer UPD78F0485 fully complies with the national standard GN/T15284-2002 for multi-rate electricity meters and the communication protocol DL/T645-1997 for multi-function electricity meters, and has the characteristics of reasonable functions, low failure rate, few peripheral devices, high measurement accuracy, etc., and greatly saves hardware costs and enhances the feasibility of market promotion. In addition, the compilation environment that supports C language has shortened the development cycle for the actual development of this meter.




  



  














Reference address:Design of single-phase multi-rate electric energy meter with software calibration function

Previous article:Application of Linear Optocoupler HCNR201 in Analog Voltage Measurement
Next article:Design of AC Digital Voltmeter

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号