Warehouse Shipment Monitoring using a Thunderboard Sense 2
A TinyML model using Edge Impulse and a SiLabs Thunderboard Sense 2 to monitor warehouse package handling with BLE.
Created By: Manivannan Sivan
Monitoring fragile objects during shipment require more time, care, labor effort, and infrastructure support.
In an ideal scenario, shipments would travel from the warehouse directly into the hands of the customer. However, that is not always the case. In between, a shipment / package will be handled many times, and you can’t always expect the people doing the transportation to handle them in a manner that will not lead to damage.
Here are a few challenges with logistics of fragile items:
- In a warehouse, storing fragile objects in the wrong position can damage the product.
- No real time monitoring of the shipments inside a warehouse about placement of products.
- Handling the shipment in the wrong position during transferring to the destination might cause damage to the product.
- Computer Vision-based shipment monitoring requires infrastructure to support it. For example, poor lightning conditions might affect the prediction.
I have created a TinyML model which can be attached to a fragile package and it tracks and predicts the position of the package, with the results communicated to a Mobile application through BLE.
For hardware, I have used the SiLabs Thunderboard Sense 2 and Edge Impulse to train the model and deploy it to the Thunderboard Sense 2.
The predicted result will be one of four categories:
- Correct position
- Incorrect position - Upside-down
- Incorrect position - Tilted forward
- Incorrect position - Tilted backward
Connect the Thunderboard Sense 2 board to the system and flash the firmware from this link:
Once it is flashed, run the below command:
Now the board is connected to your Edge Impulse account. Then place the hardware in a case, and attach it to the shipment package. In the below picture, you'll notice that the Thunderboard is placed inside the case and mounted on top of the package. Now collect the accelerometer data.
Now it’s time to collect the dataset for each of the categories.
Let’s assume the package with fragile object is orientated correctly. Place the Thunderboard on top of it, for data acquisition. Now start moving the package with this position, while data acquisition is running. Collect a dataset of around 2 minutes 30 seconds.
Turn the package over so that it is upside down, with the hardware still on it. Now start moving the package in this position, while data acquisition is running. Collect a dataset of around 2 minutes 30 seconds.
Turn the package on it's side, with the hardware still on it, facing forward. Now start moving the package in this position, while data acquisition is running. Collect a dataset of around 2 minutes 30 seconds.
Turn the package on it's side, with the hardware still on it, facing backward. Now start moving the package in this position, while data acquisition is running. Collect a dataset of around 2 minutes 30 seconds.
Back in the Studio, move approximately 30 seconds of data from each category to Test data. The Training and Test dataset ratio should be split about 80:20.
After data collection is completed, now go the Iimpulse settings and select Raw data in Processing. A Window size of 3000ms and Window increase of 500 ms is good.
The generated Feature map from the raw data should look similar to this:
In the Neural network training, I have used sequential layers with a Dense neural network layer and drop out of 0.1 to avoid the over fitting. I have chosen the learning rate as 0.0005 and 200 training cycles.
Upon completion, the training model Accuracy is 100%:
In the Model testing section, I have tested the trained model with the 30-second dataset that we set aside earlier for each category.
The trained model achieved 100% accuracy using the unseen testing data. This confirms the model performs great in predictions. Now the next stage is to test it in real use-case scenario.
For this, we need to deploy this model directly to the SiLabs Thunderboard Sense 2.
Go to the Deployment section, and select Firmware option "Thunderboard Sense 2". This will generate and download the firmware to your local system.
Once the firmware is downloaded, copy the
.binfile and paste it in the TB004 drive attached to your PC. This will flash the software onto the Thunderboard Sense 2 board.
Once it is flashed, Reset the board. Connect the 3v battery into it.
To test it out in a real scenario, download the "LightBlue" app from the iOS App Store or Google Play store. This app will be used to communicate to with the Thunderboard Sense 2.
Open the App and connect to the Edge Impulse service (Make sure board is powered on).
Input settings in the application:
- Subscribe to the
- Decode the message as UTF-8 (click on
HEXin the top right corner in LightBlue to switch).
- Place the package in different positions and start moving the package.
- The app will notify the Thunderboard.
Enable the "Listening" option in the app. You will be notified only when the previous prediction result differs from current prediction result.
For different positions of a shipment package, the predicted resulted is mentioned below.
We have seen that a TinyML-based model using accelerometer input will able to predict the placement / orientation of fragile shipments, to help avoid damage or monitor packages in a warehouse.