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).
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Data sharing: A brief review of the 2018 National Undergraduate Electronic Design Competition TI Cup and sharing of preparation experience
- STM32 assignment question
- LIS331DLH three-axis acceleration sensor package and code
- EEWORLD University - EOS and ESD on ADC
- NodeMcuEsp8266-L298N drives DC motor
- What is 5G IoT? Current applications of 5G IoT
- How to get started with developing a low-power Bluetooth using cc2650?
- [RVB2601 Creative Application Development] LVGL Horizontal Scrolling Display
- BQ4050 charging and discharging failure
- 12 details of PCB layout