Things used in this project
Hardware components |
||||
|
|
× | 1 | ||
![]() |
|
× | 1 | |
![]() |
|
× | 1 | |
![]() |
|
× | 1 | |
![]() |
|
× | 1 | |
![]() |
|
× | 2 | |
![]() |
|
× | 1 | |
|
× | 1 | ||
|
|
× | 1 | ||
|
|
× | 1 | ||
|
|
× | 1 | ||
Software apps and online services |
||||
![]() |
|
|||
|
|
||||
Hand tools and fabrication machines |
||||
![]() |
|
|||
![]() |
|
Story
This project demonstrates a real-timemotor vibration anomaly detection systemusing an STM32 microcontroller, GY-61 3-axis accelerometer, Arduino IDE, and NanoEdge AI. The system captures vibration signals from a rotating motor, collects normal and abnormal operating data, and uses NanoEdge AI Studio to benchmark and select a suitable Machine Learning library.
After the ML library is generated, it is integrated into the Arduino IDE project and deployed to the STM32. The final system performsML inference directly on the STM32 MCU, allowing the motor’s vibration pattern to be analyzed locally without requiring a PC or cloud-based ML service during operation.
The project demonstrates a practicalEdge AI / TinyML approachfor real-time machine condition monitoring and anomaly detection.
- Capture vibration data from a GY-61 accelerometer.
- Sample 3-axis vibration data using the STM32 ADC.
- Collect normal and abnormal motor vibration signals.
- Use a buffered data logger for high-speed signal acquisition.
- Benchmark anomaly-detection libraries using NanoEdge AI Studio.
- Generate and download a NanoEdge AI ML library.
- Integrate
.hand.alibrary files into an Arduino project. - Deploy the ML library on an STM32 MCU.
- Perform real-time ML inference directly on the microcontroller.
- Classify motor behavior asNORMALorANOMALY.
Briefly explain the problem of monitoring motor vibration and the goal of the project.
Motor → GY-61 → STM32 → NanoEdge AI → NORMAL/ANOMALY
4. Capture Normal and Abnormal Vibration Data
Explain the 256 × 3-axis buffer and approximately 1000 Hz sampling.
Run the motor normally and capture multiple signal windows.
Introduce the selected abnormal/disturbed condition and capture another set of vibration signals.
7. NanoEdge AI Studio Benchmarking
Import the normal and abnormal datasets and benchmark the available anomaly-detection libraries.
8. Generate the NanoEdge AI Library
After benchmarking, the selected NanoEdge AI library is generated and downloaded.
The generated library contains the components required to run the anomaly-detection algorithm on the target STM32 MCU.
For the Arduino IDE project, the important files include:
- NanoEdgeAI.h
- libneai.a
- library.properties
The library must be placed in the correct Arduino library structure.
9. Install NanoEdge AI Library in Arduino IDE
The library folder should follow the required structure:
The NanoEdge AI header file:“NanoEdgeAI.h”provides the declarations required by the Arduino program.
The compiled ML library:“libneai.a”contains the implementation that is linked into the STM32 firmware.
The.h file and.a file should not simply be placed anywhere in the Arduino project.
They need to be placed according to the required Arduino library structure so that the compiler can correctly find and link the NanoEdge AI library.
10. Deploy the ML Model on STM32
After installing the NanoEdge AI library, the final anomaly-detection program(Motor_Anomaly.ino )is opened in the Arduino IDE. The program includes:#include “NanoEdgeAI.h”The firmware is then compiled and uploaded to the STM32F103C8T6.
The most important feature of this project is that the Machine Learning model runs directly on the STM32 microcontroller. This makes the system an Edge AI application, because the anomaly detection and ML inference are performed locally on the MCU rather than on a PC or cloud server. After the NanoEdge AI library is generated, it becomes part of the STM32 firmware and is executed directly by the microcontroller. During operation, the STM32 continuously collects vibration data from the GY-61 accelerometer and passes the signal to the NanoEdge AI library. The ML model analyzes the vibration pattern and generates a similarity value, which indicates how closely the current signal matches the learned normal behavior. The program then compares this similarity value with a predefined threshold to determine whether the machine is operating in a NORMAL or ANOMALY condition.
- Motor condition monitoring
- Predictive maintenance
- Bearing monitoring
- Industrial equipment monitoring
- Vibration monitoring
- Edge AI
- TinyML








