This project has been developed in the context of the Keti International Hackathon.
https://www.keti.re.kr/eng/main/main.php
We would like to thank Keti and all organizers of the OneM2M Hackathon.
Our team is part of the bachelors technical degree called LP IOTIA from the IUT Côte d'Azur / University Nice Côte D'azur.
We also would like to express our gratitude to the University of Nice Côte D'azur and in particular our professor Ms Marie-Agnès Peraldi-Frati for giving us the opportunity to carry out our project.
1. Issue and IOT solution1.1. The Challenge:Forest fires are a big concern for the environment, they are simultaneous causes and consequences of global warming. Indeed, forest fires increase carbon dioxide levels in the atmosphere, contributing to the greenhouse effect and climate change. In addition, ashes destroy much of the nutrients and erode the soil, causing flooding and landslides.
Not to mention the lives and possessions that are lost each year due to the extreme blazes.
Preventing such fires is crucial to the environment and humanity.
1.2. Our Solution:Mapping out high-risk fire zones not only allows the public to evacuate in time but also allows the fire brigade to locate those areas and take preventive action (hosing, preventive burning when possible).
1.3. How it works:Battery-powered sensor nodes will be placed around the forest in a fire protective casing (protecting them from any fires, and preventing a forest fire in case of an electrical fire caused by the node), nailed the trees. When activated, these nodes will first send their GPS location which will then be deactivated to save battery as these nodes will not be moved once installed. They will then send temperature, humidity, wind and C02 values at regular intervals of 5 minutes to a nearby Gateway (Middle Node on OneM2m). Each gateway is registered on the infrastructure node in the main server. The data with then be treated by a nodejs server, calculating the fire danger index (FDI) and spread rate. The nodejs server will then send the GPS location of the sensor, the spread rate and the FDI to the mapping service (the front end part) for display.
1.4. Results:The final user load and interactive map where intuitive circles representing the zones at risk will be located. These zones will vary in colour and size depending on the spread rate and intensity of fire.The calculation of size and colour are based on the McArthur Mark 5 forest fire danger index, the exact calculations can be found on the following website :
https://wikifire.wsl.ch/tiki-index27fc.html?page=McArthur+Mark+5+forest+fire+danger+index
2. High-level software/hardware architectureThe following tools are required to run this demonstration:
- Arduino IDE 1.8.5 (To compile and upload code on sensor nodes)
- JAVA 1.8 (To run the OneM2m platform)
- OM2M 1.4.1 (implementation of the standard used in the project)
- NodeJS v14 or higher (To run the fire server)
- A MongoDB database for data persistency.
The necessary software resources are located in the git repository from the master branch :
https://github.com/diallorg/Projet-HackathonOneM2M2021
You will also need an implementation of the oneM2M v1.4.1 platform.
5. Hardware prerequisites for sensor nodesEither LoRa or Wi-Fi can be used for this project. The procedures to set up these nodes are detailed in the segments below.
Components:
- NodeMCU ESP8266 V0.9 for WiFi
- UCA LoRa board for LoRa
- DHT11 (IDUINO MODULE SE052) -----> PIN D3 (GPIO 0)
- Flame Sensor KY026 -----> PIN A0 (used for detection & alarm)
- Buzzer -----> PIN D6 (GPIO 12) (used for detection & alarm)
- Anemometer LEXCA003
- Cables
- Resistances
Connect the components following the wiring diagram of Fig2 :
The code is in the directory "sensor-node-wifi".
https://github.com/diallorg/Projet-HackathonOneM2M2021/tree/main/sensor-node-wifi
5.1.2.Download and install Arduino IDE
The installation of ESP is a classical one. For those who are not familier with arduino and for sake of simplicity of this project description, we propose to follow the procedure from section 5.2 to 5.8 of this Hackster.io project :
Otherwise the main steps are :
- Open Arduino IDE
- Arduino --> Preferences --> Search for "Additional Boards Mager URLs" : https://arduino.esp8266.com/stable/package_esp8266com_index.json
- Tools --> Board --> Board Manager --> Search for "ESP8266" --> Install
- Select in Board --> ESP8266 Boards --> NodeMCU 0.9
5.1.3. Run the sensorNodeWiFicode
- Open the file sensor-nodeV9.ino in the IDE
- In the code, replace the "ssid" and "password" variables with the ssid and the password of the wifi on which the mn-cse server is hosted. Upload the program to the ESP8266.
Functionality of this code
- Creation of the Application Entity SensorNodeWifi on the Gateway
- Creation of "temperature", "humidity", "flame-sensor", "wind" containers
- Creation of the Content instances in the associated containers,
- Every 5 secondes, the code Retrieve values from the sensor-nodes : DHT11 Humidity and Temperature, Anemometer, Flame Sensor (used for detection & alarm)
- Sending the data values to Middle-Node
- Creation of the Content Instance in "temperature" containing the value retrieved from the DHT11 temperature sensor.
- Creation of the Content Instance in "humidity" containing the value retrieved from the DHT11 humidity sensor.
- Creation of the "FIRE" Content Instance in "flame-sensor" if the value retrieved from the flame-sensor is less than 400, ie a flame is detected under 40 cm away from the sensor, and triggering of the buzzer. (used for detection & alarm)
5.2.1. Download the code from the GIT
The code is in the directory "sensor-node-lora".
https://github.com/diallorg/Projet-HackathonOneM2M2021/tree/main/sensor_node_lora
5.2.2Download and install Arduino IDEfor arduino Uno
Download Arduino version 1.8.9 and the DHT11 library
- Recover the DHT11 sensor, cables, and the UCA LoRa which will serve as Sender
Connect the components following the wiring diagram below:
- Check the Pin of the arduino code retrieved from the GIT so that it corresponds to the connect the pin.
- Configure the arduino IDE by following the procedure 5.1.2. with the folowing parameters :
Card type: Arduino Pro or Pro mini
Processor: ATMEGA 328P (3.3V 8MHz)
Port: The COM that you connected to the pc
- Download the Lora libraries *.h from /sensor-node-lora
5.1.3. Run the sensorNodeLoRasender code
- Open the the program sensor-node-lora.ino
- Upload and run the code on the UCA board.
- The LoRa node sends the REST request to the oneM2M platform over LoRa.
- An execution trace of data sent can be see on the TTY com port display of your computer
Functionality of this codeThe code in the wifi sensor node or the lora Node differs on the support for interacting with the onem2m platform.
In this case the LoRa node sends the REST request to the oneM2M platform over LoRa protocol. The rest of the code is indetic with the one of WiFi Node.
5.1.4. Run the sensorNodeLoRareceivercode
- Open the the program LoRaReceiverFinal.ino
- Upload and run the code on the UCA board.
- The LoRa node sends the REST request to the oneM2M platform over LoRa.
- An execution trace of data recieved can be see on the TTY com port display of your computer
The platform is composed of multiple gateways running on Raspberry Pi boards and infrastructure nodes running on a server. The installation of these nodes is explained in the following paragraph. The platform is based on the OM2M 1.4.1 software.
The infrastructure-node is the oneM2M infrastructure-node server that will show currently authenticated gateways (middle-node). The infrastructure-node server is hosted on a raspberry pi with raspbianOS.
6.1. Raspberry Pi SetupInstalling Raspbian OS with micro sd card flashed (https://www.raspberrypi.com/documentation/computers/getting-started.html#installing-the-operating-system).
Update all packages on Raspbian with the terminal (Ctrl + Alt + T) :
sudo apt-get update
sudo apt-get upgrade
- Connect the raspberry pi to your local network.
- The RPI must have an Ip address either a public one or in the same LAN that the server.
The code is in the directory "onem2m-platform".
The project contains the following folders:
- in-cse (the infrastructure node to be executed on the server or the RPI)
- mn-cse (the gateway on the RPi)
6.2.1. IN-CSE serverconfiguration on the RPI
- Copy the infrastructure-node (in-cse directory) on the raspberry pi.
- Edit the configuration file and sets the IP address of the raspberry as the cseBaseAddress in the /in-cse/win86/win86/configurations/config.ini :
org.eclipse.om2m.cseBaseAddress=XXX.XXX.XXX.XXX
- Go to /in-cse/win86/win86/ and enter the following command on a terminal (Ctrl + Alt + T) :
sudo bash ./start.sh
- Wait until the in-cse node has correctly started.
- Open a web browser and go to http://localhost:8080/webpage.
- The credentials are admin and admin.
- Press Login
You will see the resource tree of the IN-CSE.
For more information concerning IN-CSE configuration and run please refer to the following documentation:
https://wiki.eclipse.org/OM2M/one/Starting
6.2.2. MN-CSE gateways configuration on the RPIs
- Copy the middle-node (mn-cse directory) on the raspberry pi.
- Edit the configuration file and sets the IP address of the raspberry as the cseBaseAddress in the /in-cse/win86/win86/configurations/config.ini :
org.eclipse.om2m.cseRemoteAddress=IP address of the IN-CSE
org.eclipse.om2m.cseBaseAddress=IP address of the RPI that embedded MN-CSE
- Go to /mn-cse/win86/win86/ and enter the following command on a terminal (Ctrl + Alt + T) :
sudo bash ./start.sh
- Wait until the in-cse node has correctly started.
- Open a web browser and go to http://localhost:8282/webpage.
- The credentials are admin and admin.
- Press Login
You will see the resource tree of the MN-CSE.
From the IN-CSE side you will see a new resource MN-CSE in the resource tree.
For
more information concerning MN-CSE configuration and run please refer to the following documentation:
https://wiki.eclipse.org/OM2M/one/Starting
7. Fire ServerFire Server is a backend server developed in NodeJS with ExpressJS, the app establishes the relation between the front-end VueJS client-server and the Infrastructure Node. It also permits sending a text message if a fire is detected.
7.1. Prerequisites- .NodeJS and npm installed on the server (minimal version 11.15.0)
- MongoDB installed on the server (minimal version 4.4.10)
The code is in the directory "fire-server".
https://github.com/diallorg/Projet-HackathonOneM2M2021/tree/main/fire-server
Clone the Fire Server repo from the Git in the link,
7.3. FireServer configuration- go inside the folder /fire-server/middleware,
- set the configuration in the file /fire-server/middleware/config.jsInside the file comments are gicen indications which parameters must be modify
- Go to the /FireServer
- Run the Nodejs FireServer:
npm i
npm run start
When the server is started, the following functionnalities are launched:
7.5.1. Discovering
The app will look for all the Middle Nodes presents in the Infrastructure Node, and will store them in a database :
- The Middle Node,
- His Application Entites,
- His Containers.
See./middleware/discover.js.
7.5.2. Subscription
The app will subscribe to every container discovered previously according to all the sensors specified in middleware/config.js.
See./middleware/subscribe.js.
Each sensor will post on each corresponding file in./routes/inReceivers/ folder.
7.5.3. Listening
- After having subscribed, the app will listen for each subscription sector as, humidity, temperature, wind and flame.
See./routes/inReceivers.
- After receiving a request, the app will store in the database the new event, depending on what kind of data is transmitted, there can be additional events (e.g send SMS alert for fire).
- On the other hand, the app keeps a relation between the database and the Vue.JS client. The client will ask for fires, positions and fire hydrants and this app will just determine for e.g which fire should be displayed and returns the data.
See./routes.
8. Create an interactive MapThis application draws the different fire information onto the map by collecting data from the fire-server.
⚠️ You need to start a fire-server to use this.
8.1. Download the fire map from the GITThe code is in the directory "fire-map".
https://github.com/diallorg/Projet-HackathonOneM2M2021/tree/main/fire-map
Install node modules
npm install
8.1.1. Bind to fire-server
Edit the ip field of src/pages/index/App.vue to match with fire-server.
// fire-map server ip
ip: http://localhost:4000,
8.1.2. Compiles and hot-reloads for development
npm run serve
Open a web browser and enter the IP used in 8.1.1.
Comments