Shenzhen ZTRON Microelectronics Co., Ltd
Telephone
0755-8299 4126

MCU

Design of Intelligent Meter Reading Chip Computer


Design and analysis of intelligent meter reading system based on single chip computer


With the continuous development of science and technology, people's life is increasingly inseparable from the support of electricity. In the current information age, people's production, life, study and other aspects are closely related to electricity. Therefore, people's electricity consumption is gradually increasing, which puts forward higher requirements for meter reading work. Traditional meter reading work cannot meet the current needs, so power companies must vigorously develop intelligent meter reading systems.


1.The hardware design of the meter reading system


1.1 Overall architecture design


In order to make the meter reading system more intelligent, it is necessary to add functions such as pulse counting, data storage and processing, display of power and status, and control of the communication center. First, the power collection technology module will calculate the data of the electric meter according to the pulse count, and store the data in the RAM inside the system. Secondly, the system kernel will send the data transmission order to the pulse technology module on time according to the set time, so that it can collect the data of the electric meter, and store the data in RAM according to the agreement set in advance, and then wait for the host computer Inquire, and record the number of the host computer that responds slowly and feed it back to the host computer. Finally, the upper computer has two operation modes, one is timing copying, and the other is copying at any time. Timing copying means that the host will query the data collected by each pulse technology module according to the time set by the system; while copying at any time means reviewing the data of a user separately under special circumstances. It is worth noting that in these two modes, it is necessary to back up the unresponsive computer data and give a warning.


1.2 Each module design


The design of each module of the system is the core point of the intelligent meter reading system, mainly including backup power supply, power collection module, communication module, clock module, display module, etc. The selection and design of each module is related to the operation of the entire meter reading system efficiency and quality.


First, the circuit design of electric energy data acquisition. There are two design schemes for the test module of the electric energy meter. One is to use discrete components PT, CT, S/H, FIR and multiplier to calculate voltage, current and power. The second is based on the principle of digital multiplier, according to its proprietary large-scale integrated electric energy metering chip to sample voltage and current, etc., and output active power through pulses, which is convenient for microprocessors to process, and it is more convenient to use , reliable performance and high calculation accuracy.


Second, the design of the decoding circuit. The decoding circuit can use the 74LS138 chip, and decode through the I/O line of P2.5-2.7, select a reasonable chip according to the time, and transmit its power signal to the single-chip microcomputer. In addition, when it is designed, many slices of parallel sampling circuit chips, memory chips and field bus chips are also used. These chips can be shared by the I/O port of the single-chip microcomputer, and they can be used as data or address lines, and the gate of these chips can be realized with the support of the decoder circuit, so as to avoid conflicts between the addresses of the data lines.


Third, the choice of CPU, as the core of the intelligent meter reading system, the CPU will directly affect the operation of the system. Therefore, for the CPU, it can be compatible with the instruction system, can be repeatedly erased and written more than 1000 times, has multiple bidirectional I/O ports, the clock frequency should be kept at 0-33MHZ, and there must be two 16-bit programmable The timer or counter also has a dual-duplex serial interrupt port line, a power-saving mode for interrupt wake-up, a watchdog circuit, and a software idle function.


Fourth, watchdog and peripheral storage design. Most single-chip microcomputers must have a reset circuit, which requires that the reset circuit can be reliably reset when the single-chip microcomputer is powered on, and can keep the program in order when the power is turned off, so as to ensure that the data stored inside will not be tampered with. In addition, the single-chip microcomputer will be disturbed by various factors during operation, and even crash. In order to solve this problem, a watchdog circuit can be added. When there is a problem with the operation of the single-chip microcomputer, it can provide a reset signal for the single-chip microcomputer in a short time to reset the system. In addition, in order to avoid the data loss of the single-chip microcomputer in the case of a sudden power failure, peripheral storage design should be carried out, and an unprocessed monitoring chip should be installed. When a power failure occurs, the single-chip microcomputer can be notified in advance to store data.


Fifth, the design of the clock module. Because the intelligent meter reading system is an automatic measurement and control system, it not only needs to record data, but also stores the time of recording data. When abnormal data occurs, the source of the problem can be found according to the data recording time. In order to realize automatic meter reading and record the meter reading time at the same time, a clock chip can be used for timing processing. After setting the meter reading time, the intelligent meter reading system will check the meter data according to the time set by the chip.


Sixth, the design of the display module and power circuit. Display module can use PS7219 static display chip. Because it has a function control register of 15*8RAM, it is convenient to select an address, and can control and refresh each digit individually without rewriting. And the numbers can also control the brightness of the displayed numbers, and each number can flash. For the circuit, it can be divided into two parts for power supply, one is to supply power to the digital chip of the circuit, and the other is to supply power to the bus circuit, and the power supply voltage of the two is controlled at +5V. In order to ensure that the collector can continue to work when the power grid is suddenly cut off, a backup power supply must be designed. 6V, 4A batteries can be selected, and the control circuit of the backup power supply is composed of two parts: backup power switching and power charging. When there is a sudden power failure, the power supply can be automatically switched to the backup power supply to ensure the normal operation of the microcontroller.


2.The design of the communication part of the meter reading system


2.1 The way of communication


The CPU of the computer has two ways to exchange information with the outside world, one is parallel communication, and the other is serial communication. Parallel communication means that data can be transmitted at the same time, which has the characteristics of fast transmission speed and high efficiency, but the number of transmission lines is controlled by the number of transmission data bits, so the design cost is relatively high. In addition, the parallel transmission distance generally does not exceed 30m. Serial communication refers to the transmission according to the order of data, which has the characteristics of fewer transmission lines, low cost, low efficiency and slow transmission speed, but its transmission distance ranges from a few meters to thousands of kilometers. For the intelligent meter reading system, because the distance between the measurement and control object and the measurement and control center is uncertain, the serial communication method will be used.


According to the boundary of the data stream, its timing is inconsistent with the synchronous mode, so the serial communication can be divided into two modes: synchronous serial and asynchronous serial. Among them, the synchronous serial communication method uses data blocks as information units for data transmission, and each frame of information contains a large number of characters, and the amount of information transmission is relatively large. The asynchronous serial communication method refers to the data transmission of characters as information units, and the amount of information transmitted each time is small, and each frame of information only contains one character. It can be seen that asynchronous serial communication will be used in occasions where the amount of data transmission is small and the transmission efficiency is low. For the intelligent meter reading system, asynchronous serial communication should be used. When designing its communication interface, it is necessary to choose the interface reasonably according to the actual situation, and at the same time, it must also consider multiple issues such as transmission media, communication control chips, and level conversion, so as to ensure that the communication has high reliability. The distance, speed and anti-interference ability can all be consistent with the standard.


2.2 Data upload


Data upload is to transmit the meter data collected by the collector to the network device in an asynchronous serial manner, which is mainly manifested as a level conversion function. First of all, for the RS-232 bus standard, it is the serial communication bus interface with the highest utilization rate at the present stage. When connecting RS-232 to the system, the communication methods are divided into short-range and long-range, and the short-range communication is divided into three methods. One is with the hardware handshake function, and the sending and receiving of data are interconnected. Two devices can be connected at the same time. Send and receive data. Data terminal readiness and device readiness are also interconnected, which can effectively detect whether the other party is ready. The second is the handshake function between CTS and RTS. After sending a request to the other party, the other party's response will be indicated by clearing the sender. And its sending line will be connected with the detection line of the other party. The third is to cross-connect the sending and receiving of data, use the docking function together, do not use other signals, and leave it in the air, and realize the handshake function through software. In the design of the intelligent meter reading system, the two ends of the system are the network access device and the single-chip microcomputer level conversion chip, and the three wires are connected between the two, and the computer data is transmitted to the network to realize remote transmission.


2.3 Data transmission


For the data transmission module, the most suitable bus design standard is RS485. Because RS485 is a dual half-duplex, it can send and receive data at the same time. It can be used in multi-occupancy interconnection, which can effectively reduce the waste of signal lines and facilitate long-distance data transmission. And it can use public telephone lines for network communication. From the perspective of its circuit structure, terminal resistors are installed at both ends of the balanced connection, and a data transmitter, receiver or transceiver is installed in the balanced cable. In addition, it does not have data sending and receiving rules. When the transmission distance is less than 1200m, its transmission speed can reach 10KB/s. Therefore, the RS485 serial standard can be used for data transmission in the intelligent meter reading system.


For the data transmission chip, the MA485 chip can be selected, because it is not only suitable for the RS485 standard, but also suitable for the RS422 standard. It has many advantages, with +5V power supply; low power consumption, the working current is 120 microamps, and the static current is 300 microamps; the driver has overload protection function; the communication transmission line can hang multiple transceivers; it is suitable for half-duplex communication.


3. Software design of meter reading system


3.1 Requirements for overall software design


In order to meet the requirements of the intelligent meter reading system and make it have higher quality and efficiency, the following requirements should be met when designing the software. First, it should be easy to understand and easy to maintain. Because with the improvement of production automation, the structure of the measurement and control system becomes more and more complex, the designer cannot fully understand the entire system in a short time, and the software can only have high performance after repeated design and debugging. For an intelligent meter reading system, if its module design has a clear goal and a clear idea, it will be convenient to check for errors and debug. Treat each subroutine as a building block, and arrange them in a reasonable order. Generally, there will be no errors. When a problem occurs, maintenance personnel can judge according to the phenomenon and type of the problem, so as to find the fault point and solve it. The use of modular design facilitates the expansion or modification of the system's functions. Second, it must be real-time. This feature is the basic requirement of an intelligent meter reading system. With the development of science and technology and the improvement of hardware integration, reasonable selection of software can meet this requirement. Third, it is testable. For the intelligent meter reading system, on the one hand, it is necessary to test the software according to the existing test results; It is used in real life. Fourth, accuracy and reliability. Only when the intelligent meter reading system has high accuracy and reliability can it be put into use, so as to strengthen the vital interests of users and promote the better development of my country's electric power industry.


3.2 Design of the main program


For the main program design of the system, it is mainly through calling the corresponding subroutine that the electric energy pulse is collected, displayed and communicated by time, which is the main line of the meter reading system design. When the power-on reset reaches the main program, except for the initialization program and power-on data data clearing, other parts are in an infinite loop state, and all functions of the meter must be performed in the loop. If there is no system power-off or program Paralyzed by interference, this execution loops forever.


3.3 Subroutine Design


In the meter reading system, in order to avoid loss of data stored in the meter due to misoperation, a reset program should be added after the baud rate is set in the system, that is, press and hold the reset key before power on, when the display screen is cleared and After flashing, release the reset key, and the system can operate normally. The reset keys should be sorted in the order of pulse counting unit clearing, pulse unit clearing, arithmetic unit clearing, and energy storage unit clearing. For the design of receiving data and communication program, first power on, initialize the program, and then make commands to the computer, and record the number of successful acquisitions at the same time. And the main program should be in the state of waiting to receive. At this time, it is in the communication state with the PC. When the PC sends commands, the main program will be interrupted and the data collected in the data acquisition module will be obtained. When the PC command is successful, it will The reception success mark appears. For the data acquisition program, it includes multiple modules such as parameter setting, meter reading number, data storage, account number design, and meter number reset. The use of the module should be executed according to the command. In addition, the subroutines also include pulse acquisition program, display subroutine, verification subroutine and data transmission subroutine. Only by designing these subroutines well can the intelligent meter reading system run stably.


4. Anti-interference design of meter reading system


4.1 MCU hardware anti-jamming design


For single-chip microcomputers, there are many interference factors, some of which come from inside and some from outside. Its internal interference is determined by many aspects such as the manufacturing process, while the external interference has nothing to do with the system mechanism and is determined by external factors. Interference problems on the power supply include undervoltage, overvoltage and power failure, which require a backup battery to be added to the system. For radio frequency interference, it is necessary to reduce the electrical width of the band. For surges, sags, and large peak pulses, two isolated power supplies can be used for power supply, or absorbing elements can be installed in the power supply circuit to improve the anti-interference ability of the system.


4.2 MCU software anti-jamming design


During the operation of the intelligent meter reading system, in order to avoid the infringement of other frequency bands, traditional hardware anti-jamming measures can only prevent part of the frequency band interference. Therefore, in order to ensure that the application programs can be executed in an orderly manner according to the established order, relevant measures must be taken during the system design process to improve the reliability of the system operation, reduce the incidence of software errors, or restore the normal state by itself when the software has errors. By designing instruction redundancy, the running programs in the program area can be restored to normal; by designing software traps, the running programs that are not in the program area can be restored to normal; through Watchdog technology, some programs in an endless loop can be restored to normal. The runaway program returned to normal. Therefore, when designing an intelligent meter reading system, the above design must be included so that the system can run stably.


Summarize


The design of the intelligent meter reading system of the single-chip microcomputer includes: the hardware design of the meter reading system, the design of the communication part, the software design of the meter reading system, and the anti-interference design of the meter reading system. Only when these designs are done well can the intelligent meter reading system be able to Stable and effective operation, so as to promote the sustainable development of my country's electric power industry.


The above are the design and analysis details of the intelligent meter reading system based on single-chip microcomputer introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. We have rich experience in customized development of smart electronic products, can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are the agent of Sonix MCU and Yingguang MCU agent, selling and developing MCU and voice IC solutions of Sonix and Yingguang. We act as an agent and develop ICs and solutions for Jieli, Ankai, Allwinner, Realtek, etc., and also develop BLE Bluetooth ICs, dual-mode Bluetooth modules, wifi modules, and IoT modules. We have hardware design and software development capabilities. Covering circuit design, PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development, voice recognition technology, Bluetooth development, wifi technology, etc. It can also undertake the research and development of smart electronic products, the design of household appliances, the development of beauty equipment, the development of Internet of Things applications, the design of smart home solutions, the development of TWS earphones, the development of Bluetooth earphone speakers, the development of children's toys, and the research and development of electronic education products.

  • TOP