Edge Impulse logo
Blog Post

This Thingy Will Keep Your Motor Running

TinyML, Machine LearningUse an Edge Impulse model running on the Nordic Thingy:91 to sense vibrations and classify them to detect different types of hard to spot motor defects.

Nick Bild

May 31, 2022

    It is easy to forget just how reliant we are on electricity in our everyday lives until the power goes out. Heating and cooling systems stop working, flipping the light switch has no effect, and the Internet connection goes down. Without our usual comforts, entertainment, and connection to the outside world, minutes can feel like hours. And it is not all about comforts; in some regions, heating and cooling are much more of a necessity than a comfort. Further, many rely on electric medical devices, and losing power can create a life threatening situation. As if all of this was not enough, the cost to businesses is staggering — the US Department of Energy has estimated that power outages cost the US economy $150 billion annually.

    Clearly we need to minimize the number, and duration, of power outages to prevent the myriad ill effects they cause. Methods that allow a quick response to outages help a great deal; the less down time, the better. But the ideal situation is one in which problems are detected before they occur, such that they can be addressed before an outage ever happens. That was the problem that engineer Tai-Min set out to solve, and he created a fantastic project that shows how problems with electric motors can be spotted before they cause failures. He did this using a powerful edge computing platform and a machine learning classification pipeline developed with Edge Impulse.

    The test bench

    Before Tai-Min could create the motor defect classification platform, he first needed to build a test bench. This consisted of two powerful DC motors — one motor served as the generator (this is the one that will be monitored), and the other was connected shaft-to-shaft with the generator to act as an artificial load, and to simulate certain types of motor defects (e.g. stalled shaft, faulty bearing). An Arduino Uno and a Monster Motor Shield were used to drive the motors. An optical encoder and a weak servo were included in the design to simulate shock pulses and vibrations, which are known to indicate other types of motor defects. Tai-Min then developed a simple user interface in Python with PyQt5 to allow him to tweak the parameters of the actuators to set up different simulated scenarios involving motor defects or normal operation.

    Dashboard to control the test bench

    With this test bench complete, the next step was to build the defect classifier. For hardware, a Nordic Thingy:91 prototyping platform was chosen. It comes packed with features, including a 64 MHz Arm Cortex-M33 CPU, 1 MB of flash memory, and 256 KB of RAM to run inferences against machine learning models. It is also loaded with sensors and wireless communications options — low-power and high-g accelerometers, Bluetooth Low Energy, and LTE connectivity. Tai-Min attached the Thingy:91 to the generator motor, and used the onboard ADXL372 high g accelerometer to acquire signals, one measurement every 400 microseconds.

    Neural network classification pipeline

    256 consecutive samples are captured for analysis, with a 128-sample sliding window. A preprocessing pipeline conditions the signal by passing it through a high pass filter to remove small, low frequency movements. Next, a Fast Fourier Transform was applied to the signal to separate it into various frequencies. The final step in the preprocessing pipeline was a principal component analysis, which reduced the dimensionality of the data and identified the most important aspects of the signal — both of which improve the performance of the machine learning model that this data is next fed into.

    A neural network classifier was built and trained using the Edge Impulse platform. After uploading data collected with the test bench, the model was trained to recognize four classes (bearing fault, motor running, motor stopped, and motor throttle). A classification accuracy of 81.4% was observed after running 150 training cycles. Using the deployment tools, Tai-Min exported the classification pipeline as a C++ library that could easily be included in the Thingy:91’s source code. When the finished device detects the presence of a motor defect, it will send an MQTT message wirelessly over LTE.

    Performance of the trained model

    It is easy to imagine a large network of devices like this proactively monitoring motors. By pushing out notifications before problems occur, engineers can be sent to make repairs or replace components that are nearing end of life before failures actually occur. In the case of power generation, that could have a huge impact on the wellbeing of many thousands of people.

    Tai-Min has posted a very detailed write-up of his project. It is definitely worth a read if you have even a passing interest in predictive maintenance.

    Want to see Edge Impulse in action? Schedule a demo today. 


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter