FPGA Alarm System Based on Multi Temperature Sensor

The purpose of this study is to achieve real-time acquisition and monitoring of temperature in large-scale industrial or agricultural production scene, and timely detect abnormal temperature. FPGA chip, multi temperature sensor and alarm control module three parts consist of FPGA alarm system obtained based on multi temperature sensor. Multi temperature sensor is used for the acquisition of relevant temperature signal in the production site, and the transmission of the collected data through the way of digital signal chip to the FPGA chip for further processing. The FPGA chip is responsible for the parameter setting, the temperature signal acquisition and the threshold comparison and so on, and according to the data processing result, it can send out the normal response control signal to the alarm module. The alarm module contains the pre-warning lights and the alarm device that it can receive the control signal and realize alarm response. The results showed that the test in planting flowers in greenhouse showed that the system is sensitive in response and small in error of temperature acquisition, in accordance with the requirements for use. As a result, the system can be widely used in the temperature monitoring in the production scene, suitable for being promoted in a variety of occasions needing for monitoring the temperature. Keywords—temperature sensor, alarm system, FPGA, temperature monitoring


Introduction
Temperature is the physical quantity to reflect the cold and hot degree of object, and also one of the most common and basic parameters in industrial production. In the production process, we often need to monitor the temperature. For agricultural greenhouses, the suitable temperature is especially important. The growth and breeding of crops are carried out in the appropriate temperature. If the temperature is not appropriate, it may cause a decline in the yield of crop, plants wither and even death [1]. But today, most of our country agriculture greenhouses have no practical temperature monitoring system, and there are some agricultural greenhouses still following the simple temperature device and paper data recorder for temperature measurement, unable to achieve real-time measurement and monitoring task of temperature data [2]. At the same time, with the rapid development of social economy, more and more production departments and the production links put forward more and more requirements on the accuracy of temperature monitoring, and the traditional temperature sensor has been unable to meet the needs of people's lives.
Throughout the current temperature monitoring system using intelligent temperature sensor DS18B20, the vast majority make use of micro-controller development. According to the FPGA chip with various I/O pins, static, dynamic, and repeatable programming and so on characteristics in the reconstruction of the system, this study attempts to use FPGA and DS18B20 temperature sensor combination to conduct the design of temperature monitoring alarm system. In addition, with the expanded function and flexibility of electronic system developed by FPGA chip, it provides a powerful guarantee for the system function upgrade in the future.

2
State of the art FPGA (Field-Programmable Gate Array) is a field programmable gate array, which is the product of further development on the basis of PAL, GAL, CPLD and other earlier programmable devices. In the field of application specific integrated circuit (ASIC), FPGA as a semi-custom circuit, greatly solves the problem of lack of flexibility to upgrade the original custom circuit. At the same time, it overcomes the shortcomings of limited circuit number for the earlier programmable gate. FPGA chip is mainly composed of 7 parts, which respectively can be summarized as: the basic programmable logic unit, programmable input / output unit complete clock management, embedded block RAM, rich wiring resources, embedded underlying functional unit and embedded hardware module [3].
Available devices used in temperature acquisition are mainly analog devices (thermistors, transistors, etc.) and digital temperature sensor. Most of the traditional methods take thermal resistance and thermocouple as temperature sensitive components, but they have the disadvantages of poor reliability, low accuracy and low accuracy [4]. Most of temperature measurement and control system composed of the temperature sensor have two major shortcomings: first, they need a large number of connections to send the scene sensor signal to the acquisition card, the wiring construction is troublesome, and the cost is also high; second, what on the transmission line is the analog signal, vulnerable to interference and loss. While the new intelligent temperature sensor DS18B20 model has high precision, low price, simple network, no zero drift, no A/D conversion and so on advantages. Although it has defects in corrosive than the optical fiber sensor, it improves the anti-corrosion ability by applying a method of metal packaging.
In the traditional temperature measurement system of analog signal, there are many technical problems, such as the multi-point temperature measurement switching error, the zero drift error caused by the amplifier circuit, and the compensation error caused by the leading wire. These technical problems caused that in the need for designing a circuit replacing temperature sensor, the overall system needs to be re-adjusted to eliminate various error impacts caused by changing the temperature sensor [5]. This system design has very poor compatible expansion performance, so in order to over-come this problem, this paper uses a high-precision digital temperature sensor DS18B20. The characteristics of DS18B20 temperature sensor comprises a power supply range (3.0V~5.5V), which can use the signal line parasitic for power supply, provide the temperature measurement precision with 9 to 12 bits, the temperature measurement range of -55 DEG C to +125 DEG C, and can work on a same single bus. The characteristics of the FPGA chip is directly facing to the user, the system software and hardware testing achievement is convenient and rapid, with very large flexibility and so on [6]. To sum up, through the effective combination of the two, it is very suitable for the requirements of a variety of system applications for hardware and software system for scalability, cost control and the development of simple structure. Based on the above reasons, this paper proposes a new method of using DS18B20 temperature sensor and programmable logic device FPGA to achieve the temperature monitoring system.
Temperature control is widely used in various fields of social life, such as home appliances, automobiles, materials, power electronics and so on. According to the application and the required performance indicators, commonly used control circuit is different. Many scholars have studied this aspect.
Lang Yue and Tong Shoufeng propose a demodulation system for fiber Bragg grating (FBG) temperature sensor design. The results show that the average temperature error of the system is less than 0.2 in the measurement experiment. It can realize the real-time sampling and processing of the four signals.
Combined with the characteristics of FPGA, Zheng Lijuan, Wang Mei, Wang Ning take the intelligent temperature sensor DS18B20 as a temperature acquisition device. Through the collection, storage, display and serial transmission of the four temperatures, they make the hardware, software and interface design of the system. Finally, they completed the entire temperature collection system. The advantages of the system are simple and reliable and strong anti-jamming capability.
In harsh environments, especially strong electromagnetic interference environment, the embedded system based on MCU architecture is very prone to failure or even out of control. In order to solve this problem, Liu Zhibin and Jiang Li have designed a highly reliable temperature acquisition system based on FPGA and temperature sensor control. The experimental results show that the newly designed temperature acquisition system runs faster and more stable.
In summary, the existing control system cannot reach the best state because of the external disturbance. There are some errors in the final measurement results. Therefore, multi temperature sensor is used for the acquisition of relevant temperature signal in the production site, and the transmission of the collected data through the way of digital signal chip to the FPGA chip for further processing. The FPGA chip is responsible for the parameter setting, the temperature signal acquisition and the threshold comparison and so on, and according to the data processing result, it can send out the normal response control signal to the alarm module. The alarm module contains the pre-warning lights and the alarm device that it can receive the control signal and realize alarm response. The results showed that the test in planting flowers in greenhouse showed that the system is sensitive in response and small in error of temperature acquisition, in accordance with the requirements for use. As a result, the system can be widely used in the temperature monitoring in the production scene, suitable for being promoted in a variety of occasions needing for monitoring the temperature. Figure 1 is the system structure diagram of temperature controller designed in this study. First of all, the temperature signal outputs the digital signal through the temperature sensor DS18B20 acquisition, and then the digital signal output is sent to FPGA for the processing (divided into three parts). Binary signal by decoding input is converted into 10 decimal signal, to display in the digital tube, and the binary signal input is sent to the comparator, to compare with the set threshold signal. According to the comparison result, control the level of the output electric level, and achieve the role of controlling the external unit components. FPGA based temperature sensing alarm system, from the hardware module, can be divided into: temperature alarm module, temperature display module, configuration circuit module, clock circuit module, configuration module, clock circuit module, temperature alarm control system setting module, and system power supply module. The various modules cooperate together, to provide hardware basis guarantee for the realization of the temperature alarm function.

System hardware design
FPGA temperature alarm module is divided into two parts, buzzer and LED alarm lamp. A buzzer circuit, by receiving the control signal sent from the FPGA chip, uses the transistor drive circuit to complete the buzzer corresponding, LED alarm lamp sends electric level signal control by the FPGA chip [7]. The temperature alarm module schematic is shown in figure 2. Cyclone FPGA chip configuration can be divided into active configuration mode (AS), passive configuration mode and JTAG configuration mode. This research design system uses JTAG mode. Temperature sensor alarm system design circuit original clock output frequency is 50MHz, and the system clock alarm module schematic is shown in figure 3. The temperature alarm system control module uses four closing switches. When the switch is pressed, the ground short circuit provides the low level control signal to the FPGA chip, thus completing the corresponding operation. Keys are divided into: up temperature keys, down temperature keys, working mode switching, and reset. The temperature alarm system based on FPGA chip and the electrical characteristics of DS18B20 provide 1.5V and 3.3V constant voltage. In order to ensure the stability of output voltage, and reduce the complexity of hardware design, we select AM1117S low dropout three terminal voltage regulator chip to provide a stable voltage support.

3.2
System software design Figure 4 is the architecture block diagram of the designed temperature sensing alarm system. As shown in figure 4, there are data processing module, temperature display module, clock divider module, and data buffer module in the FPGA. The data processing module completes the temperature threshold comparison, the temperature threshold parameter setting as well as the reset function. Temperature display module completes the LED digital display output function. Clock frequency divider module realizes the frequency reduction function. The data buffer module realizes the receiving of serial data received by DS18B20 and completes the parallel data output function.
The data processing module completes the temperature data threshold setting, the comparison, as well as the LED code output function. Data source of data processing module includes data cache module and system key control module, wherein the 12bit binary code provided by the data cache module is real-time temperature transcoding [8]. The data processing module compares the received data with temperature threshold parameters preserved in registers in advance, and when the conditions are met, trigger the corresponding response operation.
The temperature display module, after receiving the 14-bit binary code provided by the data processing module, will complete the temperature display output of the code, divided into 4-bit, and 8-bit two binary codes. Temperature display module input port contains: clock signal, reset signal, and 14-bit binary temperature signal. The output module of the temperature display module includes: 4-bit, 8-bit, and two binary temperature signals.
The hardware clock circuit of the clock frequency module stably outputs 50MHz frequency clock signal, and through the development of FPGA function module, completes the clock signal frequency work. The original 50MHz clock signal is divided to 1MHz to meet the requirements of the system for time series data acquisition, and the development mainly adopts the conditional delay to make frequency division processing of the original frequency.
The flow chart of temperature acquisition for the data cache temperature acquisition module is shown in figure 5.

Start
The DS18B20 is initialized

Experiment
This experiment mainly aims at FPGA alarm system function test based on multi temperature sensor. The system entity diagram is shown in Figure 6.

Experiment process
The functional test of the system is carried out in a planting greenhouse with the length of 50m and the width of 15m. The layout of temperature sensor and alarm is shown in figure 7.

Temperature Sensor1
Temperature Sensor2 Temperature Sensor3 Temperature Sensor4 Temperature Sensor5 Temperature Sensor6 Temperature Sensor7 Temperature Sensor8 Temperature Sensor9 Temperature monitoring alarm Fig. 7. The arrangement of temperature sensor alarm system in flowers Greenhouse In the testing of the system function, we make us of simultaneous test of the timing acquisition and traditional thermometer, and set the system timing acquisition temperature. When the temperature is normal, there is no feedback in the system; when the temperature exceeds the preset limit, the red light on the terminal acquisition module is flashing.
Instruction mode specific test methods are as follows: The 9 terminal temperature acquisition nodes, according to the average distribution principle, are placed in flowers greenhouses. Set to acquire the temperature once every 10 minutes. For testing whether the sensitivity and alarm function of the system temperature acquisition is normal, the normal temperature is set to 24 DEG ~26 DEG [9]. In the actual application, according to the actual situation, we can set the acquisition time interval and the normal temperature range.

Experimental results and discussion
In the experiment, the temperature acquisition module is used to measure the temperature, and then the temperature is measured by the conventional method in the same position.
The system temperature acquisition interface is shown in Figure 8.  As can be seen from table 1, the system sends out an alarm when the collected temperature exceeds the preset range, indicating that the system operates normally.
In order to characterize the accuracy of the temperature sensor acquisition temperature, we calculate the average difference between the temperature acquired by each temperature sensor and the temperature value of traditional methods testing. The specific calculation method is to use the temperature value that the temperature sensor acquires to deduct the temperature tested by the traditional method, and then divided by the number of measurements of temperature. In order to reduce the error of the data and improve the accuracy of the results, the measurement lasted 24 hours, the acquisition had an interval of ten minutes, and each temperature sensor collected 144 groups data [10]. The average difference between the temperature value measured by the temperature sensor and the temperature measured by the traditional method is shown in figure 7. Average temperature difference/ The sensor number -- Fig. 9. The average difference between system acquisition temperature and traditional method temperature As can be seen from Figure 7, the designed FPGA alarm system based on multi temperature sensor has accurate temperature acquisition, and compared with the temperature measured by the traditional method, the error is within ±0.1 DEG C, able to effectively avoid that the system sends out the wrong alarm.
At present, the intelligent flowers greenhouse temperature control is still in the initial stage in application. Because of its relatively high economic cost, it has not been widely used, but we have reason to believe that, with the development of technology, in the future, intelligent temperature monitoring system must be able to get a good application and development.

Conclusion
With the development of the times, in order to meet more diverse requirements for real-time monitoring of temperature, from the principle of technology based on FPGA chip, this paper developed a set of temperature sensing alarm system with intelligent temperature sensor DS18B20 as the element of temperature monitoring, and eventually completed the physical production. The purpose is to be able to apply it in greenhouse to realize temperature real-time monitoring and promote agricultural production through scientific measurement methods. Research work includes the system software and hardware function design of temperature alarm system, and finally it makes a systematic functional test in the flowers greenhouse. The results proved that the system was accurate and reliable, and can collect accurately the indoor temperature. When the temperature exceeds the set range, it will send out an alarm, so as to avoid the loss caused by the improper temperature control.
The universality of the system is strong that it can be used in most of the occasions needing for monitoring the temperature, such as grain, coal mines, road or some environment with harsh conditions of production. Although due to the cost, the automatic temperature monitoring system has not been widely used in China's industrial production, with the development of technology, automatic temperature monitoring system is bound to be the future mainstream of temperature monitoring, and has broad application prospects.