If you live in a cold climate, then you can appreciate having a boiler. It's a critical component to providing heat to your home. If your boiler breaks down, that means no heat. And you don't want to find out that your boiler doesn't work in the middle of winter. However, with predictive maintenance, your Opla IOT kit can monitor and determine if your boiler is behaving abnormally. How does it do this? With anomaly detection in Edge Impulse!
For most of my hobby projects, I use Edge Impulse as much as I can for my embedded machine learning projects. It's intuitive, powerful, and low-code. Even though the Arduino MKR Wifi board isn't officially supported by Edge Impulse, I thought this would be a good test of my skills using the Opla IOT kit for the Arduino #CloudGames2022!
For this project, I affixed the Opla IOT kit to the top of my boiler. The goal of this project was to log accelerometer data (from vibration of the boiler) with the Opla kit, pass it to an Edge Impulse model, determine the state of the boiler from the model inference, and pass the results of that inference to the Arduino IOT cloud. This is ideal because you are only passing metadata (the boiler state and anomaly value) and not the raw accelerometer data to the cloud, improving security and reducing bandwidth strain. Ideally, you want the accelerometer to be as close to the source of vibration as possible, but attaching the kit to the top of my boiler seemed to work well enough.
I started my project with data collection following this tutorial on advanced anomaly detection. I mounted the Opla kit to my boiler, connected it to my laptop, and created a new project in Edge Impulse. I wrote a quick sketch following the data forwarder example here, and connected the MKR Wifi board to Edge Impulse to start reading accelerometer data. I had just two classes for the data collection: off and on. I did 6 minutes of data collection with the boiler off, and 6 minutes of data collection with the boiler on.
Note the training/testing split in the top middle of the screen. You should be splitting up the collected data into a training and test set so you can validate your model. I did not do that in this case and will split the model data in the future.
Once the data was collected, I created an anomaly detection impulse:
Edge Impulse does a lot of the hard work for you, so I just accepted the default values and trained my model. Once the model was trained, I did a couple live classification tests, and then downloaded the model to an Arduino.zip file. I imported the library into Arduino Web Editor and then started testing out my code. See below for a couple videos!
The processing window is 2 seconds, and there is some latency in getting the status to the cloud, so it's not immediate, but within a couple seconds of when things change. Enough time to call your heating company for a tune up!
Initial SetbacksThis project wasn't without challenges. I first ran in to trouble when I tried to integrate the Edge Impulse model into the board. Because the MKR Wifi 1010 isn't officially supported, I ran into compile errors right off the bat. After several hours of search engine queries and message board questions, I had a solution in some simple #defines to clean up the compile errors. You can see those in the code in the definitions.h file. The second issue was the state of the Opla shield. I couldn't get the screen or 18650 battery didn't work on the Opla shield. I was also having issues reading the temperature data from the shield, which would cause frequent reboots of the board. Not ideal but it wasn't required for what I was doing. I was able to connect a battery directly to the MKR Wifi 1010 via the JST connector to get unplugged power to the kit.
Wrapping UpThis project was a lot of fun. As usual, there were some unexpected obstacles to overcome, but I'm happen with how the model and code performs with only 12 minutes of data collection. I could certain improve the model with additional data logged. Other future capability could include a text (via Twilio) if the anomaly threshold is triggered, as well as additional data in the IOT dashboard (with a functioning shield, haha). It would have been nice to see the temperature and humidity setting in real time from the dashboard as well. Perhaps if I get another shield I will give it a try. I hope you enjoyed reading this! Feel free to reach out with any questions.
Comments