1 Introduction
With the development of the national economy, the electricity consumption of enterprises and individuals has increased significantly. Now the electricity consumption time of users is relatively concentrated, so that the load curve of the power system varies greatly. In order to adjust the load curve and make full use of the capacity of power generation and supply equipment, it is necessary to realize time-sharing billing of electricity prices. The multi-rate energy meter records the electricity consumption according to the peak and valley time respectively, so as to charge electricity fees at different prices, and encourage users to take measures to avoid peak and fill valley, which is beneficial to both power supply and power consumption. At the same time, the multi-function meter with GPRS remote meter reading, microcomputer centralized meter reading, power failure meter reading, anti-theft electricity, metering active and reactive energy and demand measurement can replace the functions of several meters, which not only saves money and reduces the area occupied by equipment, but also reduces the cost of meter reading. This article provides a solution for a multi-function multi-rate three-phase energy meter based on TI's MSP430F449 high-performance single-chip microcomputer.
2 System overall structure and function description
The whole system is divided into two modules, the electric energy metering module, and the electric energy data processing and communication module. The electric energy metering module collects data such as active and reactive electric energy, three-phase voltage and current values, frequency and power factor through a dedicated electric energy metering chip. Then, the collected data is transmitted to the electric energy data processing module through a dedicated data bus. The electric energy data processing module stores the processed electric energy data in a flash chip, and can display the electric energy data in real time on the LCD. When meter reading is required, this system provides three communication methods: infrared, RS485 and GPRS; thus, three methods can be used for meter reading: handheld meter reading, microcomputer centralized meter reading and GPRS remote meter reading. The system structure diagram is shown in the figure below:
3 System Hardware Circuit Design
3.1 Introduction to the MSP430F449 microcontroller
This system uses TI's 16-bit ultra-low power high-performance microcontroller MSP430F449, which has 64K Flash, 2048Byte RAM, 8-channel 12-bit high-speed A/D, two UART communication ports, and an internal 160-segment LCD controller, which greatly simplifies the LCD hardware circuit. The MSP430F449 consumes only 0.8μA in standby mode, and as low as 0.1μA in RAM retention mode. The power consumption is 225μA/MIPS when running, and only 1μS clock is required to start. The supply voltage of the MSP430F449 is 1.8V ~ 3.6V, so it only needs one lithium battery for normal operation.
3.2 Electric energy metering circuit design
The core of the energy metering circuit uses the ATT7022 energy metering chip from Shenzhen Actions. It is a high-precision three-phase energy metering chip suitable for three-phase three-wire and three-phase four-wire applications. It can measure the active power, reactive power, apparent power, active energy and reactive energy of each phase and the combined phase, and can also measure the current, voltage RMS, power factor, frequency and other parameters of each phase, fully meeting the needs of three-phase multi-rate multi-function energy meter. ATT7022 provides an SPI interface to facilitate the transmission of energy data and calibration parameters with the external MCU. Moreover, as a domestically produced chip, it is also relatively cheap in price, which can greatly reduce the production cost of the product while meeting the design requirements.
The electric energy metering circuit is shown in the figure below:
The figure above introduces the connection circuit of phase A. The circuits of phases B and C are the same as that of phase A. In order to ensure that ATT7022 has a stable voltage reference source, TL431 is used as its external voltage reference. Since the power supply voltage of ATT7022 is 5V, and the power supply voltage of the microcontroller system is 3V, the communication between the two modules requires level conversion to exchange data normally. Therefore, a simple resistor divider circuit is used in the design to achieve the purpose of level conversion. After testing, it was found that the data transmission was very stable and no data loss occurred.
3.3 Clock Circuit Design
In order to meet the requirements of accurately calculating demand and rates at different time periods, a multi-rate meter needs to have an accurate and reliable real-time clock. However, the internal RTC clock of the MSP430F449 is not accurate enough, so we use the clock chip DS3231 from MAXIM in the system. The DS3231 is a low-cost, high-precision I2C real-time clock with a temperature-compensated crystal oscillator and crystal. The chip contains a battery input terminal, which can maintain accurate timing when the main power is disconnected. The integrated crystal oscillator improves the long-term accuracy of the chip and reduces the number of components on the production line. Its accuracy can reach ±3.5ppm within the industrial temperature range.
The INT port of DS3231 can provide an interrupt signal with a period of 1s to the microcontroller. The microcontroller system will read the specific time and date data through the I2C communication interface based on the signal, so as to calculate the demand and the rate of each period in real time. In addition, the 32KHZ port of DS3231 can provide an accurate 32KHZ pulse signal, which can be used to accept relevant experimental tests of the power department. When the power is off, the backup battery of the clock circuit will ensure that the clock chip can continue to accurately time until the power is restored.
3.4 Communication module design
This design mainly uses three communication methods to realize the meter reading function, namely: RS-485, infrared transmission and GPRS.
Considering that the energy meter will be installed outdoors, it is necessary to add lightning protection measures to the RS-485 bus interface. The RS-485 interface chip we use is TI's SN65LBC184 chip, which is isolated by the optocoupler NEC2501 and the single-chip microcomputer system to prevent damage to the entire system when struck by lightning.
The transmitted data is modulated onto a 30KHz to 40KHz carrier before being sent. The pin P1.5/ACLK of the MSP430F449 microcontroller can be used as the low-frequency auxiliary clock output port of the system, which can be directly driven by a universal 32.768KHz clock crystal oscillator without the need for additional external components. P1.5 is used to drive the transistor to generate a carrier with a frequency of 32.768KHz. The TXD pin of the UART port of the microcontroller drives another series-connected transistor to transmit binary data signals "0" and "1", thereby achieving the function of infrared data transmission. In the infrared receiving part, the infrared integrated receiving module TSOP1838 is used to demodulate the high-frequency infrared signal. When TSOP1838 receives a high-frequency infrared signal, the receiving tube outputs a low level; when TSOP1838 does not receive a high-frequency signal, the receiving tube will output a high level. The data after infrared demodulation by the receiving tube is input into the microcontroller through the RXD pin of the UART port for corresponding processing. [page]
Another way to read the meter is to read the meter remotely through the GPRS module. The GPRS module used in this design is the GR47 module of SonyEricsson. GR47 is an advanced wireless module with a full set of GSM/GPRS voice and data functions, which is small in size and comprehensive in function. It has an embedded TCP/IP protocol stack, which can shorten the development cycle of GPRS products to the greatest extent. GR47 provides 3 UART ports for communication with MCU, so the GR47 module can be controlled through another UART port of MSP430F449, and its control command is a standard AT command. Through GPRS meter reading, it is easy to obtain the data in each electric energy meter, and it can also broadcast the time calibration of the electric energy meter. It should be pointed out that the peak power consumption current of GR47 is 2A, so it is necessary to add an electrolytic capacitor of about 1000uF to the power supply end of GR47, and the power chip should also meet the corresponding requirements. In this design, the LM1084 voltage regulator chip is used, which can provide an output current of up to 5A.
3.5 Power outage meter reading circuit design
The power module in this system is a switching power supply, so when one or two phases of AC power are disconnected, the switching power supply can still supply power to the system. However, if all three phases of AC power are disconnected, the power supply of the system will be interrupted, so it is necessary to consider whether the meter can be read after the power outage, and at the same time, the time of the power outage must be recorded. In order to ensure that the core part of the system can still operate normally during a power outage, we use a 3.6V lithium battery with a low-power voltage regulator chip RH5RL30AA as the backup power supply of the system. In addition, when the power outage occurs, the microcontroller is in a dormant state, and the power of other chips is turned off by transistors to reduce power consumption. After testing, the entire system consumes less than 10uA in the dormant state. When a power outage is required to read the meter, the system can be awakened by a key interrupt, and the data will be displayed on the LCD for meter reading.
During a power outage, the battery is used as the power source, while during normal power supply, the switching power supply is used as the power source. How to switch between battery power supply and switching power supply is a problem that needs to be considered. Here is a simple method to solve this problem. The switching power supply circuit is stabilized to about 3.3V by a voltage regulator chip, and the battery power supply circuit is stabilized to about 3V by a voltage regulator chip. Schottky diode 5819 is added to the output of both circuits. In this way, during normal power supply, since the output of the switching power supply circuit is 0.3V higher than that of the battery power supply circuit, the battery power supply circuit will be cut off due to the reverse non-conduction of 5819; and during a power outage, the output of the switching power supply circuit is 0, and the battery power supply circuit will supply power to the system after 5819 is forward-conducted. The power switching circuit is shown in the figure below:
When the power supply is normal, the voltage of the lithium battery can be obtained by sampling the 12-bit A/D inside the MSP430F449. In this way, when the battery voltage is lower than 3.3V, it can be charged by the battery charging circuit until the battery voltage rises to the lithium battery charging limit voltage of 4.2V and then stops charging. The battery charging circuit can be realized by controlling the transistor to cut off the output of the voltage regulator chip through the IO port of the microcontroller.
4 System Software Design
The following introduces the software implementation of the system functions:
1) Initialization: Perform self-check on the LCD and memory, and initialize the data. If the system is powered on for the first time, all data will be initialized to 0, otherwise the corresponding value will be read from the memory to initialize the data.
2) Time module: It measures time according to the time pulse provided by DS3231, provides time measurement for the system data processing module and provides the current time display for the user.
3) Data processing module: This module is the core of the software design. Its main function is to process the data such as active and reactive energy, three-phase voltage and current values, frequency and power factor provided by the metering chip, and combine the current period and rate to obtain the actual power consumption and maximum demand of the user at each rate and period, and save the data to the memory at a specified time (settable). This meter can save data for multiple months and provide any current or saved data to the meter reading system through RS485, infrared interface and GPRS module. This module also has the function of recording phase failure time, current failure time, etc.
4) Calibration module: In order to match various peripherals, ATT7022 provides a calibration function. This module is used to set the calibration registers inside ATT7022 to match the peripherals to increase measurement accuracy.
5) Display module: LCD displays time, four-quadrant active and reactive energy, three-phase voltage and current values, frequency, power factor, power consumption at each time period and rate, and maximum demand, etc. The display interface can be operated by buttons.
6) Power outage processing module: When a power outage occurs, the system does not access the data processing module and the entire system enters a sleep state, thereby putting the system in an ultra-low power consumption mode. The system can be awakened by a key interrupt.
7) Communication module: The communication module is divided into infrared, RS485 and GPRS communication.
8) Interrupt processing module: The system mainly has three interrupt processing modules, namely timing, communication and power outage interruption.
5 Conclusion
The multifunctional multi-rate three-phase energy meter based on MSP430F449 microcontroller integrates multiple functions. With the cooperation of energy metering chip ATT7022 and clock chip DS3231, the energy metering can achieve high accuracy. Since the system power consumption is reduced by multiple means, after testing, the power consumption of the entire system is extremely low during power outages, thus ensuring the realization of the power outage meter reading function. The production cost of the entire system is low, and all technical indicators have reached the domestic technical standards for three-phase multi-rate energy meters, so it has good market prospects and application value.
The author's innovation points: ATT7022 metering chip and high-precision clock chip DS3231 are used to improve measurement accuracy and reduce costs, a power outage meter reading function is added to enable timely and reliable meter reading after a power outage, and two remote meter reading methods, GPRS and infrared, are added. The meter reading methods are flexible and diverse, and comprehensive considerations are made from hardware and software to minimize system power consumption.
Previous article:Research on GSM-based solar street light network monitoring system
Next article:Power Isolation and Signal Isolation Solutions for DC Turnout Indication Systems
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- USB Type-C® and USB Power Delivery: Designed for extended power range and battery-powered systems
- RAQ #223: How to measure and determine soft-start timing without a soft-start equation?
- RAQ #223: How to measure and determine soft-start timing without a soft-start equation?
- GigaDevice's full range of automotive-grade SPI NOR Flash GD25/55 wins ISO 26262 ASIL D functional safety certification
- GigaDevice's full range of automotive-grade SPI NOR Flash GD25/55 wins ISO 26262 ASIL D functional safety certification
- New IsoVu™ Isolated Current Probes: Bringing a New Dimension to Current Measurements
- New IsoVu™ Isolated Current Probes: Bringing a New Dimension to Current Measurements
- Infineon Technologies Launches ModusToolbox™ Motor Kit to Simplify Motor Control Development
- Infineon Technologies Launches ModusToolbox™ Motor Kit to Simplify Motor Control Development
- STMicroelectronics IO-Link Actuator Board Brings Turnkey Reference Design to Industrial Monitoring and Equipment Manufacturers
- Selection of 12-pulse rectifier transformer structure
- [LPC8N04 Evaluation] Scrolling display of strings on LPC8N04 without NFC
- Basic definitions of electronic components, electronic instruments, etc.
- Please help me analyze this circuit
- European semiconductor manufacturers recruit senior FAE-Shanghai.Shenzhen, please visit for details
- TJA1020 LIN Transceiver Application Guide
- [Repost] Discover Schottky diodes in life
- For a 4-layer board, is it possible to lay ground on all 4 layers?
- About the selection of pull-up and pull-down resistors at A and B ends of 485 bus
- 6. [Learning LPC1768 library functions] Watchdog experiment