Many u-blox customers build devices for location tracking, asset monitoring, logistics, and industrial IoT. Hence, it was natural for me to build an ML model that can be used in asset tracking use-cases. I decided to build a simple asset tracker that can identify if a package has been mishandled during transportation and record such incidents for insurance purposes.
Our demo is to be able to identify if something happened to a package when it is transported
Technical Block diagram
I used a simple Bosch IMU, BMI270, as a sensor for recording motion. ALMA-B216 (with the integrated NPU) was used as the host micro-controller unit. MAX-F11 was used as the low power GNSS solution to record the location and the time of an event. Any event is stored in the module’s non-volatile memory and can be read out over Bluetooth Low Energy at any point using a phone or a tablet.
Our setup should be capable of detecting 3 simple events
- Bumps against other objects
- Intentional violent shaking
- Accidental/Intentional drops
Block diagram of the demo setup
ALMA-B2 Evaluation Kit mounted with a BMI 270 for collecting accelerometer and gyroscope values
Data Collection
Like most ML models, the input data collection and clean-up step becomes the most important part of this setup. To collect data, I created a simple special application where I enabled the BMI270 at 800Hz. While the BMI270 also has 2KB FIFO for accelerometer, gyroscope, timestamps, and auxiliary sensor data, this initial demo used an application-level event capture path rather than a full FIFO-based implementation. The sensor values are stored in a ring buffer. Each event consists of 960 time-series sensor data where 500ms of pre-trigger data and 700ms of post trigger data is collected across 6 different channels (ax, ay, az, gx, gy, gz).
Each event was output as a serial block where a python script was used to convert this into a csv file for training
This raw time-series sensor data is transferred to a PC over serial UART. A python parser listened on the serial COM port, extracted event blocks, validated row counts, and generated a combined numeric CSV.
The data collection itself included dropping, bumping the EVK and violently shaking it 50 times each.
Data was collected 50 times for each event, cleaned up and converted into a CSV file
Training the model using Nordic Edge AI Lab
Nordic Edge AI Lab is a new web-based tool created by our partner Nordic Semiconductor to facilitate and simplify training Edge AI Lab. While the models can also be trained using other tools like Edge Impulse and Google’s Tensorflow Lite, I was curious to learn how the new tool from Nordic worked.
I started by creating a new multi-class classification solution in Nordic Edge AI Lab. During data preprocessing, I enabled signal processing and used windowing by number of rows. Since each captured event from my firmware contained 960 sensor samples, I configured the model with a 960-sample window and a 960-sample sliding shift for both training and inference. In simple terms, every prediction was based on one full captured motion event: about 1.2 seconds of accelerometer and gyroscope data sampled at 800 Hz.
Signal processing had to be enabled if the timeseries data was collected
I trained the same dataset using Nordic Edge AI Lab for both a compact Neuton CPU model and an Axon NPU-targeted model. This allowed me to evaluate the same sensor dataset across two deployment paths: running inference on the MCU core or accelerating it using the integrated NPU. Upon successful training, users can see a spider diagram explaining Model quality, Feature Importance Matrix and a Confusion Matrix and download the trained ML model.
Inference on the Edge
The trained ML model comes in a simple package that is plug-and-play compatible with Nordic’s nRF Connect SDK. I used Github Copilot and Nordic Semiconductor’s MCP client to simply adjust my data collection code to make sure that the sensor values were now used by the trained model for inference. And Voilà… the model worked great for my simple use case and could predict the class with decent probability on most occasions. Every time the model identified an event, ALMA-B2 turned on our latest low power MAX-F11 GNSS module, recorded the location and timestamp of that event and stored this information in the 2MB of onboard non-volatile memory. This information can be transferred from the tracker device to a smartphone or a tablet over Bluetooth LE at any point for tracking or insurance purposes.
Both the Neuton and Axon models work great for my simple use case
The ML events that were logged in the tracker can be read out wirelessly at any point in time
Other use-cases for the NPU
Even though the experiment itself was very simple, I was surprised by how quickly a semi-technical Product Manager, with zero experience in Edge AI/ML, could get this example running between meetings, customer calls and other product management tasks. We are now evaluating whether there are noticeable performance differences between running the model on the MCU and on the NPU. Our technology team has also started evaluating the NPU for other more complex use-cases like dead reckoning and predictive maintenance.