Design of Data Acquisition System Based on MSP430F449 Single Chip Computer and M-BUS Bus

With the rapid development of society, smart communities have gradually entered people’s lives, and automatic meter reading systems are one of the important functions of smart communities. In terms of water, electricity, and gas management, the use of automatic meter reading technology can not only save human resources, but more importantly, it can improve the accuracy of meter reading, reduce bill errors caused by estimation or transcription, and make water and electricity , The gas management department can obtain data and information in a timely and accurate manner. In addition, users no longer need to make appointments with meter readers for on-site meter reading, and can quickly check bills, so this technology is more and more popular with users.

introduction

With the rapid development of society, smart communities have gradually entered people’s lives, and automatic meter reading systems are one of the important functions of smart communities. In terms of water, electricity, and gas management, the use of automatic meter reading technology can not only save human resources, but more importantly, it can improve the accuracy of meter reading, reduce bill errors caused by estimation or transcription, and make water and electricity , The gas management department can obtain data and information in a timely and accurate manner. In addition, users no longer need to make appointments with meter readers for on-site meter reading, and can quickly check bills, so this technology is more and more popular with users.

Aiming at the current high price of automatic meter reading systems on the market, a data acquisition system is designed that generates pulse signals from a zero-power magnetic sensor and uses the capture function of the MSP430 series of ultra-low power single-chip microcomputers to capture the signals. The acquisition system is relatively inexpensive, reliable in performance, and suitable for remote acquisition of water, gas, and electricity meters; the data transmission bus uses M-BUS, which has fast transmission speed, long distance and high reliability.

1 working principle

The data acquisition system is an improvement on the traditional meter reading system of electric meters, water meters and gas meters, making it suitable for remote meter reading. Take an ordinary gas meter as an example, choose to add a magnet to the last gear of the base meter (not counting the step-by-step transmission gear of the Display part). Every time the gear of this level rotates, the step-by-step transmission gear of the Display part must be moved 8 times, and every time it is dialed, it is O. 001 cubic meters, therefore, each revolution of this level of gear, a total of 0.008 cubic meters. Gas. That is, every 125 revolutions of the last-stage gear, that is, the step-by-step transmission gear of the display part is toggled 1000 times, and the count of the display part of the gas meter is 1 cubic meter. When the small magnet passes through the surface of the zero-power magnetic sensor, a pulse signal is generated. The signal is captured by the capture function of the MSP430 single-chip microcomputer, which causes an interrupt. The address 1 of the data storage area is incremented by 1; if it is added to 150, the address 2 is incremented by 1. Address 1 is cleared. The data in the storage area address 2 is the data of the gas meter base table. When the bus requires the microcontroller to transmit data, the microcontroller first determines whether it can transmit data. If possible, write the data in address 2 into the sending buffer, and send the data bit by bit; if not, wait until the single-chip microcomputer is idle before sending the data.

2 main features

The data acquisition system mainly has the following characteristics:

①Using a zero-power magnetic sensor as the front end of the collection, no external power supply is needed when working, and it is non-contact, corrosion-resistant, waterproof, and has a long life.

②Using MSP430F449 in the MSP430 series single-chip microcomputer as the data processing chip, with excellent performance and low price.

③Using M-BUS (Meter-BUS) bus for data transmission, with long transmission distance, high speed and high reliability.

④The power consumption of the acquisition circuit is very low, and it can be powered by a lithium battery or powered by the M-BUs bus.

3 Software and hardware design of data acquisition system

3.1 Equipment selection

The selected TI company’s 16-bit FIash MSP430 series ultra-low-power type single-chip microcomputer is particularly suitable for battery applications or handheld devices. In terms of ultra-low power consumption, the single-chip microcomputer can realize the power consumption current under the condition of 1.8-3.6 V voltage and 1 MHz clock. Between 1~400 μA; in terms of on-chip peripherals, it contains seven I/O ports P0~P6, 2 timers (Timer_A, Timer_B), 1 watchdog, internal integrated 2 KB ROM and 60 KB RAM can be re-programmed 100,000 times; MSP430 series single-chip computers are all industrial-grade products, and the operating environment temperature is -40~+85℃; in terms of price, MSP430 series single-chip computers are generally only tens of yuan. In short, the MSP430 series of single-chip microcomputers have a good price/performance ratio and can fully meet the needs of system development.

In the remote meter reading system, there are a variety of sensors can be selected, commonly used photoelectric sensors and Hall sensors. When the photoelectric sensor and the Hall sensor work, both need power supply, and the current is generally milliampere level. This will lead to a great consumption of the power supply battery. For gas meters, energizing the base meter can also cause safety problems. The zero-power consumption magnetic sensor is selected, no external power supply is required when working, and it is suitable for micro-power consumption meters. It is a better sensor for collection in the remote meter reading system.

The zero-power magnetic sensor is made by the Wiegand effect, so it is also called the Wiegand sensor. It is made by using the movement characteristics of the magnetic domain in the magnetic bistable functional alloy material in the magnetic field. When the external magnetic field changes, the magnetization direction of the magnetic domains flips instantaneously, and when the external magnetic field is withdrawn, it instantly returns to the original magnetization direction, which will induce an electrical pulse signal in the detection coil around the alloy material. Realize magnetoelectric conversion.

M-BUS bus is a new type of bus structure in Europe—instrument bus. It was jointly developed by Professor Ziegler of Paderborm University in Germany, Techem AG in Germany and Texas Intrument in Germany. It adopts a new instrument bus and a data acquisition system with related technologies. The following features: ①Common 3 twisted-pair cable connections and any bus topology (star, tree, etc.) can be used to make the system wiring construction simple and flexible to expand. ②The maximum bus length can reach l km (when the baud rate is less than or equal to 9600 bps). ③Each mark of the system has a unique address code, which is convenient for management. ④Twisted-pair wire completes data communication and provides power for the meter at the same time, and can provide users with 3 power supply methods (remote power supply, battery and remote power supply, and a single battery power supply after optical coupling). ⑤The system can realize 300~9600 bps half-duplex asynchronous communication. The communication medium can use ordinary twisted pair, the bus polarity can be interchanged, and the coverage of the network or system can be expanded through the repeater. ⑥Each M-BUS system has a level converter. The converter provides RS232 or RS485 interface to realize the communication with the central computer. The system can connect up to 250 user tables, as shown in Figure 1.

Design of Data Acquisition System Based on MSP430F449 Single Chip Computer and M-BUS Bus

3.2 Hardware circuit design

The circuit schematic diagram of the data acquisition system based on the MSP430F449 single-chip microcomputer is divided into two parts: the data acquisition module and the communication module.

(1) Data acquisition module

The data collector is designed to accurately collect the data of the three meters, as shown in Figure 2, including crystal oscillator circuit, power supply circuit, sensor circuit and so on.

Design of Data Acquisition System Based on MSP430F449 Single Chip Computer and M-BUS Bus

① Crystal oscillator circuit. Two crystal oscillator circuits, high-speed and low-speed, are provided in Figure 1, which can output three clocks with different frequencies to different modules within the single-chip microcomputer. Users can use high-speed crystals to generate high-frequency MCLK to supply the CPU to meet the needs of high-speed data operations; they can also turn off the high-speed crystals when the CPU is not needed; and for real-time clocks, low-speed crystals can be used to generate low-frequency ACLK supply.

②Power circuit. The operating voltage of the MSP430F449 one-chip computer is between 1.8-3.6 V, and the operating current is between 0.1-400 μA. In this circuit, the operating voltage is 3 V, and the single-chip microcomputer can be powered by a lithium battery or M-BUS bus.

③Reset circuit. The reset circuit of the microcontroller is connected to the 94 pin.

④Sensor circuit. After testing, the zero-power magnetic sensor can be directly connected to the capture port TAl of the single-chip microcomputer. When the small magnet installed on the gear of the gas meter passes the surface of the sensor, a pulse signal is generated, and the signal is captured by the capture function of the single-chip microcomputer. In order to ensure the accuracy of the data collected by the sensor, a low-power operational amplifier LM358 is added in Figure 1 to amplify the pulse signal of the sensor. The voltage at the acquisition port P1.2 is a high voltage, which is equal to Vcpu (3 V). When the basic voltage of the tertiary tube C9018 is greater than 0.7 v, the acquisition port P1.2 is pulled down, and the single-chip microcomputer counts. Through the experiment, every time the small magnet passes the sensor once, the address 1 of the single-chip microcomputer is counted up once.

(2) Communication module

The communication module is the data transmission circuit between the microcontroller and the bus concentrator, as shown in Figure 3. TSS721A is a special transceiver chip for M-Bus produced by Texas Instruments in early 1999. The built-in interface circuit can adjust the level between the master and the slave in the instrument bus structure, and can be connected to the bus through isolation devices such as photocouplers. The transceiver is powered by the bus and does not increase power requirements for the slave; the appearance adopts a 16-pin dual in-line package, which integrates the entire data transmission function. Its characteristics are as follows: ①Meet the international ENl434-3 standard; ②Receiving logic with dynamic level recognition; ③Adjustable receiving current through resistance; ④Non-polar connection; ⑤Anti-power failure function; ⑥Can provide 3.3 V voltage stabilization Source; ⑦Support remote power supply; ⑧Baud rate up to 9600 bps in half-duplex; ⑨Support UART protocol; ⑩Slave machine can be powered by bus or backup battery. There is an 8-bit dial switch on this chip, which is used to set the unique address of the meter on the bus. The host as the Master stores the address of each collector module, and copies the data of the collector module according to the request of the master. The concentrator sets the frequency division coefficient of each acquisition module and the dimensions and magnification of each meter.

Design of Data Acquisition System Based on MSP430F449 Single Chip Computer and M-BUS Bus

For wiring convenience, asynchronous serial communication is adopted. The selected MSP430F449 microprocessor contains 2 USART modules (USART0 and USART1). The module contains a baud rate setting part, a receiving part, a sending part and an interface part. The clock of the baud rate setting module comes from the internal clock or the external input clock, which is selected by SSEL1 and SSEL0 to determine the final frequency of the module. The clock signal BRCLK is sent to a 15-bit frequency divider, and through a series of hardware control, it finally outputs the shift clock BITCLK used by the two shift registers that are moved out and moved. The signal baud rate is set by the frequency division factor. N and the required baud rate (9600 bps) are determined, and the data transmission or reception is mainly through a shift register. When receiving, the shift register combines the received data stream to a full byte and saves it in the receiving buffer URXBUF; when sending, the data in the sending buffer UTXBUF is sent to the sending port bit by bit.

The 8-bit dial switch of TSS721A is used to set the unique address of the meter on the bus. The upper computer realizes the communication with the microprocessor MSP430F448 through addressing. Each time the master calls a certain address, only the slave with the same address image can recognize the call and respond accordingly. The communication protocol used is a half-duplex communication protocol.

3.3 Software design

There are many development softwares for MSP430, and IAR’s integrated development environment is used here: IAR Embedded workbench and debugger C-SPY. Use the capture function of the MSP430 microcontroller to test whether the microcontroller can accurately capture the signal from the sensor. The procedure flow is shown as in Fig. 4.

Design of Data Acquisition System Based on MSP430F449 Single Chip Computer and M-BUS Bus

First, initialize the microcontroller, define the microcontroller clock, rising edge capture, transmission mode, and input and output port settings. Then develop an interrupt program. Once an interrupt request is allowed, the CPU is awakened, enters the active mode, executes the interrupt service routine, and after the execution is completed, the system returns to the state before the interrupt and continues in the low power consumption mode. As shown in Figure 4, after running the main program, the system enters a low power consumption mode. If interrupt 1 occurs, the CPU is awakened, and the data at a certain address in RAM is incremented by one; if interrupt 2 occurs, the CPU is awakened. The data of a certain address in the RAM can be transmitted to the serial interface of the PC through the transmission line. If there is a special situation where interrupt 1 and interrupt 2 occur at the same time, through experiments, the priority of interrupt 1 is higher than interrupt 2, that is, interrupt service 1 is executed first, and then interrupt service 2 is executed.

4 Conclusion

Starting from the safety and reliability of the collected data, a new sensor and low-power MSP430 series single-chip microcomputer were selected to design a data acquisition system for remote meter reading. The system uses the M-BSU bus for data transmission. The experimental results under the software environment of the M-UBS debugger show that the acquisition part has a high accuracy of capturing signals, reasonable circuit design and software design, and relatively cheap price, which has a good application prospect.

The Links:   SP12N002 G050VINO11

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *