I have an air source heat pump at home that provides heating and cooling to individual rooms in my house. On the exterior of the house is the heat pump condenser, which circulates either hot or cold refrigerant depending on the mode you are using. Inside the condenser is a fan. If that fan were to stop working, or work sub-optimally, my heating and cooling would suffer (or not work!). Wouldn't it be cool to know if it were about to fail so you could have it serviced before it breaks? Well, with Edge Impulse and Arduino hardware, now you can!
For most of my hobby projects, I use Edge Impulse as much as I can for TinyML. 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!
My idea was to use the accelerometer data from the Opla kit to develop an Edge Impulse advanced anomaly detection model, save it as an Arduino library, integrate it into my Opla code, and then send the inference and anomaly data to the IOT cloud app. Easy right? :)
Well, at least creating the Edge Impulse model was pretty straight-forward. I wrote a quick sketch following the data forwarder example here, and connected the MKR Wifi to Edge Impulse to start reading accelerometer data. I had just two classes for the data collection: off and on. I did 5 minutes of data collection with the heat pump on, and 5 minutes of data collection with the heat pump off.
Above is the heat pump off and below is on. You can see the difference.
Once I had all my data collected, I followed the anomaly detection tutorial and used all the default values for the impulse. How easy is that?
I then trained the model and deployed it to an Arduino library.zip file. My project can be found on Edge Impulse here if you want to see it.
However, I first ran in to trouble when I tried to integrate the 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 that the screen 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.
After I made it through those issues, I had to learn the Arduino IOT Cloud interface. I had never used it before, so I had to learn how to create "Things", and then link those Things to the variables in the Arduino sketch. Overall, a good learning experience.
I developed a simple interface for the Arduino IOT Cloud: the state of the heat pump (Off/On), No Issues (True/False), and the anomaly score (float value). I used the Arduino Web Editor to develop a sketch that sends accelerometer data (x, y, z) to the Edge Impulse model and the model uses that data to determine if the heat pump is off or on. It also calculates an anomaly score to determine if the heat pump is behaving abnormally (ie vibrating more than usual). If the anomaly threshold is exceeded, No Issues turns to "False", and the LEDs on the Opla illuminate red. Time for maintenance!
This project was a lot of fun. I learned how to push through compile errors for an unofficial board to use an Edge Impulse model, and I learned how to use the Arduino IOT Cloud interface for the first time. I'm looking forward to trying additional projects in the future!












Comments