At long last, Blue Water Farm is generating revenue! Around 20 acres of our land consists of dense, mature hardwood of oak, maple, and beech, and we were able to contract to sell 65 maple and 25 oak trees to a logging company. I won’t be retiring from Akamai any time soon from our logging windfall, but it’s nice to see some revenue from our land, and clearing mature trees is a part of good responsible forest management.
The logging company marked the trees they want to harvest with spray paint around the tree trunk. This is good, as it lets us see which trees they were proposing to take before we agreed to sell them. However, as I was reviewing these marks, a problem occurred to me. How do I verify post-harvest that ONLY the marked trees were taken? After all, once the tree is gone, so is the mark. I trust my logging company, but how do I verify that extra trees weren’t taken, when all I’ll see is the remaining stump?
IOT Edge Connect and Node-RED to the rescue! While I could have shopped for a commercial product to fulfill my need, or even simply dropped a bunch of Google Map pins as I walked in the woods, there are benefits to building my own solution.
- I would like to avoid having to remove my gloves and operate my phone while in the woods. It tends to be cold this time of year, and it’s currently deer-hunting season in Michigan, meaning I’m motivated to limit my time in the woods lest I be accidentally shot. I’d prefer to mark tree locations by shaking my phone and generating dramatic accelerometer readings. Ideally, I could shake the phone along different axes (X, Y, Z) to mark different tree species.
- One big benefit of logging our woods is having the company blaze trails as they reach the trees being harvested. In addition to marking the trees, I want to record my track as I walk through the woods, mapping those new trails.
- Once I complete the timber-cruise, I’ll own a log of all the data, which I can then input into future logging projects, or work with in ways that I can’t imagine today. This is a general tactic in the world of Big Data: Capture more than what you need and put it on the shelf should an interesting insight arrive in the future.
- Message Queuing Telemetry Transport (MQTT) is a great protocol for this effort. Cell service in the woods is unsurprisingly weak and spotty. As I tested and implemented this solution, my MQTT connection never failed me, even when I was unable to load a simple web page.
Of course, the best reason for doing this myself is that it’s fun! This project is a great demonstration of how to build a useful, relevant application using Edge Connect.
Simple diagram of tree tracker application
As is the case with my previous demos, I am using Node-RED to build the client and analytics engine. Node-RED now has both iOS and Android ports, which allows for running a full Node-RED server on the device. This made writing a client-side mobile application for data collection a 10-minute effort.
Below is the Node-RED flow used on the client. Note: For clarity on the screen shot, I captured this on my iPad, though in practice I used my phone to run the collection tasks.
Node-RED for iOS has some handset-specific nodes, which allow for access to the phone’s location and gyroscope data. In the flow above, we are capturing that data, limiting it’s resolution to 1 message a second, and publishing the data to IOT Edge Connect via MQTT.
A common approach in IOT applications such as this is to make the client as simple as possible. More code and complexity means more battery and network usage, and it increases the chance that something on the client-side will need an update. We want a client application that uses as few resources as possible and won’t cause an expensive field update should something need to be changed.
This client application meets those goals — it’s a simple data dump every second of the gyroscope (X, Y, Z movement) and location (latitude, longitude, and altitude).
There are three things, for now, that I must do with this data in order to fulfill the needs of this solution.
- Log the inbound data from MQTT
- Analyze the data for those axis “shakes” so I can map the tree locations
- Map the data, including my walking track and the tree locations
Data logging flow
I am performing some data pre-processing at the server prior to logging, namely combining both location and gyroscope feeds into a single message. This will allow me to associate axis “shakes” (marking trees) with specific latitude/longitude/altitude coordinates. Again, I could potentially do this on the client, but it’s in my interest to keep the client lightweight.
Once combined, I write the data to a local log file, and also publish to Google Sheets for more robust storage and potential future analysis.
Data Analysis and Mapping
Analysis and mapping flow
I started this flow by reading the file I created in the data logging flow. I then replayed that data, looking for messages where the axis movement exceeded a threshold. When determining the appropriate threshold (to identify times that I was shaking my phone to mark a tree, as opposed to inadvertent shaking and movement), I was able to play with the values until I got an accurate mapping.
I then mapped both the overall track of movement through the woods, and specific tree locations. I used x-axis shakes to mark the location of maple trees, and y-axis shakes to mark oak trees. When I map these, I distinguish between oaks and maples via icon color.
Replay of the tree-tracker log file on the map
I have not yet compared my analysis result to the post-harvest stumps in our woods. So far, I am very happy with the logging, as my family now has miles of trails where none existed, allowing us countless hours of recreation and enjoyment. Plus, we can move in and out of the woods easier, allowing us to remove old dead trees and fallen timber for firewood. These types of maintenance activities are good for forest health, and will allow more trees to grow even larger.
Aerial view of our new trail network
Demonstrations such as this are useful in showing the promise and power of connecting the physical and digital worlds. Through IOT Edge Connect, Akamai can offer customers a walk-up, plug-in experience, allowing them to build their relevant applications, reliably, securely, and at scale. I will be using our land and Edge Connect for future applications to make my woods (and me) smarter.
Build Your Own!
Even if you don’t have a pending log harvest, using Edge Connect and Node-RED makes it easy to build something that is relevant to you or your customers.
Big lesson learned, loggers are different and wonderful people
*** This is a Security Bloggers Network syndicated blog from The Akamai Blog authored by Brian Apley. Read the original post at: http://feedproxy.google.com/~r/TheAkamaiBlog/~3/YLANqyjJ4rg/tree-tracker---auditing-a-log-harvest-using-iot-edge-connect-and-node-red.html