Design of data forwarder based on MSP430F149
[Copy link]
At present, the existing manual meter reading methods are far from meeting the needs of modern management, and the resulting increase in line loss rate will inevitably affect the development of the power industry. One of the main reasons for the high line loss rate is the backwardness of meter reading, calculation and management methods, which increases management losses. If the automatic meter reading system is adopted , it can not only greatly improve the reliability of power grid operation, but also make full use of the capacity of existing equipment and reduce labor intensity. The system mainly consists of three parts: meter reader (data acquisition), data forwarder (data transmission) and host (data processing). This paper mainly designs the data forwarder part.
Usually, the meter adopts three communication methods: infrared communication, RS485 communication or wireless radio frequency communication, while ordinary meter readers generally only have one of the above three communication interfaces. In order to be applicable to the three common meter readers and conveniently and effectively transmit the data of the meter reader to the host, the data forwarder integrates these three communication interfaces. The complete collection system can realize data exchange between the host and the meter reader through the data forwarder. It is a multi-channel computer data transmission system, and the structural principle is shown in Figure 1. The last three channel modules communicate serially with the single-chip microcomputer MSP430 through a multiplexer , while the MSP430F149 communicates data with the host through the RS232 communication module.
1 Single-chip microcomputer interface design
The MSP430F149 single-chip microcomputer used in this design belongs to the MSP430 series of Texas Instruments. The MSP430 series is a group of ultra-low-power microcontrollers, consisting of a variety of models with different modules for different application targets. The microcontroller is designed to work for a long time using batteries, with a power supply voltage range of 1.8 to 3.6V. The MSP430F149 has 60KB of Flash and 2KB of RAM. The Flash is divided into 120 segments of main memory (512B per segment) and two segments of information memory (128B per segment). The Flash can be erased as a whole or in segments, which brings great convenience and flexibility to the system's software and hardware design. In view of the capacity and characteristics of the single-chip microcomputer memory, there is no need to expand the external memory and I/O port, and the peripheral devices are simplified. The operating voltage of MSP430F149 is 3.3V, so its I/O level is also 3.3V logic level and compatible with 5V TTL level. MSP430F149 has two serial asynchronous communication ports. The interface circuit schematic diagram between it and the host and the last three communication modules is shown in Figure 2.
The communication mode selected by the meter reader is converted by the MSP430F149 microcontroller controlling the level of the A and B pins of the multiplexer CD4052. The data communication between MSP430F149 and the host is realized through the RS232 communication module. The RS232 module is mainly composed of Maxim's MAX232/MAX232A receiver/transmitter, which is specially designed by Maxim to meet the EIA/TEA 232E standard. They are increasingly widely used in EIA/TIA 232E standard serial communication interfaces. They have low power consumption, single power supply, and external capacitance of only 0.1μF or 1μF. They adopt dual in-line package form, and the receiver output is three-state TTL COMS. They are dual-group RS232 receiver/transmitters, with a working power supply of +5V, high baud rate, and low price. They can be used in general systems that require serial communication.
2 Communication circuit design
2.1 RS485 communication interface circuit
The data transmission between the repeater and the meter reader passes through the RS485 transceiver MAX485, and is sent and received by the TXD and RXD of the microcontroller serial port. The microcontroller of the repeater has a specified address code, and the CPU constantly queries the RXD port data. When the address data is determined to be the corresponding address of this repeater, the operation data is read in, and then the control function is determined, and the corresponding control signal is sent. MAX485 is a differential balanced low-power transceiver chip. The chip contains a driver and a receiver, and is powered by a single +5V power supply. It is dedicated to the conversion between the TTL protocol (i.e., the communication protocol commonly used in various CPUs) and the 485 protocol. Its RS485 communication interface circuit is shown in Figure 3. The biggest advantage of RS485 is its multi-point bus interconnection function, which can connect a host and multiple terminals to communicate simultaneously. Because it is a half-duplex mode, only one party can send and the other party can receive, and it uses the differential level receiving method to improve the anti-interference ability, which is suitable for working in a relatively harsh environment.
2.2 Wireless RF communication interface circuit The
single-chip wireless serial interface circuit consists of a MICRF102 single-chip transmitter chip and a MICRF007 single-chip receiver chip, and works in the 300-440MHz ISM frequency band; it has ASK modulation and demodulation capabilities, strong anti-interference ability, and is suitable for industrial control applications; it uses PLL frequency synthesis technology and has good frequency stability; it can be used for wireless transmission of serial data between single-chip microcomputers, and can also be used in single-chip microcomputer data acquisition, telemetry and remote control systems.
(1) Wireless transmitting circuit
The wireless transmitting circuit is based on MICRF102, as shown in Figure 4 (a). MICRF102 is a single-chip UHF ASK transmitter launched by Micrel. It adopts SOP (M) -8 package. The chip contains: a synthesizer composed of a reference oscillator, a phase detector, a divider, a bandpass filter, a voltage-controlled oscillator, a transmit bias control, an RF power amplifier, an antenna tuning control and a varactor diode. It is a true "data input-wireless output" single-chip wireless transmitting device. The UHF synthesizer generates carrier frequency and orthogonal signal output. The input phase input (I) is used to drive the RF power amplifier. The antenna tuning quadrature signal (Q) is used to compare the antenna signal phase. The antenna tuning control part detects the phase of the transmit signal in the antenna channel and controls the capacitance of the varactor diode to tune the antenna and realize automatic antenna tuning. The power amplifier output is controlled by the transmit bias control unit. ASK/OOK modulation provides a low power mode with a data transmission rate of 20kb/s.
(2) Wireless receiving circuit
The wireless receiving circuit is based on MICRF007, as shown in Figure 4 (b). MICRF007 is a single-chip UHF ASK/OOK (on-off keying) superheterodyne radio receiving chip launched by Micrel. MICRF007 uses SOP (M) -8 package, and the circuit inside the chip can be divided into three parts: UHF down-converter, OOK demodulator and reference control. The UHF down-converter includes RF amplifier, mixer, intermediate frequency amplifier, bandpass filter, peak detector, synthesizer, AGC control circuit; OOK demodulator includes low-pass filter, comparator; reference control circuit includes reference oscillator and control logic circuit. Only two external capacitors CAGC and CTH, a crystal oscillator and power supply decoupling capacitor are needed to form a UHF ASK receiver. All RF and IF tuning are automatically completed in the chip, which is a true "wireless input-data output" single-chip device. MICRF007 is a standard narrow RF bandwidth superheterodyne receiver, and the narrow bandwidth receiver is insensitive to RF interference signals. The RF center frequency is controlled by a fully integrated PLL/VCO frequency synthesizer and is related to the reference oscillator external crystal. The bandwidth of the intermediate frequency bandpass filter is 430kHz, and the bandwidth of the low-pass filter of the baseband demodulator is 2.1kHz. The receiver receives digital ASK signals and the data transmission rate is 2Kb/s.
2.3 Infrared communication interface circuit
The infrared communication interface circuit is essentially a photoelectric signal conversion circuit composed of an infrared emitting tube and a transmission gate. The circuit design is related to the actual transmission distance required. This infrared communication module isolates the electrical connection of the two infrared devices, has good anti-interference ability, and can truly realize infrared transmission. Figure 5 (a) is an infrared transmitting circuit, which is mainly composed of one NOR gate, one infrared emitting tube and one amplifier transistor. P1.1 of the MSP430F149 microcontroller generates a carrier signal, and the NOR gate CD4071 plays a carrier modulation role on the TXD data transmission. Finally, the infrared emitting tube and the amplifier transistor send data signals to the meter reader.
Figure 5 (b) is an infrared receiving circuit. It
is mainly composed of NJL41V328. The NJL41 series is a newly launched integrated infrared receiver by JRC (New Japan Co., Ltd.), which integrates infrared reception and amplification. It does not require any external components to complete all the work from infrared reception to output compatible with TTL level signals, and it is the same size as ordinary plastic-encapsulated transistors. Therefore, it is suitable for various infrared remote control and infrared data transmission, and is an ideal component to replace infrared receiving amplifiers such as receiving diodes. NJL41V328 is used for data exchange between the repeater and the meter reader, realizing wireless data communication between the repeater and the meter reader. Figure 5 is the schematic diagram of the infrared communication interface circuit. 3 Serial communication program design Data transmission is carried out between the PC host and the meter reader. The PC communication program is implemented through the MSComm control of VB (Visual Basic, Visual Basic programming language). The MSP430F149 microcontroller uses an oscillation frequency of 32768Hz, a baud rate of 4800b/s, and a half-duplex mode of serial communication. The microcontroller serial communication program should be programmed in assembly language, and the program flow is shown in Figure 6.
Conclusion
This design scheme uses the MSP430F149 microcontroller, in which the rich on-chip peripheral function modules greatly simplify the peripheral circuit; its ultra-low power consumption mode reduces costs and improves operational reliability. At present, this design has achieved good results in the actual operation of the automatic meter reading system.
|