Edge Impulse logo
Blog Post

Go Take a Hike: Tracking Outdoor Activity with a Smart Jacket

Machine Learning, TinyML, Embedded DevicesThis Nicla Sense ME-based wearable device can measure both the environment and your outdoor activities using machine learning.

Nick Bild

November 27, 2022

    The allure of the great outdoors draws many thousands of people to trails, forests, deserts, and just about everywhere else for an occasional hike. For a sizable subset of those hikers, the fresh air, sunshine, and thrill of exploration prove to be addictive, and they get more serious about hiking. This dedicated group of adventurers plan longer, more difficult hikes, train to improve their endurance, and gear up with the latest in footwear, functional clothing, and electronic gadgets. Some of these electronic devices offer functionalities that can help a hiker to improve their athletic performance, stay safe, or just make the entire experience a bit more enjoyable in general.

    A recent partnership between clothing manufacturer K-Way and one of our favorite open source hardware manufacturers, Arduino, has led to the development of a smart jacket that could prove to be a hiker’s dream. A lightweight, waterproof K-Way jacket has been outfitted with an integrated Arduino Nicla Sense ME board in a custom, protective case. The tiny yet powerful Nicla Sense ME has enough computational horsepower to run machine learning models that have been optimized by Edge Impulse, which allow it to offer very advanced, intelligent functionalities. This board is also loaded with high-quality Bosch Sensortec sensors — an accelerometer, magnetometer, pressure sensor, environmental sensors, and more. And since low-power components were used in this Arduino board, the smart jacket can run for many hours between recharges.

    The Nicla Sense ME device attached to the K-Way jacket

    Rumor has it that when the engineering wizards at Zalmotek hit a mental block, they like to go for a walk to clear their minds and get the creativity flowing again. Perhaps it was during one of these walks that they came up with the idea to turn the Arduino-powered K-Way smart jacket into a hiker’s best friend. Whatever the genesis of the idea may have been, they collaborated with the Arduino team to focus on two main areas initially — predicting the weather and tracking wearer activity. These metrics can keep hikers out of a storm, and help them to understand how their athletic abilities progress over time. Recognizing the potential of this smart jacket, Arduino and Zalmotek also built in a third feature with the future in mind — a service that streams sensor data wirelessly to the Arduino IoT Cloud. This data could be used to build additional machine learning models, and applications, to update the device’s feature set as new ideas come to mind.

    Arduino Nicla Sense ME with rechargeable battery

    Changes in barometric pressure have long been known to influence the weather, so the team first set out to collect data from the Nicla Sense ME’s pressure sensor and correlate it with conditions of rising or falling barometric pressure, or with stable weather conditions. Using the Edge Impulse CLI, the Arduino was linked to an Edge Impulse Studio project, and data was automatically uploaded. Using the same approach, data was also collected from the accelerometer while walking, climbing, or staying still to be used in training an activity detection model.

    Exploring the training data in Edge Impulse Studio

    An impulse was created for the weather prediction model that started by slicing the pressure sensor data into windows, then performing a spectral analysis. The spectral analysis removes noise and extracts frequency and spectral power data. The preprocessed data was then forwarded into a neural network classifier that predicts if the weather is likely to be fair or take a turn for the worse. The model training process was started, and after a short time, a confusion matrix was displayed to help assess the model’s performance. The training accuracy was observed to be 100%, and that can be a sign of overfitting, so a more stringent test was performed using data that was not included in the training process. This test also showed an average classification accuracy of 100% had been achieved. This is a bit suspicious until taking a look at the Feature Explorer tool — the data for the classes is very well separated, so the observed accuracy does not appear to be unreasonable.

    Creating a weather prediction model

    A second impulse, very similar to the first, was created for activity prediction. In this case, incoming accelerometer measurements were divided into segments, then a spectral analysis was performed. The spectral features were fed into a neural network for classification. After training this model with the previously uploaded data, a classification accuracy of better than 98% was observed. This result was double-checked with the model testing tool which confirmed this excellent result with a 94% average classification accuracy.

    94% average classification accuracy

    The full machine learning classification pipelines were deployed to the physical smart jacket hardware, using the Edge Impulse Studio deployment tool, as Arduino libraries.  This deployment option offers the most flexibility, as one can code their own logic that is triggered by results from the model inferences. This could be as simple as flashing a LED, or the result could be wirelessly transmitted to a web dashboard for analytics. For the prototype, Zalmotek lit the onboard LED up green when fair weather was predicted to be on the way, or red when the near future was looking a bit stormier.

    Zalmotek also demonstrated how to connect the Nicla Sense ME to the Arduino IoT Cloud. It was as simple as creating an IoT Cloud account and flashing a sketch to the board. Then the sensors that you want to collect data from can be configured via a web application after the Arduino is paired with an external device, like a smartphone or computer, via Bluetooth Low Energy. The external device then forwards that data to the cloud over the internet. This is a simple way to build up datasets that can be used to train future machine learning algorithms with Edge Impulse.

    The K-Way/Arduino smart jacket is a natural platform choice for on-the-go devices, and Zalmotek showed just how easy it can be to build intelligent algorithms into that platform with the help of Edge Impulse. Before you zip up your jacket, zip on over to the project documentation to learn how you can bring your own creations to life.

    Want to see Edge Impulse in action? Schedule a demo today.  


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter