Design of temperature detector based on MSP430F149
[Copy link]
Lanzhou's large-scale comprehensive engineering heavy ion accelerator-cooled storage ring (HIFRL-CSR) is one of the national key scientific projects. There are a large number of occasions for measuring temperature in its internal control system. These occasions rely on the behavior of confined ions to exert the magnetic field effect in the CSR main ring. In the magnetic field, these charged particle beams are sometimes in a focusing state and sometimes in a transmission state, and the quality of the magnetic field has a direct impact on the quality of the beam.
Since the temperature of the magnet is closely related to the magnetic field performance and safety. When current passes through the coil of the magnet, a very high temperature will be generated. Therefore, measuring its temperature is a very important task. The temperature detector with MSP430F149 as the core is designed based on this requirement and put into use. It is a low-cost and good-performance thermometer.
1 Temperature measurement principle
1.1 Analysis of the process of temperature measurement
In this design, the temperature measurement range should be controlled within the range of 20 to 70°C, and the temperature measurement accuracy is about ±1°C; when the temperature is higher than 70°C, an automatic alarm prompt will be issued. At present, most temperature monitoring systems have low accuracy, and the program response time is relatively slow, and only 8 channels can be monitored. In this design, 8 switches are used for simulation, so that 64 channels can be monitored. In this way, in this circuit, the bridge temperature can be mainly measured, and the A/D converter is used for conversion, which can be achieved by only using VCO and single-chip microcomputer interface.
When the temperature signal is sent, the Pt100 sensor is selected. The resistance value of its platinum resistor will change with the change of temperature, and will show a certain functional relationship. The Pt100 sensor uses this feature to realize the temperature measurement function. Among them, the relationship between temperature and resistance can be expressed as:
1.2 Parameter analysis of temperature measurement
Generally, the temperature measurement is controlled within -200~+800℃, and the allowable deviation is: Grade A ±(0.15+0.002|t|), Grade B ±(0.30+0.005|t|); Among them, the minimum insertion depth of the thermal resistor shall not be less than 2DO mm; the response time is controlled within 30 s; the current allowed to pass is not more than 5 mA. In addition, the temperature sensor Pt100 also has the advantages of good stability, vibration resistance, high measurement accuracy, and high pressure resistance.
The flow chart of the Pt100 temperature sensor measurement system is shown in Figure 1.
2 Hardware module of temperature measurement system
In this design, the 16-bit single-chip microcomputer MSP430F149 produced by Texas Instruments is mainly used. It has the advantages of fast running speed, strong processing ability and low power consumption. Its working voltage is 1.8~3.6 V. During operation, the internal CPU will issue an orthogonal simplified instruction set, which can realize various operations through registers, and has some interrupt sources that can be nested at will. If the system is in power saving state, the request and wake-up for interruption only take 6μs.
In addition, MSP430F149 has many on-chip peripheral modules. For example, the 12-bit A/D converter has an internal reference source, which can keep sampling and realize automatic scanning and other functions. In the 16-bit timer TimerA, there are four working modes, which can play the role of external comparison when realizing multiple capture functions. Among them, 48 I/O ports have the ability to be independently programmed, and two serial interfaces can realize the communication between USART0 and USART1. In addition, in the FLASH memory, the maximum storage capacity is about 60KB, which can complete nearly 100,000 erasing and writing.
2.1 Composition of the temperature measurement system hardware module
This system hardware module consists of three parts: data acquisition unit, communication interface unit and keyboard display unit.
2.2 Working principle of the temperature measurement system hardware module
2.2.1 Data acquisition
In this design, the bridge circuit consists of a Pt100 sensor and a resistor, which can convert the resistance change of Pt100 due to temperature change into a voltage change and input it into the operational amplifier. After the signal is amplified, it is converted into A/D. Due to the harsh conditions of field applications and the high accuracy requirements in the measurement process, part of the amplified signal can be converted to A/D using the conversion technology between voltage and frequency, and then the data measured by this method can be input into the ROM table to perform linear compensation on the A/D conversion results in the MSP430F149.
In bridge circuit A, the connection of wire resistance may cause measurement errors. In order to avoid this, a three-wire connection method can be adopted. In addition, the voltage fluctuation phenomenon in the bridge temperature measurement circuit may cause errors in the measurement results. Therefore, a +10V reference voltage should be used to realize the power supply of the bridge circuit to strengthen the voltage fluctuation limit in the bridge circuit. The bridge circuit is shown in Figure 2.
In the voltage-controlled oscillator LM331, the conversion between voltage and frequency can be realized. As a chip, it has the following characteristics: it can freely convert analog voltage and replace it with a pulse train that can be transmitted over long distances, can be directly input into a computer, and has strong anti-interference ability. Using the Timer module in the MSP430F149 microcontroller, its output frequency can be detected to complete the conversion function between A/D. In the voltage-controlled oscillator LM331, its temperature compensation function can be used, and it has extremely strong temperature stability. In addition, during the pulse output process of the device, it can be compatible with a variety of logic forms, and can be powered by either a single power supply or a dual power supply, in which the base voltage is controlled within the range of 5 to 40 V, and the maximum nonlinear error is controlled within 0.01%.
Relevant experiments have proved that the voltage-frequency relationship of the voltage-controlled oscillator LM331 is expressed as follows:
f0=KVi
Where: K=Rs/(2.09Rt·Ct·RL); Rs=Rs1+Rs2.
Because MSP430F149 is a 16-bit counter, the specific parameters selected in this design are: Rs=33 kΩ, Rt=6.8 kΩ, Ct=2 200 pF, RL=100 kΩ. Since Rs, Rt, Ct, and RL have a direct impact on the conversion of f0, their calculation results will also be different. Therefore, in this group of circuits, precision resistors are mainly used for calculation, and mica capacitors with small leakage current are selected for capacitors. The
circuit schematic of LM331 is shown in Figure 3.
2.2.2 Communication interface
The MSP430F149 is equipped with a universal communication serial interface that allows 7-bit and 8-bit serial bit streams. The serial bit stream is mainly carried out at a preset rate, and the speed determined by the external clock is used to make the shift in or out action. The MSP430F149 transmits data between the microcontroller and the host computer, which should be received or sent through the RS 485 transceiver; and then connected to Ethernet through the embedded gateway ATmega128 to realize the user's remote access function. Among them, the data communication mode is full-duplex, 4-wire form, with a baud rate of about 57,600b/s, and the data is received and sent through the P port in the MSP430F149 microcontroller.
2.2.3 Keyboard Display
The row and column scans can be completed through the keyboard interface. During the system operation, the MCU will continue to query and check whether the key is pressed, resulting in low work efficiency. Therefore, in the design, it is necessary to consider using the I/O port to complete the keyboard input interrupt. Both the P1 port and the P2 port in the MSP430F149 microcontroller can be used to handle external event interrupts, which is in line with the requirements of high efficiency and precision work. In the MSP430F149 microcontroller, connecting the keyboard to the P2 port greatly improves the work efficiency.
In this design, the main control drive supports the display unit, and the entire work is completed through the HD44780 LCD display. This module form has the advantages of compact structure, light weight, and easy assembly. At the same time, it has a standardized interface to ensure the full use of various performances. In addition to being able to display 192 standard characters, it can also display 8 custom special characters.
3 Software Design
3.1 Language of Software Design
MSP430F149 MCU can use C language programming to complete the entire program design work, and its program design improves the efficiency of development and debugging. Because of the use of C language programming, the generated documents are easy to understand and convenient for mobile use. When C language programming is applied to the MSP430 series, it has high compatibility with standard C language programming. In the process of software design, a modular method can be selected to ensure that the program structure is clear at a glance, which provides a very important reference for the further expansion of the system in the future.
3.2 Modules of Software Design
In the software module design, the main programs are: main program, communication module, display module, keyboard processing module, Timer counting module, A/D conversion module, etc. When the system is in working state, the program is initialized, and when this program is completed, it enters the patrol mode. If an interrupt event occurs during this process, the interrupt source location can be automatically determined and the relevant interrupt service can be connected. The software flow chart is shown in Figure 4.
4 Conclusion
In this system, the platinum resistor Pt100 is mainly used, which has strong reliability and good linearity. It has been widely used and plays an important role in the high-precision measurement environment. The
temperature detector with MSP430F149 as the core has a sensitive response to temperature. The controller used for acquisition has the characteristics of low cost, low power consumption, and strong anti-interference ability, which can meet different needs. Therefore, the temperature detector with MSP430F149 as the core can be used in various temperature detection systems.
Under extremely harsh field conditions, the MSP430F149 system uses voltage-frequency conversion technology to realize A/D conversion, avoiding the disadvantage of large measurement errors caused by direct use of A/D conversion in MSP430. The innovation of this design is that the table lookup method is used in the working procedure, so that the measured value can be linearly compensated and the measurement accuracy is improved.
|