The idea was to take the food spoilage monitoring a step further, where we monitor the food, but also monitor the environment and take action as needed to prevent spoilage. In particular, potatoes were an intuitive choice because environmental factors like light can cause them to sprout, so something as simple as a light monitor could help keep them good longer. It also doesn't hurt that potatoes are delicious and yet somehow also nutritious and cheap, so they're pretty much guaranteed to be on hand.
The initial goal of the project was to monitor all these factors with the Thingy:53, as well as general potato spoilage, and categorize the results into groups with Edge Impulse.
To begin, they're serious when they say the Thingy:53 works out of the box with Edge Impulse. I messed around briefly with the nRF Programmer app, as I was considering an approach that involved repurposing their Matter weather station app, and found that the Thingy:53 comes pre-installed with Edge Impulse, which I appreciated. If that's not the case for you, or you want to try one of the other solutions, you can install one of the applications on your Thingy:53 with the nRF Programmer app by selecting the app you want, pressing install, and it'll take care of the rest.
Once you register an account (it's free), you can pull up the Edge Impulse phone app and Create a Project with the + button.
Switch your Thingy:53 on if it's not already and you should see an option appear in the Devices section. You can rename it. Then press connect once you've selected the device and you're ready to jump into data collection.
Your labels are how it categorizes the data later, so you want just a few easily differentiated labels. You get to choose whether it's Training or Testing data - my understanding is you want it to be an 80/20 split or so, respectively, and you do want to be getting data for both. You can move data from one category to the other later as well.
For this Potato Sentry project, we want to use the Environment + Light option for the sensor data. This monitors all sorts of useful aspects, such as temperature, humidity, and even pressure.
SayCheese
I had a potato that had greened that I was comparing to normal potatoes, and moldy red potatoes to compare with healthy red potatoes. Both sets struggled to differentiate the spoiled vs non-spoiled, so I did a quick tangential experiment with cheese. Cheese I could spoil to an extreme, where it was very clearly ridiculously moldy and getting compared to good, edible cheese. To really go for more of a contrast in results, I left the Thingy:53 in the bag with the moldy cheese overnight so that any gas it was trying to detect wouldn't be lost when I put it in. Even this resulted in indistinguishably similar data for the good vs moldy data in terms of gas numbers, which is what I needed in order to specifically identify spoiling food. As such, I pivoted into focusing exclusively on the environment.
To start, I setup a nice simple project that could tell if the environment was dark enough because, as mentioned, potatoes will sprout in the light. I took samples of pitch black and with the lights on in Edge Impulse and trained the model to identify light vs dark. These were easily differentiated and with a Flatten processing block and a Keras Classification learning block I was able to get 100% accuracy.
You could opt to deploy the project on the Thingy:53 by building the firmware into a zip file, but it's night and day (now identifiable for the Thingy) easier to just use the mobile app and press deploy. From there, you can inference with your device to get live readings.
Time to cue "Eye of the Tiger" - it's training time. This time I took Light + Environment data and focused on 4 groups. Light with no humidity, light with humidity, dark without humidity, and dark with humidity. I tried out many options and combinations for the Neural Network settings and architecture and ended up back with the Dense Layers and an increased number of training cycles. Once the model had decent accuracy, I deployed it on the Thingy:53.
And that was that! I could check on the state of the environment at any time by inferencing with the Thingy:53 and having it tell me the environment's current state.
Comments