|
Arduino Web Editor |
|
|
Sigfox |
|
|
Microsoft Azure |
|
|
Microsoft Power Bi |
|
|
3D Printer (generic) |
Senso (Identification of Ilegal Logging)
Abstract
Figure 1: The Senso device attached to a tree
People are always told to recycle and turn off the tap while they’re brushing their teeth, however, little is said to us when it comes to preventing the active termination of our oxygen supply. Even as we are wavering on the precipice of disaster, there are still those who unlawfully endanger the rest of humanity through their wrongdoing.
Illegal logging is a major threat to the world’s forests, and to the biodiversity and the people they support. This activity destroys wildlife habitats, increases greenhouse-gas emissions and depletes the natural resources that more than a billion of the world’s poorest people depend on.
Illegal logging scars not only the forests it infests, but also their people. It siphons the economic livelihood of local communities and responsible companies. There is another cost too, lost revenue that may have been generated from legal logging of forests. When trees are cut without the right permits and are smuggled abroad, governments lose out financially in several ways, including lost revenue from taxes and duties and the costs of efforts to manage illegal logging.
The World Bank states that the annual global market loses US$10 billion annually from illegal logging, with governments losing an additional US$5 billion in revenues and according to the WFF, illegal logging accounts for 15-30% of global forest production, with a turnover valued at $30-100 billion. In key tropical countries the rate is higher, with an estimated 50-90% of forest products by volume sourced illegally.
Existing solutions implemented by governmental authorities attempt to fight illegal logging through preventative measures, including signage indicating boundaries, gates lining access roads, and checkpoint locations. However, these methods are expensive and take a bit of time to implement (not to mention that signage will most likely not deter most illegal loggers).
My solution aims to help tackle the problem of illegal logging. Senso is a low-energy device equipped with a module which isolates and analyses different frequencies of sound to identify the sound of logging machinery. The device is designed to send an alert to the authorities should logging machinery be detected through the low-power SigFox network. Authorities also receive a Power Bi report at set time intervals; this is delivered in a dashboard format and showcases the location and battery levels of each Senso device in a network.
Senso is unique in its low-energy requirements and continuous reporting of data to authorities. This allows Senso to be introduced as a low-maintenance, and therefore low-cost, preventative measure to ward off illegal loggers. If many Senso devices are implemented, they can also be easily scaled thanks to the powerful capabilities of Azure IoT Hub.
Due to its low maintenance requirements and high expansion potential, I believe that Senso can be widely implemented by governments and local authorities anywhere in the world. These authorities will have the power to quickly take action whenever suspicious activity is reported by Senso.
The cost of deployment for a Senso device is illustrated in table 1.
Table 1: Cost of deployment for one Senso device
The monthly cost of maintenance for a Senso device is illustrated in table 2.
Table 2: Monthly cost of maintenance of one Senso device
Project Architecture
Figure 2: Project architecture
This section will cover the functionality and processes of the project.
Senso continuously monitors sound frequencies to isolate patterns emitted by illegal logging machinery. A report containing the device’s battery level and GPS location is transmitted every fifteen minutes once illegal logging machinery has been detected.
The project architecture is split into a frontend and a backend (figure 2). The frontend involves the device in the field taking sound samples; while the backend consists of SigFox, Azure and Power Bi, which process and display this data.
Frontend Architecture
The device wakes from deep sleep at defined intervals of time, it then samples the audio analyser module searching for the presence of specific frequencies in certain patterns. The device then checks if these samples match the frequencies at which chainsaws and similar machinery operate using a mathematical calculation.
If the samples are a positive match when compared to machinery, the device will send its current location and battery level to the backend. The device will then go to sleep for a defined time.
Microcontroller – Arduino MKR FOX
The Arduino MKR Fox is the microcontroller used in the project. The device is an Arduino board from the MKR family. These boards focus on a small form factor and great battery life while maintaining the same performance available on other boards. The device operates at 3.3v as opposed to 5 volts which reduces power consumption. The processor is also equipped with a low power mode that allows it to hibernate for set periods of time. This also improves the battery life significantly.
The Arduino MKR Fox has Sigfox connectivity built in. This allows the device to connect to the Sigfox network and send small data parcels to the backend. Sigfox defines a communication protocol that allows devices to send very small data packets over the Sigfox radio infrastructure. This reduces battery consumption drastically as the packets sent are under 12 bytes and communication is unidirectional meaning that energy can be conserved through this means as well.
Battery Life
The device was constructed with longevity and extended battery life in mind. This is important with a project like this as it would not be convenient to constantly have to change the batteries.
The MKR Fox can last for approximately a month on two AA batteries. The Sigfox communication protocol increases the battery life significantly because it allows for the sending of very small, 12 byte, data packages meaning that the device does not need to send or receive large amounts of data. The battery life could be extended by powering the device with a power bank if desired.
Backend Architecture
Figure 3: Backend architecture
As previously mentioned, the device will send a message to the SigFox backend should logging be detected. When an event is received by the SigFox backend, it is forwarded to Azure IoT Hub through a callback function. Azure IoT Hub then assigns the data to a hub, a data streaming service queries the data periodically, and afterwards inserts it into a Power Bi dataset. Finally, Power Bi extracts the data from the dataset creating a report. All the data is then displayed on a dashboard accessible to the authorities.
Dashboard
Figure 4: Dashboard displaying Senso report
The data received by Sigfox is forwarded to Azure IoT Hub. Here, the data is queried periodically by a live streaming job, and is inserted into a Power Bi dataset. The Power Bi report (figure 4) is created from this data.
The red circles visible on the dashboard represent the locations of Senso devices, this can help local authorities know where illegal logging is happening and react accordingly. The dashboard also provides authorities with the battery life of each Senso device, this can help them determine which devices require maintenance.
Sigfox Connectivity
The Arduino MKR Fox has built-in Sigfox connectivity through an onboard Sigfox module. This enables the device to connect to the backend with ease. Sigfox is a communications company that aims to create infrastructure that helps low power IoT devices send small packets of data through the infrastructure and then link custom web apps to perform actions with the data in the backend.
I chose to use Sigfox connectivity because it is a low power protocol and small packet sizes are perfect for the project. Using other protocols such as GSM or WiFi would require more power and are better suited for devices sending more data.
Messages sent by devices through the Sigfox network are centralised in their server. This data is accessible through the online portal. Sigfox allows for callbacks to be implemented, these essentially allow other applications such as a mailing service or a cloud service provider such as AWS to be integrated in the backend.
Azure IoT Hub Hub
All the data that is sent to the backend is received by the Azure IoT Hub Hub. This acts as a gateway for sending data from an IoT device to Azure Cloud. The service allows devices to be authenticated and then saves the data streamed temporarily.
Stream Analytics Job
This is a glue service provided by Azure. It is separate from the IoT Hub. This service runs all the time and periodically checks to see if there is new data present in the IoT Hub. Whenever the device sends data to the hub, it takes a couple of seconds for the job to detect the new data. When this happens, the job will extract the data from the IoT Hub and inject it into a Power Bi Dataset.
Power Bi
This is the last stop for the data. Power Bi allows us to create a dashboard which can be populated with the data injected by the job into the dataset. Whenever a user opens the dashboard on any device, it will refresh the data and display the newest data from the dataset. On average it takes about 30 seconds to a minute for the data to get from the device to the dashboard.
Making the Project
This section will talk about the steps needed to construct the project from start to finish and everything needed to construct it.
Please note that before starting to build the project, it is essential to check if your country is currently covered by Sigfox on their coverage map.
Step 1: Required Apparatus
The BOM above details the parts necessary for the project. The components are shown in figure 5.
Figure 5: Components necessary to construct the project
Step 2: Connecting the Circuit
The next step is to connect the circuit; the circuit diagram in figure 6 will illustrated how this is done. The schematics are attached.
Figure 6: Circuit schematics
The following steps describe how to connect the circuit:
- First, connect the antenna to the MKR FOX.
- Place the power supply on the breadboard, making sure that one of the terminals is set to 3.3V and the other to 5V.
- Connect the VIN and GND on the MKR FOX to the breadboard.
- Attach the battery to the power supply.
The finished wiring should look like that in figure 7.
Figure 7: Completed wiring
Step 3: Acknowledging the Code
The code is split into 3 main sections, each of these is described below.
Get and Process Sound
This section of code is executed when the device wakes up. The device will first take the samples of data from the sound sensor and will then process the data by comparing the value of the target frequency to the other frequencies. This is done in the following lines of code.
long comparison = ((valueMean[0] + valueMean[1] + valueMean[2] + valueMean[3]) / 1.9); if(valueMean[5] > comparison)
The mean of all bands except for the target one are added and divided by 1.9. If the value of the target band is bigger than the comparison, the sample is positive.
Get GPS and Battery
These functions extract the GPS co-ordinates from the module and verify that they are correct. They then get the battery voltage of the attached battery (if a battery is directly attached to the device).
Note that if the device is powered through VIN the battery voltage will be equal to 0 - the device must be powered through the terminals to display the voltage. To do this, connect the power pins on the breadboard to the terminals on the device.
Send Data to SigFox
These functions will encode the data in byte format and will then send it to the SigFox backend.
Setting up the Variables
There are two variables that have to be edited.
- proDebug must be set to true if debugging. The device will need a serial connection and the serial monitor open to run the code if set to true. Set to false otherwise.
- nrSamples will define the number of samples to take. Each sample consists of 100 readings.
Step 5: The Modules
I am using a cheap GPS module I found on Amazon for €15. Although it is easy to use, it takes a while to receive a signal from satellites. A higher quality antenna is necessary in a real implementation.
The focus of this section is the audio analyser module from DF Robot. Essentially, it collects the sound level of the 7 most prominent frequencies: 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz. After rigorous testing I was able to identify that a chainsaw was typically in the 2.5kHz 6.25kHz range. When testing with the sensor, the 6.25kHz band would spike up when playing the sound of a chainsaw.
I was then able to come up with a calculation that would prevent other machinery such as cars and natural sounds from being recognised as a chainsaw. Although not perfect, it does a great job at rejecting similar sounds.
Figure 8: Sound testing - the spikes show chainsaw activity
Step 6: Preparing Azure
This project will use Microsoft Azure in the backend. I am aware that most people will prefer AWS but honestly, I am a fan of Azure.
To be able to continue with this project you must set up an Azure account, you can do so here. After you’ve set it up, the next step is to get an Azure subscription. Finally, this guide by Microsoft will help you get a basic understanding of Azure.
This step will go through setting up the account and the IoT hub that will store our data received from the device.
- Open the portal and sign in
- Navigate to the “Resource Groups” option in the menu on the left of the screen
- Click on the add button to add a new resource
- Select the name and region of the resource and click “Review and Create”
- Click on “Create” and wait for the resource to create
- Navigate to your dashboard using the menu on the left, we will be using the dashboard to pin widgets for quick access
- Create a new dashboard by clicking the “+” button at the top of the screen
- Select the “Create a Resource” button from the menu on the left and search for “IoT hub”
- Click on the “Create” button
- Give your hub a name, set the resource group to the one created earlier, and click next
- Set the tier to “Free Tier” (premium features are not required) and click “Review”
- Click “create” and wait for deployment (this can take around five minutes), note that you only have one IoT hub per account
- Once the deployment has succeeded go to the hub and find the “Shared Access Policies” option in the menu in the left and select it
- Click on the “iothubowner” policy and copy your connection string (you will need this for setting up Sigfox)
Figure 9: IoT hub set up and connection string about to be copied
Step 7: Preparing SigFox
Next, we need to prepare the SigFox callback, for this there are a couple of prerequisites. First, you should create a Sigfox backend account here. Then, you’ll need to register your device in the Sigfox backend, a guide for doing this can be found here.
Figure 10: Pasted connection string
- Open the Sigfox portal and navigate to “Device Type” at the top of the window
- Select the “Callbacks” option in the left menu
- Click on the “New” button in the top right corner of the screen
- Scroll down and select the “Microsoft Azue IoT Hub” option
- Fill in the fields with the values below:
- Enter this into the “cutom-data-config” field:
geoLat::float:32:little-endian geoLng::float:32:little-endian battery::float:32:little-endian
- Paste the connection string you copied from Microsoft Azure in the second field.
- Next we want to fill the “JSON body” of the message with the following data:
{
"device" : "{device}",
"data" : "{data}",
"latitude" : {customData#geoLat},
"longitude" : {customData#geoLng},
"battery" : {customData#battery},
"time" : {time},
"duplicate" : {duplicate},
"snr" : {snr},
"station" : "{station}",
"avgSignal" : {avgSnr},
"lat" : {lat},
"lng" : {lng},
"rssi" : {rssi},
"seqNumber" : {seqNumber}
}
This defines the values that we want to send on to Azure.
- Press “Ok” and go back to your IoT Hub
- Scroll down and add the graphs (figure 11) to your dashboard by pressing the “Pin” button
Figure 11: Graphs pinned in Micrsosoft Azure
Step 8: Stream Analytics Setup
The next step is to set up the job that will query data from the IoT hub and push it into a Power Bi dataset. The following steps describe this process:
- Go back to your Azure portal and create a new resource by clicking the option in the menu on the left of the screen
- Search for “Stream Analytics job” and create a job
- Give it a name and place it in the resource group
- Set the “Streaming units” to one and create, you will be redirected to your job after its deployment
- Scroll down on the menu on the left and select the “Inputs” option
- Click on “Add stream input” and select “IoT Hub”
- Give it a name and select the IoT hub from your hubs
- Add it and wait for the testing to complete
- Navigate to “Outputs”, click on “Add” and then “Power Bi”
- Enter a name and name your dataset and table
- Click on “Authenticate” and sign in with your account again
- After you have authenticated, a message will pop up, click on “Save”
- Once the output has been deployed, go back to the “Overview” tab and click on the “Edit Query” button above the query
- Input the query below and click “Save”:
SELECT
latitude as latitude,
longitude as longitude,
battery as battery,
System.Timestamp AS Timestamp
INTO
[OutputToPowerBI]
FROM
[InputFromIOTHub]
Figure 12: Setup once query has been inputted
- Go back to the “Overview”, scroll down, and add the graphs to the dashboard (my dashboard can be seen below)
Figure 13: My stream analytics dashboard
- Click on the “Start” button to begin the job
Note that if the job isn’t closed after testing it will charge you per hour of usage.
Step 9: Upload Code
Now we have to upload the code to test the connection. Ensure that the stream analytics job is running and then upload the code to the device. A GitHub repository for the project is attached below.
Simulate a chainsaw sound on your phone to make the device send an event to the cloud. You should see the graphs on your dashboard shifting after the data has been sent. This indicates that the data is received and you can move on.
In the event that the data is not plotted on any of the graphs, you should start debugging with the Sigfox backend and then work your way towards Azure.
Step 10: Setting Up Power Bi
We will now set up Power Bi, this can be done by purchasing a Power Bi subscription directly here, or by purchasing a Microsoft 365 E5 account here (Power Bi is included among other services).
The following steps will walk you through setting up Power Bi:
- Navigate to Power Bi on the Office Online app
- You should see a dataset called “Senso” automatically available for you, if you don’t, see the troubleshooting tips in the previous step
- Click on the report and add a table from the widgets on the right
- Click on all the data to display it on the table, ensure that all the data is there
- Click on “My Workspace” on the left
- Click on “Create and Report” in the top right corner
- Click the data you want to use and click on “Create”
- You will be directed to a new page, click on the “Map” widget
- Drag the latitude and longitude coordinates onto the fields on the map
- Change the colour and bubble size if you wish
- Select an “Area Chart”
- Add it to the report and select the battery and timestamp fields as data
- Don’t forget to save your report
Figure 14: Power Bi report
Step 11: Enclosure
Now that we have finished setting up the application, we need to create an enclosure for the project. I have decided to tie the device to a tree and camouflage it to catch the loggers by surprise. Make sure to have the microphone outside the enclosure so it can pick up the sounds. My enclosure can be seen in figure 15.
Figure 15: My enclosure
Conclusion
Senso aims to disrupt the operations of illegal loggers by isolating the sound of machinery in order to inform relevant authorities. This project leverages the MKR GSM together with an antenna in order to detect sound frequencies similar to logging machinery and collect GPS data. This data is sent to the Sigfox network and is then forwarded to Azure IoT Hub. A streaming job inserts this data at set periods of time into a Power Bi dataset, which uses it to compile a dashboard report of all registered Senso devices. Local authorities can use this data to act rapidly when illegal logging is suspected.
I was inspired to create this project when I heard from my friend Rabocse, who lives in Brazil, about the high levels of illegal logging in his country. I was truly shocked that this is such a big issue and wanted to do anything I could to help out. I hope that authorities in charge of forest protection implement Senso to help them better their defence against illegal logging.
Senso (Identification of Ilegal Logging)
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Andrei Florian
- PhoneLocator AbstractFigure 1: PhoneLocator’s instant responseHave you ever forgotten your phone in your friend's...
- SmartWristband Abstract Figure 1: The SmartWristband device being worn Monitor patients sent to self-isolate with t...
- Senso (Identification of Ilegal Logging) AbstractFigure 1: The Senso device attached to a treePeople are always told to recycle and turn off ...
- SmartWay (Geolocation Monitoring) AbstractFigure 1: The SmartWay device attached to the child's bag is glowing orange (meaning they ha...
- FlowerPot Monitor Abstract Growing and maintaining a flower or plant can be difficult. It takes time, dedication and c...
- Monitemp (Monitor Temperature And Humidity) AbstractFigure 1: A Monitemp device Not everyone has a thermostat in their home, and even if they do...
- SmartPostBox AbstractFigure 1: Post box powered by SmartPostBox Figure 1: Post box powered by SmartPostBox SmartP...
- MyPulse (Heart Rate and SpO2 Sensor) Abstract Now-a-days so many of us wear an array of sensors on our wrist all the time, keeping track ...
- CityGuide (Digital Tour Guide) AbstractCityGuide is a digital tour guide application which allows people to sightsee throughout a c...
- IntlAir (Air Quality Monitoring and Automatic Purification) Project Overview People spend most of their day at home, they wake up, go to work, then come back an...
- UnifiedWater AbstractFigure 1: UnifiedWater device being held above canal Yearly, over 8 billion tonnes of plasti...
-
-
Helium IoT Network Sensor Development board | H2S-Dev V1.2
110 0 0 -
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
181 1 1