Design of intelligent multi-rate single-phase electric energy meter based on MSP430 single chip microcomputer

Publisher:EnchantedHeartLatest update time:2012-02-02 Source: 微计算机信息 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0Introduction

The substantial increase in per capita electricity consumption has led to the widespread promotion of the "one household, one meter system", and the requirements and demand for electric energy meters have increased significantly. In order to encourage users to use electricity during off-peak hours and alleviate electricity shortages, the power sector has tried a billing method with different peak and valley electricity prices. At the same time, it has adopted intelligent remote meter reading, automatic metering and billing methods to solve many problems existing in manual meter reading, reduce labor intensity, and improve management level. The microcomputer centralized meter reading management system is a relatively ideal solution. The basis is to design an electronic multi-rate electric energy meter with communication interface and time-sharing billing function according to the technical conditions and communication protocols of the multi-rate electric energy meter of the power sector. The meter is a new type of intelligent metering instrument with high-performance microcontroller as the main control chip for time-sharing metering control. It has time-sharing billing and continuous metering functions, which can achieve the purpose of planned electricity consumption. Here is a hardware implementation scheme and software design idea of ​​a multi-rate electric energy meter based on an ultra-low power MSP430 single-chip microcomputer.

1 Hardware Circuit Design

1.1 Overall system structure

The hardware in this solution uses TI's high-performance 16-bit ultra-low power single-chip MSP430F413 as the main control MCU [1]. It has 8K flash and 16-bit RISC structure. The 16 registers and constant generator in the CPU enable the MSP430 microcontroller to achieve the highest code efficiency; flexible clock source; digitally controlled DCO can quickly wake up the device from low power consumption. At the same time, combined with the power metering dedicated chip AD7755, the hardware part of the meter can be greatly simplified, and it is very convenient to realize intelligent control. The overall structure of the system is shown in Figure 1.

1.2 Clock circuit design

Smart time-of-use electricity meters must have real-time clocks, which are divided into hard clocks and soft clocks. Among the many real-time clock chips, we chose PHILIPS's PCF8563. It is a multifunctional clock/calendar chip with extremely low power consumption, with multiple alarm functions, timer functions, clock output functions and interrupt output functions, and can complete various complex timing services. In particular, it uses the I2C bus communication method, which not only makes the peripheral circuit extremely simple, but also increases the reliability of the chip.

The interface between PCF8563 and MSP430 in this system adopts the interface scheme shown in Figure 2. The interface uses 3 port lines. The INT pin of PCF8563 generates a pulse interrupt signal with a period of 1s to the P1.4 pin of the MSP430 microcontroller as an interrupt trigger signal. After the interrupt is generated, the reference time of PCF8563 is read through the I2C bus. According to the I2C bus protocol, the slave address of PCF8563: the read address SLAR is A3H, the write address SLAW is A2H, and the PCF8563 I2C communication has two states of byte write/read. Since there is no I2C bus hardware in the MSP430 microcontroller, the method of software simulation of I2C reading and writing data is adopted.

1.3 Electric energy measurement circuit

The AD7755 produced by ADI Company of the United States is used as the measurement chip for power measurement. It is a high-accuracy energy measurement special integrated circuit with wide range, high accuracy, and internal power-off and power-on automatic reset circuits [2]. AD7755 is a low-power CMOS chip. In addition to the ADC, filtering and multiplication circuits, it also uses digital circuits to effectively remove interference signals such as sharp pulses, so that it can still maintain extremely high accuracy and long-term stability under harsh environmental conditions. Pin CF outputs the instantaneous value of active power in the form of a higher frequency, which is used to interface with the MCU. Its wiring diagram is shown in Figure 3.

The pulse frequency output from the CF output of the AD7755 is proportional to the average active power, through which the average power and the energy consumed within an integration period can be calculated:

Average power = Average frequency = Number of pulses/Integration time

Electric energy = average power Integration time = number of pulses

In normal operation, the integration time can be set to 1 to 2 seconds, depending on the need to update the display.

1.4 LCD display circuit

In the MSP430F413 microcontroller, the LCD driver is integrated into the chip as a peripheral module, which greatly simplifies the interface design of the LCD display part. As long as a suitable LCD display is selected and a suitable driving method is adopted, data display can be completed.

The common pole of the LCD panel is driven by the COMn signal, and the segment pole is driven by the SEGn signal. There are many ways to drive the LCD: static drive, 2MUX drive, 3MUX drive, 4MUX drive, etc. The number of microcontroller pins occupied by different drive schemes is the same. The number of pins required to drive an 8-bit LCD display using 2MUX is 2+8*8/2. The connection between the output pins and the LCD display device is as follows:

PIN number 1 2 3 4 5 6 ... 29 30 31 32

430 pins S0 S1 S2 S3 S4 S5 …… S28 S29 S30 S31 COM0 COM1

LCD COM0 1f 1h 1d 1e 2f 2h …… 8f 8h 8d 8e COM0

LCD COM1 1a 1b 1c 1g 2a 2b …… 8a 8b 8c 8g COM1

The display of data is controlled by setting the control bits in the LCD control register LCDCTL. Here it is set to 4MUX display mode. The data to be displayed is written to the LCD display cache LCMDX, and the on-chip drive control circuit will output the corresponding drive signal to complete the display.

1.5 Serial Interface

There are two main data communication methods: parallel data communication and serial data communication. Considering that serial data communication only needs a pair of data transmission lines to transmit information, the number of transmission lines required is very small, and the transmission cost is low. It is particularly suitable for hierarchical, layered and distributed control systems and long-distance communications. Therefore, this design chooses serial data communication. The RS-232C interface circuit is one of the most commonly used interfaces, but its disadvantage is that it can only be used for short-distance data communication. The RS-485 interface allows up to 128 transceivers to be connected on the bus, and has the advantages of good noise resistance, long transmission distance and multi-station capability. Here we choose the RS-485 interface. [page]

This design uses the MAX487 chip produced by Maxim as the RS485 communication transceiver [3]. The MAX487 chip has the RS-485 communication protocol, can support 128 slave computers, has a transmission distance greater than 1km, and a transmission rate of 250kb/s. The single-chip microcomputer can be connected to the main control computer through the RS485 bus. The main control computer can send remote control commands to the smart meter to collect current power data and historical data, forming a master-slave RS485 communication application system.

The interface circuit of MAX487 and MSP430 is shown in Figure 4. In the figure, DE is the transmitter enable terminal. When DE is 1, the transmitter can work. DI is the input terminal, and A and B are the output terminals. When DE is 0, the transmitter stops working and the output terminal is high impedance. It is the input enable terminal. When it is 0, the receiver is allowed to work. A and B are the input terminals, and RO is the output terminal; when it is 1, the receiver is disabled and RO is in high impedance state. MSP430 controls the working state of the transceiver through P2.1 and P2.2, so as to achieve the purpose of communicating with the host.

2 Software Programming

2.1 Software Design Concept

The software of the single-phase multi-rate watt-hour meter is mainly used to collect and process electricity data, and to exchange data with the meter reading system through the RS485 interface.

2.2 Software Block Diagram

The main program block diagram of the system is shown in Figure 5.

The function of the power processing module is to use the metering chip to provide metering pulses, and the CPU counts the metering pulses, combines the current time period and rate, and accumulates the actual power consumption of the user during peak, flat and valley periods.

The function of the communication module is to achieve reliable communication with the meter reader and the meter reading system according to the communication protocol. The meter reading system reads the user's electricity data and sets meter parameters such as time period, rate, address, etc.

The function of the display module is to display the user's peak, average, valley, total power consumption and time, power consumption of the previous month and other information.

3 System Anti-interference Design

The intelligent multi-rate electric energy meter is mainly based on the system of single-chip microcomputer. The single-chip microcomputer system is very susceptible to interference from strong electromagnetic fields, temperature, humidity, etc. Among the many interference sources, the fluctuation of grid voltage, sharp pulse interference, and instantaneous power failure are some very important interference sources for the work of the single-chip microcomputer, which makes the single-chip microcomputer unable to work normally and continuously. The instantaneous power failure of the grid or the sudden drop of voltage will cause the microcomputer system to fall into a chaotic state. After the grid voltage returns to normal, the microcomputer system is difficult to return to normal. The effective method is power-off protection. The power-off signal is detected by the hardware circuit and added to the external interrupt input of the single-chip microcomputer. The power-off interrupt is defined as a high-level interrupt in the software, so that the system can respond to the power failure in time. In the power-off interrupt subroutine, first of all, on-site protection is performed, and the important state parameters, intermediate results, and the contents of some on-chip special registers at that time are transferred from the off-chip RAM to the internal RAM of the single-chip microcomputer; secondly, the relevant peripherals are properly handled to put the peripherals in a non-working state, and finally, certain units of the on-chip RAM are marked with specific marks. The power-on automatic reset circuit is adopted to keep the microcontroller in two certain states after power-on, either reset or working. The sudden short pulse of power supply will not cause abnormal state, ensuring the normal operation of the system.

4 Conclusion

As an intelligent device, the intelligent multi-rate energy meter is very suitable for the centralized management of dense user areas such as high-rise buildings and dense residential areas. With appropriate communication protocols, it can be easily interfaced with the management computer or form a remote automatic meter reading network through the centralized controller. This design adopts low-power devices, which is low in cost and easy to integrate. After testing, the technical indicators of the multi-rate energy meter designed in this paper have reached the national technical standards for multi-rate energy meters, and have certain promotion value and good market prospects.

References

[1] Wei Xiaolong. MSP430 series microcontroller interface technology and system solution design examples. [M]. Beijing: Beijing University of Aeronautics and Astronautics Press. 2002.

[2] Chen Huiming, et al. Design of multi-rate electric energy meter. [J]. Electrical Technology and Automation. 2003. (5).

[3] Gou Dongqing et al. Automatic meter reading system based on RS485 serial port. [J]. Journal of Henan University of Science and Technology (Natural Science Edition). 2003. (1).

Reference address:Design of intelligent multi-rate single-phase electric energy meter based on MSP430 single chip microcomputer

Previous article:Design of anti-theft remote control using live fingerprint sensor MBF310
Next article:Using Flash to realize online maintenance of single chip microcomputer system

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号