Design and implementation of forest fire monitoring system based on internet of things technology

. In view of the frequent forest fire problem, this design uses the Internet of Things technology to design a forest fire monitoring system. This system is composed of data acquisition module, data processing module, display module, locating module and alarm module. The data collection module is responsible for collecting forest temperature values and concentration values of smoke. The collected data is processed by the data processing module, and the processed data is displayed in real time by the display module. When the collected temperature or smoke concentration exceeds the thresholds, the GPS locating module is activated to locate the event. Then, the forest temperature value, smoke value exceeding the threshold and location information are sent to the manager ’ s mobile phone in the form of SMS through the Sim800 SMS alarm module for alarm. After experiment, the accuracy of temperature module in this design is ± 2 ℃ ; The accuracy of smoke density module is ± 5Pm; The accuracy of location is ± 100m. This design has the characteristics of small size, easy placement, large monitoring range, low cost and high sensitivity, which is suitable for further popularization and application.


Introduction
Forests play an important role in maintaining species balance and ecological balance. However, in recent years, forest fires have occurred frequently. Forest fires are not only hard to detect when they first catch fire, but also the affected area is relatively large and they are difficult to extinguish. This design uses the Internet of Things technology to realize the monitoring of forest fires, which is of great significance to the prevention of forest fires.
-Real-time display of forest temperature and smoke density values.
-When a forest fire is detected, alarm and send the temperature, smoke density value and fire location to the management personnel.

System design
The system block diagram of this design is shown as in Fig. 1. This design contains five modules, namely data acquisition module, data processing module, display module, positioning module and alarm module. The data collection module is responsible for collecting forest temperature values and smoke density values. The collected data is processed by the data processing module, and the processed data is displayed in real time by the display module. If it is found that the collected temperature value or smoke density value exceeds the set threshold value, the GPS positioning module is activated to locate the place where the event occurred, and the forest temperature, smoke value and location information exceeding the threshold value will be sent to the manager's mobile phone via the Sim800 SMS alarm module for alarming.

Selection of temperature sensor
Option 1: AD590 AD590 has large measurement range and fast information processing speed. The measurable range is between minus 55 ℃ and above zero 150 ℃ , but calibration is inconvenient and the price is more expensive. Option 2: DS18B20 The output signal of DS18B20 is a digital signal, which has the characteristics of small size, low hardware overhead, strong anti-interference ability and high precision. DS18B20 is easy to wire, and it can be directly connected to the microprocessor through only one data line.
Comparing these two temperature sensors, it is found that the cost of AD590 is higher than that of DS18B20, and the circuit connection is also more complicated than DS18B20. Although AD590 has a fast temperature reading speed, it must be matched with a calibrator. Therefore, DS18B20 is selected for temperature monitoring based on the design requirements.

Selection of display module
Option 1: 12864 The 12864 LCD screen can display numbers, English, Chinese characters, pictures and other information.
Option 2: LCD1602 LCD1602 can display letters, numbers and symbols. Although the 12864 liquid crystal display is larger in size than the 1602, the LCD1602 can meet the needs of this design, and the cost of 12864 is higher than that of the 1602, so the LCD1602 liquid crystal display is finally chosen as the display module of this design.

Selection of location module
Option 1: Base station location Base station location is a positioning method that obtains the specific location information of the current device by searching for surrounding base station information.
Option 2: GPS location The GPS space satellite constellation is mainly composed of 24 satellites, which can be monitored no matter where they are. The GPS receiver receives satellite signals and calculates the current position based on the signals.
This design is mainly used in forests. Some forests are far away from the base station and are not easy to monitor. GPS positioning does not require a Sim card. Even in a particularly open place outdoors, it can be positioned anytime and anywhere. In summary, GPS is more suitable as the positioning module of this design.

MCU Introduction
This design selects 32-bit microcontroller STM32F103C8T6 as the main control chip. The STM32F103C8T6 chip has a total of 48 pins. The PB9 pin is connected to the temperature sensor DS18B20, the PA11 pin is connected to the Sim800 module, the PB10 and PB11 pins are connected to the GPS communication module, and the PC14~PC15 pins and PA0~PA7 pins are connected to LCD1602, PB1 pin is connected to smoke sensors. The pin diagram of STM32F103C8T6 is shown in Fig. 2.

Hardware design of temperature monitoring module
DS18B20 is a single-bus digital temperature sensor developed and researched by MAMIX. The functions of each pin are as follows: GND: ground terminal; DQ: Data input/output terminal. Its internal drain is open, and an external pull-up resistor of 4.7 kΩ is required when used. When the parasitic power supply is used, this pin can also provide power to the DS18B20; VDD: Working power supply voltage terminal. The voltage range is 3~5V, when using parasitic power supply, this pin is grounded The circuit diagram of the temperature sensor DS18B20 is shown in Fig 3. Pin 1 is connected to the ground wire, pin 2 is connected to the microcontroller pin PB9, and a 4.7K resistor R42 is connected in series, and pin 3 is connected to VCC.

Hardware design of smoke density monitoring module
MQ-2 is a gas-sensitive smoke dendity sensor with a working voltage of 5V. The size of MQ-2 is only 32mm*22mm*27mm, which is suitable for most designs. The MQ-2 smoke detection circuit diagram is shown in Fig.4.

Hardware design of alarm module
The SMS alarm module Sim800 can also be called a GSM/GPRS module. Its small size can meet the needs of most application designs. The operating frequency is 850/900/1800/1900 Mhz. Sim800 is small in size, easy to install, economical, and stable in performance. It can continue to work and transmit messages with low power consumption. There are three working modes of Sim800, namely normal working mode, shutdown mode and minimum function mode.
The Sim800 circuit diagram is shown in Figure 5. In the figure, pin 2 can control the opening or closing of the module. It is connected to the PA11 of the MCU. Pin 5 is the transmitting pin of the module serial port. It is connected to the PA10 of the MCU. Pin 6 is the receiving pin of the module serial port, which is connected to PA9 of the MCU.

Hardware design of display module
The circuit diagram of LCD1602 is shown in Fig 5. In the figure, pin 1, pin 5 and pin 16 are grounded, pin 2 is connected to VCC, pin 3 is grounded and a 3K resistor R2 is connected in series, pin 4 is connected to PC14 pin of the MCU, and pin 6 is connected to the PC15 of MCU. Pin 7 is connected to PA0 of MCU, pin 8 is connected to PA1 of MCU, pin 9 is connected to PA2 of MCU, pin 10 is connected to PA3 of MCU, pin 11 is connected to the PA4 of MCU, and pin 12 is connected to PA5 of MCU, pin 13 is connected to the PA6 of MCU, pin 14 is connected to PA7 of MCU, and pin 15 is connected to VCC.

Hardware design of key module
The keys in this design mainly implement interface switching and threshold control. The key circuit has three keys, K2, K3, and K4 in sequence. Press the K2 key, and the LCD display will switch to temperature display. At this time, K3 can increase the threshold, which is the upper limit of temperature, and K4 can decrease the threshold, which is the upper limit of temperature. The upper limit represents the highest temperature that can be reached. Once the value is exceeded, a message will be sent to for alarming. Press the K2 key again, and the LCD display will switch to smoke display. At this time, K3 can increase and decrease the smoke threshold. In this design, the key module is mainly for the convenience of testing, but it is not needed when used in the actual forest. The key circuit diagram is shown in Fig.7. K2 is connected with PB14 of the MCU, K3 is connected with PB15 of the MCU, and K4 is connected with PA8 of the MCU.

General software design
The software flow chart is shown in Fig.8. The first, the system needs to be initialized, and two sensors are used, namely a temperature sensor and a smoke density sensor. Its function is to monitor the environmental temperature and smoke density values around the forest, and then STM32 processes the monitored data by sensors. The LCD display screen displays the specific information of temperature and smoke density in real time to determine whether the data exceeds the threshold. Once the temperature and smoke density exceed the threshold, STM32 will immediately read the location information of the forest , which is obtained by GPS. Finally, the Sim800 SMS alarm is activated. The SMS alarm information contains data information that exceeds the threshold and the latitude and longitude value. If STM32 judges that the monitored data does not exceed the threshold or the Sim alarm ends, the system will re-monitor the temperature and smoke concentration of the forest, so back and forth.

Software design of the temperature monitoring module
Software design of temperature monitoring module is as shown in Fig.9. First of all, system performs initialization. Secondly, STM32 starts to read the current forest temperature. The LCD displays the temperature value. The collected temperature value is compared with the initially set maximum temperature value. If the current forest temperature value is greater than maximum temperature value, the system will automatically activate the GPS and read the GPS value, at the same time activate the Sim800 SMS alarm. If the current forest temperature value is less than preseted maximum temperature or after the Sim800 SMS alarms, it will continue to monitor the smoke density value of the forest.

Software design of the smoke density monitoring module
The software design flow chart of the smoke density monitoring module is shown in Fig.10. The flow chart is basically the same as the temperature monitoring module.

Start
Whether the smoke density is greater than the threshold Y Initialization N STM32 read the smoke density value Display STM32 read the teperature value STM32 read the location Sim800 alarm

Software design of the alarm module
The software flow chart of the alarm module is shown in Fig.11. The flow chart design of the alarm module is mainly that when the data collected by the temperature sensor and the smoke density sensor exceeds the threshold, it will send an SMS alarm to the Sim800, and display the temperature, smoke density and GPS in the SMS. First, the Sim800 system is initialized, and then MCU analyses and processes whether the temperature and smoke density exceed the threshold. If the threshold is exceeded, a text message will be sent for the alarm. If the threshold is not exceeded, the system will return to judge again.

Software design of the display module
The software flow chart of the display module is shown in Fig.12. The display module design mainly displays three data, namely temperature, smoke density and positioning latitude and longitude. First, LCD1602 initializes, presses the key to set the threshold. Then, determines whether the temperature and smoke density exceed the threshold. Once the threshold is exceeded, an alarm will be issued, and the LCD will display the data exceeding the threshold and the location longitude and latitude. If the threshold is not exceeded, no alarm display is required.

Debugging temperature monitoring module
Firstly, prepare a lighter and connect the MCU and the temperature sensor. Secondly, connect MCU and the LCD. Finally, power on the MCU and put the temperature sensor in the room temperature and near the fire source respectively, test whether the display screen can correctly display the corresponding temperature information.
Test result: The display successfully displays the temperature value, and the data is correct. Therefore, the temperature sensor is debugged correctly.

Debugging smoke density monitoring module
Firstly, connect the MCU and the smoke density sensor. Secondly, connect MCU and the LCD. Finally, power on the MCU and contact the lighter and smoke concentration sensor near and far to test whether the display screen can correctly display the corresponding smoke density value.
Test result: The LCD successfully shows the change of the smoke density value, and the data is correct. Therefore, the smoke density sensor is debugged correctly.

Debugging location module
After connecting the MCU and the location module, the positioning is performed outdoors. The specific latitude and longitude information of the positioning is compared with the latitude and longitude information located by the professional locator to test the accuracy of the analytical results. Then change the test location, re-test the GPS positioning module to check whether it can be detected successfully, and compare with the parsed data. Finally, change the test location again to make the three test locations present a triangular distribution, and then check whether the GPS module can receive the satellite signals normally and obtain the correct latitude and longitude information.
Test result: The mobile phone successfully received the latitude and longitude information analysied by GPS, and the latitude and longitude data were correct. Therefore, the GPS module test was completed.

Debugging Sim800
The Sim800 SMS alarm module is the most important function of this design. Because there are two reasons for triggering the alarm, it must be tested separately. Firstly, it is the debugging temperature sensor. Secondly, it is the debugging smoke density sensor.
When testing outdoors, connect the MCU and Sim800, connect the sensor to the MCU, and insert the Sim800 into the mobile phone. After powering on, connect the Sim800 to the mobile phone, and then place the temperature sensor close to the fire source. Test whether Sim800 sends SMS alarms and whether the phone displays abnormal temperature values and GPS latitude and longitude values. In the same way, when the smoke density is abnormal, whether Sim800 sends a text message to alarm, whether the mobile phone displays the abnormal smoke density value and GPS latitude and longitude value.
Test result: The mobile phone successfully received abnormal values of temperature and smoke density and GPS latitude and longitude information. Therefore, the data is correct, and complete the test.

Design show
Design objective and location information short message are as shown in Fig.13 and Fig.14, respectively.

Conclusion
This design can monitor the temperature and smoke density in the forest environment in real time, and realize the monitoring of forest fires by setting a threshold alarm. After testing, the accuracy of DS18B20 temperature module in this design is ±2℃; the accuracy of MQ-2 smoke density module is ±5Pm; the positioning accuracy of VK2828U7G5LF is ±100m.
This design has the characteristics of small size, large monitoring range and high sensitivity. The disadvantage is that the collected data is small, and this design can only collect temperature, smoke density and location. The collection of wind speed can be added in the follow-up, and the trend of forest fires can be judged by monitoring the wind direction and wind speed, so as to provide more effective solutions for putting out fire.