Design of CO Infrared Detection System Based on CAN Bus and MSP430

Use infrared optical sensor devices to replace traditional sensors. Safety is greatly improved; combined with CAN bus technology, replacing the traditional RS232 and RS485, greatly reducing the difficulty of system development and shortening the development cycle. Compared with other field buses, CAN bus has the characteristics of high communication rate, easy implementation, and high cost performance. Using TI’s MSP430 microcontroller, there are more integrated peripherals, which reduces the difficulty of development and has ultra-low power consumption. Conducive to energy saving.

1 Introduction

Carbon monoxide (CO) is a highly toxic gas. After the human body inhales humans, it causes hypoxia in human tissues and cells, leading to poisoning and suffocation. In coal mines, CO is also one of the main gases that cause gas explosions. CO causes great damage to both industrial production and humans. Therefore, CO detection is particularly important, especially in coal mines. The “Coal Mine Safety Regulations” stipulates that the CO concentration in underground operations should be controlled below 0.0024%. Therefore, real-time and accurate measurement of the CO gas concentration in a well is of great significance to ensure the safety of coal mine industry production.

The current methods for detecting CO mainly include chemical methods, electrochemical methods, and gas chromatography. These methods generally have problems such as high price, poor universality, and low measurement accuracy. A new detection system is designed here. Infrared CO sensor and MSP430 single-chip microcomputer are selected as the core signal processing circuit, combined with digital filtering and temperature compensation operations. It has the advantages of wide detection concentration range and long service life. The CAN bus has the characteristics of long communication distance and high reliability. By extending the CAN bus interface, the tester has the remote communication capability, which can easily connect with the monitoring center, effectively reduce the accident rate, and has promotion and application value.

2 System composition and hardware design

The system consists of infrared CO gas sensor, MSP430 single-chip microcomputer, CAN bus interface and remote monitoring system. The system uses a single-chip microcomputer to process the detected data, control LCD Display, and sound and light alarms at the detection site. It is also equipped with a CAN bus controller, which can easily obtain related information such as concentration, temperature and alarm records, and realizes an intelligent industrial site and remote Simultaneous monitoring function. The block diagram of the system is shown in Figure 1.

Design of CO Infrared Detection System Based on CAN Bus and MSP430

2.1 The principle and selection of sensors

Each substance has a specific absorption spectrum (for example, CO gas has a very strong absorption peak at the wavelength of light 4.5μm), which can be used for measurement. The concentration of gas can be judged according to the change of absorption peak at certain specific wavelengths on the spectral curve of various gases.When infrared light passes through the gas to be measured, these gas molecules have an absorption effect on infrared light of a specific wavelength, and the absorption law follows the Lambert-Beer law

Design of CO Infrared Detection System Based on CAN Bus and MSP430

In the formula, I is the energy of transmitted light, L/mol·cm; Io is the energy of infrared radiation absorbed by gas, L/mol. cm; K is a constant related to the gas and radiation wavelength, L/mol·cm: C is the concentration of the gas to be measured. mol/L; L is the thickness of the radiation passing through the gas layer, cm.

From equation (1), it can be seen that by detecting the intensity of infrared radiation absorbed by the gas, the concentration of the gas to be measured can be calculated. Using SM-C0 H/M sensor, this series of analog output CO adopts dual-beam non-dispersive infrared (NDIR) detection technology. It has the advantages of anti-interference from other gases, easy maintenance, good stability, built-in temperature compensation, Modbus ASCII protocol digital output and analog output. It is suitable for leak alarm, on-site construction protection, simple gas analysis gas, online monitoring, industrial process analysis and other occasions.

2.2 The working principle and data processing of MSP430 single-chip microcomputer

The MSP430 microcontroller is an ultra-low-power Flash 16-bit microcontroller produced by Texas Instruments (TI). According to the system function and peripheral circuit interface requirements, the MSP430F449 single-chip microcomputer is selected, which has abundant internal hardware resources; the built-in temperature sensor is used to detect the ambient temperature and compensate the data detected by the infrared sensor; its built-in A/D converter is used to convert the sensor The output analog quantity is converted into digital quantity; through the hardware multiplier, high-speed digital filtering and temperature compensation of the measured A/D sampling data are realized. The digital filtering method adopts the extreme value average filtering method. In the case of severe pulse interference, if the general average value method is adopted, the interference will be averaged into the result, and it is not easy to eliminate the error caused by the interference. First, arrange the sampled values ​​of IV times into a column in order of size, and use the “bubble sort method” to remove the maximum and minimum values ​​of the N data, and then calculate the average value of the (N-2) data, which is to remove Extreme value average filtering method. The processing method of temperature compensation; when the static characteristic of the sensor is linear, the characteristic before temperature compensation can be expressed as:

Design of CO Infrared Detection System Based on CAN Bus and MSP430

In the formula, x is the input of the sensor, y is the output, Y is the intercept of the characteristic curve on the y axis (that is, the output gain caused by the ambient temperature), and k is the proportional coefficient.

The steps of the temperature compensation formula method are as follows:

(1) Given (m+1) temperature values: T0, T1, T2,…, Tn,…, Tm, measure the intercept Y0, Y1, Y2 of the static characteristic curve of the sensor on the y axis at each temperature ,…, Yn,… Ym;

(2) Express Y as an algebraic polynomial of degree n with temperature T as the independent variable (n

Design of CO Infrared Detection System Based on CAN Bus and MSP430

Use least squares curve fitting method to determine a0, a1, a2,…an.

(3) When measuring each y value and corresponding T value, first calculate the Y value, and then calculate the x value

Design of CO Infrared Detection System Based on CAN Bus and MSP430

The use of digital filtering and temperature compensation algorithms can make the measurement more accurate and minimize the impact of ambient temperature.
)

2.3 Buttons, LCD Display and alarm system

The button is used to set the system time, sound and light alarm value and corresponding CAN bus communication address and other parameters. If there are fewer buttons, one port corresponds to one button, and the capture interrupt is used. If there are more keys, a determinant keyboard can be used to save port resources. The LCD display adopts the LSD12864CT display module, which is composed of a set of row drive signals IC3 and two sets of column drive signals IC2 (controls the left half screen) and IC1 (controls the right half screen). The display dot matrix is ​​128×64, which can be displayed. Graphics or Chinese characters. The internal integration of row and column drivers and the interface of the display buffer RAM, and the hardware can set the structure of the display screen, the data transmission mode, the length and width of the display window, etc. MSP430F449 comes with 60 KB Flash internally to record the time when the infrared measurement data exceeds the limit and the corresponding setting value, and save the relevant parameters of the CAN interface. When the CO concentration exceeds the set range, an audible and visual alarm device will alert the underground workers.

2. 4 CAN bus interface design

The CAN interface of the system consists of an independent CAN bus controller SJA1000 and a CAN data transceiver TJA1050. SJA1000 is an independent CAN controller, mainly used for regional network control in moving targets and general industrial environments. AD0-AD7 of SJA1000 is connected to P2 port of MSP430, P3.4 and P3.5 respectively control the read and write operations of SJA1000. MSP430 initializes SJA1000, and realizes the sending and receiving of data by controlling SJA1000. TJA1050 is the interface between the controller area network (CAN) protocol controller and the physical bus, and is a standard high-speed CAN transceiver. TJA1050 can provide differential sending function for the bus and differential receiving function for CAN controller SJA1000. TJA1050 provides CAN node interface to realize CAN bus data transmission. Among them, CANH and CANL are connected to the external CAN bus network. The connection circuit of MSP430, SJA1000 and TJA1050 is shown as in Fig. 2.

Design of CO Infrared Detection System Based on CAN Bus and MSP430

3 System software design

After the system is powered on and reset, it is first initialized, including system hardware initialization and reading CAN related parameters from MSP430 Flash, and setting; then the system performs key scan: if a key is pressed, the corresponding operation is performed, such as setting time and CO Alarm concentration value, modify CAN parameters, check alarm records, etc.; if no key is pressed, CO concentration will be collected and processed by software. Software processing includes digital filtering and temperature compensation to calibrate the concentration data. If the CO concentration exceeds the limit, an audible and visual alarm will notify the underground workers and record the alarm time and alarm value in the memory. If the concentration is normal, it will be detected and displayed in a loop. The system software flow is shown as in Fig. 3. The remote transmission of gas concentration data is completed by the CAN bus interface. When the host computer sends a message to the station, that is, when the station is required to transmit data, the system transmits data to the host computer, which can reduce the burden on the microcontroller and reduce power consumption. Therefore, the CAN communication program flow is roughly as follows: when the detector receives a valid message, a reception interrupt is generated. In the interrupt service subroutine, the C0 concentration data is sent in the form of a CAN message, and the message is sent in a non-interrupted manner. The specific work The process is shown in Figure 4.

Design of CO Infrared Detection System Based on CAN Bus and MSP430

The upper computer adopts the visual operation interface under Windows written by Delphi. Delphi is an event-driven, object-oriented visual high-level programming language. The communication software design of the system adopts Delphi 7.0. Among the many serial communication controls available in Del-phi, the SPComm control is the simplest and more powerful one. This control has a wealth of attributes and events closely related to serial port communication, and provides various operations on the serial port. Through the design of Delphi, the current time and gas concentration can be displayed intuitively in the host computer. Remote operation can also be performed through serial communication. The sampling timer can refresh the displayed data at regular intervals to detect data changes in time.

4 Conclusion

Use infrared optical sensor devices to replace traditional sensors. Safety is greatly improved; combined with CAN bus technology, replacing the traditional RS232 and RS485, greatly reducing the difficulty of system development and shortening the development cycle. Compared with other field buses, CAN bus has the characteristics of high communication rate, easy implementation, and high cost performance. Using TI’s MSP430 microcontroller, there are more integrated peripherals, which reduces the difficulty of development and has ultra-low power consumption. Conducive to energy saving.

The designed infrared CO detection system has a wide detection gas concentration range and good equipment maintenance. Utilizing the low power consumption characteristics of MSP430F449 and its internal integrated A/D converter, multiplier, temperature sensor and other hardware resources, the measurement precision is greatly improved. Through the CAN bus interface, the system can not only display real-time data on the spot, but also realize the long-distance, high-reliability communication function and remote monitoring of the instrument. Therefore, the system has good application prospects.

The Links:   HSD150SX84-F CLAA170EA08