At present, most of the electricity meters, water meters and natural gas meters of urban residents in China are read manually. The meter reading staff checks various instruments one by one every month. In many areas, centralized meter reading has been realized through meter reading transformation projects.
For example, the initial cost is high. At the same time, the data transmitted on the bus are important data such as water, electricity and gas consumed by end users. The anti-interference requirements of the bus are very high. It is necessary to have the ability to resist capacitive and perceptual coupling interference. In order to save cost, Remote power supply shall be adopted to provide power to the slave equipment, so as to reduce the use of components as much as possible.
In order to solve the above problems, a concentrator of remote meter reading system based on CAN bus is designed in this paper. The intelligent electricity meter system based on CAN bus has the advantages of low cost, high reliability, simple networking, convenient management and simple operation, and can send the real-time data collected by the concentrator to the management system of the power selling company for unified management through the application of line loss analysis, remote power on and off Anti stealing analysis and other functions to achieve higher intelligence.
1 function and principle analysis of concentrator
The general smart meter system consists of four parts: meter, concentrator, communicator and host computer system. As shown in Figure 1, its working principle is that the integrated carrier meter or the power metering sensing system module installed at the end of the meter is networked through the CAN bus, and the concentrator receives the data according to the set time period and saves it in the internal flash. When the upper computer sends the signal to read the data, the upper computer reads through RS232 or RS485, and the read data is transmitted to the power consumption management center through the network.
Meter reading is an important part of remote meter reading system.
The concentrator controls and reads the data of the meter through the CAN bus, and the data is stored in the flash of the concentrator. The concentrator executes the control command sent from the upper computer:
Timing, reading flash, reading meter number, power limitation, adding header address, etc.
The concentrator sends the meter reading command signal to the bus through the CAN controller, and each meter header sends the collected signal to the concentrator through the CAN bus according to the meter reading command. The concentrator stores the collected signal in the flash chip. The upper computer sends the read data signal to the concentrator through the serial port, and the concentrator transmits the data stored in flash to the upper computer.
2 concentrator hardware design
The main control chip adopts stm32f103tx of STM32 series of ST company. This series of single chip microcomputer is the Cortex-M3 processor of arm. It is the latest generation of embedded ARM processor. It provides a low-cost platform, reduced pin number and reduced system power consumption for the needs of MCU. At the same time, it provides excellent computing performance and advanced interrupt system response. It has 26 multiplexed gpios with fast operation speed (system clock frequency up to 72mhz); 64KB on-chip RAM; 2 12 bit analog-to-digital converters, 1 μ S conversion time (up to 16 input channels); 3 SPIs, 5 USARTs and 2 IIC interfaces; 256Kb flash on chip; 2 watchdog, 11 timers; The chip has an independent real-time clock, which can enrich relevant data. It provides the library function for single chip microcomputer. It is very convenient to program in C language and easy to develop.
Because the intelligent meter controller needs very accurate real-time performance, it is convenient for the power selling company to collect the power consumption fee. Because the main control chip has its own real-time clock, it only needs an independent 32.768KHz crystal. The real-time clock can set the year, month, day and specific time through the register. At the same time, it also has the function of alarm clock and timing interrupt for specified operation.
The hardware structure of smart meter concentrator is shown in Figure 1, which is mainly composed of arm, flash, clock chip, interface circuit, RS232, RS485, power supply, etc. As a control chip, arm has standard design; The arm interface circuit is relatively simple. The following focuses on the design of CAN bus interface and flash interface.
Figure 1 structure block diagram of intelligent meter reading system
2.1 can bus interface circuit design
Because the system has high requirements for stability and anti-interference ability in the process of signal transmission, the can interface adopts high standard interface circuit. The circuit diagram is shown in Figure 2.
Figure 2Can interface hardware circuit diagram
The CAN bus interface circuit adopts + 3.3V power supply, and ctm8251a is selected to isolate the can transceiver. The chip is a 3.3V industrial isolated can transceiver. The ctd0 signal is connected to the transmitting pin of the CAN controller of the main control chip, and the crd0 signal is connected to the receiving pin of the CAN controller. CTM isolated can transceiver has a complete can bus isolated transceiver circuit, which can convert the logic level from can controller into can bus signal, and has dc2500v isolation function. In addition, CTM transceiver can select “t” series integrating ESD protection function, so as to omit expanded ESD protection devices. Common mode choke T1 plays the function of EMI enhancement and is used to improve the EMI capability of the equipment; The inductance parameters of common mode choke T1 are very important. Select can bus special devices, such as b82793 choke of EPCOS.
2.2 flash interface circuit design
The concentrator needs to collect data from each meter header connected to it, so the amount of data is large, which has high requirements for storage. Therefore, St m25p64-vmf6tp is selected. The chip is 64M serial interface flash memory, and the clock rate of enhanced data transmission is 50MHz; Read throughput is 50Mbps; The interface is a simple 4-wire SPI (serial peripheral interface); Deep power reduction mode, intermittent power consumption, current consumption is only 1uA.
M25p64flash chip is connected with arm through SPI bus. SPI bus system is a synchronous serial peripheral interface, which can make MCU communicate with various peripheral devices in serial mode to exchange information. Generally, four lines are used: serial clock line (SCL), host input / slave output data line miso (SDO), host output / slave input data line MoSi (SDI) and low-level effective slave selection line CS. SPI works in a master-slave mode, usually with one master and one or more slaves.
The circuit diagram of flash and arm is shown in Figure 3. The following points are explained: (1) SCL serial clock signal is generated by the main equipment（ 2) SDO master equipment data output and slave equipment data input（ 3) SDI master equipment data input and slave equipment data output（ 4) CS is chip selection, and the enabling signal of the slave device is controlled by the master device（ 5) External pull-up resistors are connected to corners 7, 15 and 16 to improve the noise tolerance of the chip input signal and enhance the anti-interference ability.
Fig. 3 hardware circuit diagram of flash interface
3 concentrator software design
The concentrator system adopts the number sequence program design, and the program is designed according to the functional module. The main program calls each functional module program to realize each corresponding function, and each functional module completes the corresponding operation by calling the underlying function. The specific process is shown in Figure 4. After startup, start initializing the system. The system enters the command waiting mode. If there is an upper computer operation command or a timing interrupt, it enters the timing program. If the timing is not successful after a certain time, it will alarm the upper computer.
After the timing is successful, the concentrator continues to wait for the reading command of the upper computer or interrupt the reading command. After receiving the reading command, the timing reading enables the concentrator to automatically read the data collected by the meter according to the set time; Reading enables the concentrator to read the data of the current header.
Fig. 4 system software flow chart
The concentrator can mount up to 100 headers through the CAN bus, and the concentrator sends the ID of the CAN bus device. After receiving the corresponding ID number, each subsystem table will feed back the data according to the read header command issued by the system. If the can communication fails, the CAN controller communication will report a failure. If the system circuit is normal, the concentrator sends command data packets. Each frame of can data contains 8 bytes. Because the data flow of each reading is not very large, only one frame of can data needs to be used for each communication. The header ID is identified by the frame ID, and each header corresponds to an independent frame ID.
The concentrator sends the can data command packet to the CAN bus, and the header selects to receive the meter reading command according to their respective ID and sends the response data to the CAN bus.
The concentrator extracts the received response data and stores the meter reading in flash. The work flow of can data transceiver is shown in Figure 5.
Figure 5 flow chart of data sending and receiving
As a part of the intelligent meter reading system, this design has been successfully applied to some remote meter reading systems. Due to the moderate cost and stable performance, it has achieved good economic benefits and has a good promotion prospect. At the same time, other remote meter reading systems, such as gas remote meter reading system, can be developed after simple modification.