Building a Hill Fire Detection IoT with LoRa Part 1: Introduction
In 2018, California wildfire burnt a large area and destroyed lots of houses. A great number of people became homeless. The campfire caused hundreds of injured and claimed nearly a hundred lives. Although the fire was put out, the society was damaged seriously. A large amount of money was spent to rebuild the society. The city of Paradise may take years to recover. “It is the deadliest in state history”, according to BBC news. Different approaches are adopted to prevent large hill fires from occurring. Nowadays, approaches mainly rely on reports of country park patrolman or citizens. However, there are a lot of limitations in effectiveness using this approach. So, IoT sensors can play a crucial role in detecting hill fires. That’s where the idea comes from.
The IoT system aims to provide a 24/7 on-site hill fire monitoring and detecting service. It reduces cost and time of human resources and can save lives and reduce the loss of properties if a fire is detected in an early stage and immediate actions are taken. In order to detect fire, IoT sensors are needed to be distributed around the hill. The area of the hill is large, it is far away from urban area network coverage. It is a challenge for the communication between sensors and receivers to exchange data. So, LoRa, short for Long-Range, is a suitable wireless communication technology to achieve long-range communication.
What is LoRa? Why use LoRa?
“LoRa (short for long range) is a spread spectrum modulation technique derived from chirp spread spectrum (CSS) technology” by Semtech. It is a wireless modulation technology with low power consumption and effective long-range capability. It can achieve a range up to 15 km while consuming very little power (100 mW constant RF output @3.3V, based on Semtech SX1276), and it is designed specifically for M2M and IoT network. LoRa transceivers operate in 860-1000 MHz range. There are a large of range of LoRa development kits available in RS. The article below also mentions some LoRa kits. And of course, you may find what you want and like on the RS website.
To further explore the modulation technology of LoRa, extra information can be found at RF Communication and the Internet of Things - Part 3.
Because of the great ability of LoRa, it is suitable for remote devices to communicate. Also, remote devices can benefit from the low power consumption of LoRa, so they can be powered by a battery and can last for a few years without battery replacement.
- LoRa shield, I-NUCLEO-LRWAN1 (143-8573)
- Flame sensor (136-0709)
- STM32F103 MCU chip (040-2279) or you may use a STM32 Nucleo board (802-9416)
- DS18B20 Temperature Sensor (040-3620)
- MQ-2 Gas Sensor, two sensors use to detect different exhaust gases
It is a self-designed circuit board. Most of the on-board components and sensors can be found on the RS website. The design file of the above circuit board is attached at the end of the article.
(143-8573) RS Components
The LoRa shield in blue, I-NUCLEO-LRWAN1 (143-8573), is the most important component in the sensor node, which acts as a data telemetry board. It forwards sensor data to the gateway through LoRa. Several sensors, like accelerometer, magnetometer, relative humidity, temperature, and pressure sensors are embedded on board for convenient use. Also, its headers are Arduino Shield v3 compatible. It is a handy tool for developers to build prototypes related to LoRa.
- STMicroelectronics Discovery LoRa Development Kit B-L072Z-LRWAN1 (134-5557)
- Raspberry Pi 3 Model B+ (137-3331)
STMicroelectronics Discovery LoRa Development Kit and Raspberry Pi 3B+ are used to build a LoRa gateway. To keep things simple, the gateway and sensor node use LoRa, instead of LoRaWAN, as a channel or conduit for information where gateways provide a transparent bridge sending and receiving messages between sensor nodes and the Internet.
(134-5557) RS Components
STMicroelectronics Discovery LoRa Development Kit B-L072Z-LRWAN1 (134-5557) is a powerful microcontroller board. A low-power 32 MHz Cortex-M0+ microcontroller STM32L072CZY6 is embedded to control SX1276 LoRa transceiver. It makes this board not only a data telemetry board but also a full-function development board for dealing with I/O tasks and dealing with different communication protocols and interfaces like UART, SPI or I2C etc. Also, combined with six on-board LEDs, push-buttons and the Arduino compatible connector, these handy features make it a good product for prototyping.
Toolchain & Software
Several tools and software code are needed to set up first.
I-CUBE-LRWAN, a project code for LoRa shield and discovery board. It can be downloaded from the STMicroelectronics website. Our project code is edited based on this project code. You may take a look at the original one first.
Be careful with the LoRa shield I-NUCLEO-LRWAN1 (143-8573), the actual pinout of its embedded chip is different from the pin definition in I-CUBE-LRWAN project code. https://www.st.com/en/embedded-software/i-cube-lrwan.html
ThingsBoard, an online dashboard to display the sensor data. https://thingsboard.io/
Telegram App, an instant messaging platform used to receive messages from the gateway.
To play with the Telegram Bot, pay much attention to “Token” of HTTP API and “chat_id”. Please find the tutorial at Creating a Bot using the Telegram Bot API.
Attachment of Design Files
PCB Circuit design file (1) pdf version (2) pcb file
Sensor node – Folder contains (1) a modified version of I-CUBE-LRWAN for USI I-NUCLEO-LRWAN1 LoRa shield and (2) project code for on-board STM32F103 MCU
Gateway – Folder contains (1) a modified version of I-CUBE-LRWAN for LoRa Discovery Board B-L072Z-LRWAN1 and (2) a Python program for Raspberry Pi
In part 2, we will talk about the details of the system. The system architecture, functionalities, block diagrams and logic diagrams of sensor node and gateway, online dashboard and alarm alert in Telegram will be mentioned. Also, a video will show how the system works and how amazing the performance of LoRa is.