Australian wild summer is harsh for the animals and human. During the peak summer, the temperature raises up to 50-degree census which brings dry drought into the forest and bush lands. Along with these, regular bush-fire hits different parts of the continent. Bush-fires are frequent events in Australia during the warmer months of the year. Since 1851, more than 800 people have died, and billions of dollars of property damage have been caused by summertime bush-fires. To tackle the bush-fire season emergency, bush-land and forestland monitoring, government spend millions of dollars each year summer time. If we can have a system that can monitor forests and bush-lands, and can predict bush-fire zones, it can save many lives and the government can save millions of dollars every year.
In this project, I tried to develop an IoT solution which can collect various data of Australian bush-lands and forests, and can alert during bush-fire saturation. Data collected by this system is then pipe-lined to a machine learning platform where a predictive model is determining which parts of the forest or bush lands are vulnerable during summer. This project collects data for different variables such as temperature, air quality, soil dryness, animal movements, air pressure and lights of a specific point. This data is then pushed to Amazon machine learning model to predict forest or bush-land future conditions that can cause bush-fire or serious drought that can destroy the Australian forests. In the case of a bush-fire, this system sends immediate alert and SMS notifications and pass those data to machine learning model which helps the model to learn and compare the stages that can cause a bush-fire or drought. Though the model is designed to predict bush-fire and drought, this data can also be used for other models and predict other attributes of the forest such as alarming temperature change, abnormal number of animal presence and air quality decrease. So, we call it Forest Sense which creates a bridge between our environment and machines, and use machines to predict natural disaster such as bush-fire and drought to protect our nature.
Technology and ChallengesOnly a small part of Australia has mobile networks. That’s why to collect data using constrained devices such as various sensors for processing is difficult in most of the remote locations. Even where there is a mobile network, sending a GPRS data needs a considerable amount of energy, and most of the constrained devices do not have a direct electrical connection to do so. Though Telstra recently launched the CAT M1 network, this still needs costly subscription and registration process for large scale roll out along with proprietary device integration. Also, using high capacity batteries will increase the cost and recharging operational difficulties to send data over GPRS network. I chose the Sigfox network for these reasons. Sigfox has wide coverage in Australia now, and a Sigfox supported constrained device can run up to years with a single 9V battery. Sigfox managed this power saving communication sending less volume data to the network in low power network bandwidth. For monitoring natural attributes for this project, we do not need huge data transfer, and we need to install the Forest Sense devices to different parts of our forests to monitor the attributes where there are no electricity and mobile data connections. So, I found Sigfox low power network is the best fit for this project to make it commercially viable and government agencies can install thousands of our devices in forests and bush-lands to predict and prevent drought and bush-fire.
Microcontroller and SensorsI used an Arduino Uno microcontroller and Thinxtra Xkit which is a Sigfox supported development board as the backbone for this project. Xkit has built-in temperature, photo and accelerator meter sensors. Along with Xkit, I added Arduino Flame Detector Sensor Module, MQ135 Air QualityDetector Sensor Module, Duinotech Arduino Compatible Soil Moisture Sensor Module and XC4444 PIR Sensor module in this project. As Xkit shield sets over the Arduino Uno board, I used Duinotech Arduino Sensor Expansion shield to extend few available pins which are not used by Xkit.
Software Platform and ChallengesTo achieve the minimum viable(MVP) product for this project, I used the AWS platform for message publishing, data storage and AWS machine learning platform for using the predictive model. For client-side monitoring, I developed an AngularJS based web front end from the SDK provided by AWS IoT to subscribe the Sigfox MQTT messages from AWS IoT core. As the AWS machine learning platform is not available for Asia-Pacific region, I had to use AWS data Pipeline to push data to AWS S3 and then use that data to use for AWS machine learning. I used AWS DynamoDB for storing sensor data for future use. This data can also be used by other monitoring platforms such as AWS Athena. I did not implement it here as I already have developed my own monitoring web application for this project.
Putting Them All TogetherPrepared all the parts required for this project. Arduino Uno board, Duinotech Arduino sensor expansion shield, Thinxtra Sigfox dev kit (Xkit) and sensors.
Added Duinotech Arduino sensor expansion shield with Arduino Uno board. Thinxtra Xkit uses most of the general purpose input output pins of Arduino Uno. I used A0, A2, A3 and Digital Pin 4 for four sensors to communicate with Arduino board.
As all the pins of the sensor expansion shield do not connect with Arduino board, to connect Xkit pins with Arduino Uno over sensor expansion shield, I added some wire connection from Xkit to Arduino Uno and the added Thinxtra Xkit with the sensor expansion board.
Then I modified the code provided by Thinxtra to communicate with the sensors and send data to Sigfox network. Flashing codes to Arduino Uno with Xkit, the P9 pins need to be removed and once the code is uploaded, added the pins. Easy installation and coding guide with Thinkxra xkit is available here. For technical issues and support, I found Thinxtra are really responsive and come forward with suggestions and solutions.
Once the code is uploaded, (I have attached the code here with this project), Forest Sense (my product brand here) starts sending data to Sigfox network. It sends data in every 10 mins, but in case of an emergency such as fire detected, it sends immediate data to Sigfox network and then waits 5 seconds to avoid any false alarm. If the fire exists after five seconds it sends the alarm again and then stops sending data. For motions, it counts total motions detected by animals, birds or human around it and send the total count with the regular 10 mins interval message. Each time it sends count, the count sets to zero to start counting again. As in many cases, the bush-fire starts by human activity for their negligence, the count can help the machine learning model to predict the bush-fire. It also can be triggered by the model when the number of counts is more than usual identifying an abnormal number of animal and birds movement. The gas sensor observes air quality and presence of CO2 or CO can be identified by the Machine Learning model on future enhancement. I have not implemented the gas type identification in this project. This project only shows the air quality in the monitoring screen that I have developed for this project. Code for the monitoring project is also added here (AWS authentication data not included, to run the code just need to add AWS parameters to the app.js file).
Once the Sigfox network gets the data it publishes the data to AWS IoT core through a Cloud Formation Stack. Instructions how to add AWS IoT core is available here.
I have configured the Sigfox callback properly to publish exact 12 bytes of data and when ever there is a fire event, it sends all to zero except the temperature value to ‘03’ to indicate that this is a fire event.
My setup payload config: temp::uint:16:little-endian pressure::uint:16:little-endianphoto::uint:16:little-endian air::uint:16:little-endianmoisture::uint:16:little-endian motion::uint:16:little-endian
And JSON body:
{
"device" : "{device}",
"data" : "{data}",
"time" : "{time}",
"snr" : "{snr}",
"station" : "{station}",
"temp": {customData#temp},
"pressure": {customData#pressure},
"photo": {customData#photo},
"air":{customData#air},
"moisture":{customData#moisture},
"motion":{customData#motion},
"lat" : "{lat}",
"lng" : "{lng}",
"rssi" : "{rssi}",
"seqNumber" :"{seqNumber}"
}
I have configured the callback with AWS IoT core below way. (no down link)
Once Sigfox start publishing the data to AWS MQTT pub-sub, we can monitor the activity from the AWS IoT core console:
We also then can monitor the data in our Forest Sense application that I have developed from the AWS IoT to MQTT subscriber sample code using MQTT PAHO libraries for AngularJS. This simple AngularJS built monitoring tool is a MQTT subscriber of AWS MQTT pub-sub and can show the status of forest each time the Forest Sense sends data to Sigfox network.
Code for the whole project of this monitoring tool available here. A screen sample of the custom monitoring tool below:
The code is on the GitHub. Some simple tweak in AWS authentication part can make this one running for anyone. Just have to add the AWS authentication keys in app.js file, AppController.prototype.createClient anonymous function as below:
The device also sends emergency payload in case of a fire event. All the sensors sends data as 0 and only temperature value sends as "03" to trigger it as a fire event.
Such as when the fire comes close, the device sends data to Sigfox network and we can monitor it from our client front end:
Forest Sense also sends a SMS notification to the configured mobile number through AWS SNS notification when there is a fire event. It sends the JSON data published by Sigfox to AWS IoT core. By future enhancement, a mobile application will be developed to parse these JSON SMS content.
For AWS IoT Core rules, I have setup 2 rules. One for sending SMS on fire event with a AWS SNS service and another one for adding data to DynamoDB.
The ForestSenseSNS rule only works when the temperature event value is 3 and other variable values are 0 (zero).
For ForestSenseData rule, I setup two activities. One for adding the data to DynamoDB table and one to push data to AWS Athena through Kinesis Stream. I am not going to describe the AWS Athena module here as this will be implemented on future entrenchment for reporting. I also added an error log to S3 for error identifications.
Once both the rules are setup and active, when Forest Sense sends data to AWS IoT core through Sigfox AWS integration, it inserts data to the designated DynamoDB table:
Then I configured our data pipe line to push this data to S3. I configured to push the data one in a day, in JSON format. I have added the pipe line definition as JSON code with this project.
Configuration of data pipe line as below:
Once this pipeline is activated and finish, a file will be placed on S3 bucket.
All these things I had to do because AWS Machine learning is not available for Asia Pacific (Sydney) zone. I did not consider selecting ASW IoT core initially on a different region as this project as I considered this project to be implemented by the Government agencies to predict and prevent fire and drought and the Government legislation needs the data to be resides in Australia not on other zones. I have contacted with AWS regarding these and they are going to launch the AWS Machine Learning in this zone soon. I used US East (N.Virginia) zone to test our model here.
Once we have the data to S3 bucket, now I can configure our Machine Learning model.
And I set it as batch model to pick the file each day from the S3 location to train the model for better prediction and set the target field Temperature as when there is a fire, our device sends data as “03” in the temperature field.
Still the model is working with test data and predictions are not accurate, but once we will get live data, the Model can predict more accurately. I ran few real time predictions on Temperature field and found the result close to the actual value. Below I am showing one prediction evaluation where the predicted temperature shows 21.17 degree Celsius and I waited to see the actual temperature from our device and it was 21.94 degree Celsius.
Still the prediction is not accurate, but eventually once the model gets more real time data, it will predict close events such as Fire or drought.
Future ImprovementsI am planning to train this machine learning model with more devices and collect data from different time of the year. Once the model get enough data to predict any fire or other natural event such as heat wave, we would be able to prevent it or take require precautions to save Australian bush-lands, forests and habitats. Other planned enhancements includes using AWS Athena to create a reporting dashboard. The Kinesis service already providing data for the dashboard, developing an interactive dashboard will be easy with this data. Detecting harmful gases by the AWS Machine Learning model is also under development from the data collected by the Gas Sensor of Forest Sense. Additionally, I am planning to develop a mobile app for fire event notification reading which will include pop-up message when mobile gets the SMS notification for fire event by AWS SNS. An all weatherproof enclosed box is under development which will allow Forest Sense device to install on tree branches and wet bush-lands.
Comments