Skip to content

Commit 203d57a

Browse files
committed
Structure update 4
1 parent 68462bf commit 203d57a

File tree

1 file changed

+10
-7
lines changed
  • content/hardware/07.opta/opta-family/opta/tutorials/22.ml-anomaly-detection-app-note

1 file changed

+10
-7
lines changed

content/hardware/07.opta/opta-family/opta/tutorials/22.ml-anomaly-detection-app-note/content.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,9 @@ To deploy a trained Edge Impulse model, go to the `Deployment` tab in the Edge I
421421

422422
![Opta™ Deployment](assets/edge-impulse-deploy.png)
423423

424-
After the deployment, it was possible to create the code that integrates Bluetooth Low Energy (BLE) functionality with Edge Impulse's machine learning inferencing framework to classify accelerometer data in real-time. It starts by initializing BLE communication and scanning for a specific peripheral device broadcasting a service with a known UUID. Once the device is found, it connects, discovers its attributes, and accesses a characteristic that provides accelerometer data. The code continuously reads 6 bytes of accelerometer data (representing the X, Y, and Z axes) from the BLE characteristic, processes it, and stores it in a buffer. This data is then transformed into a signal format compatible with Edge Impulse's inferencing engine. Using the pre-trained machine learning model deployed as a custom library generated by Edge Impulse's deployment feature, the code classifies accelerometer data, specifically vibration data, to detect anomalies. If the BLE connection is lost, the program automatically attempts to reconnect. Throughout the process, debug information and classification results are printed to the Serial monitor for real-time feedback.
424+
After the deployment, it was possible to create the code that integrates Bluetooth Low Energy (BLE) functionality with Edge Impulse's machine learning inferencing framework to classify accelerometer data in real-time. It starts by initializing BLE communication and scanning for a specific peripheral device broadcasting a service with a known UUID. Once the device is found, it connects, discovers its attributes, and accesses a characteristic that provides accelerometer data.
425+
426+
The code continuously reads 6 bytes of accelerometer data (representing the X, Y, and Z axes) from the BLE characteristic, processes it, and stores it in a buffer. This data is then transformed into a signal format compatible with Edge Impulse's inferencing engine. Using the pre-trained machine learning model deployed as a custom library generated by Edge Impulse's deployment feature, the code classifies accelerometer data, specifically vibration data, to detect anomalies. If the BLE connection is lost, the program automatically attempts to reconnect. Throughout the process, debug information and classification results are printed to the Serial monitor for real-time feedback.
425427

426428
The code is divided into four parts for better understanding, similar to what was done previously.
427429

@@ -447,7 +449,7 @@ BLECharacteristic sensorCharacteristic; // BLE characteristic object to interact
447449
bool connectToPeripheral();
448450
```
449451

450-
The second part of the code, begins by establishing Serial communication at a baud rate of 115,200 and waits for the connection to ensure debugging output is displayed correctly. A message indicating the start of Edge Impulse inferencing is printed to the Serial monitor. The function then initializes the BLE stack using the `BLE.begin()` method, and if BLE fails to initialize, it halts execution and reports an error. Finally, it validates the Edge Impulse classifier configuration to ensure the raw sample frame matches the expected format of three axes (X, Y, Z). If the configuration is invalid, an error message is printed, and the function stops further execution.
452+
The second part of the code, begins by establishing Serial communication at a baud rate of `115,200` and waits for the connection to ensure debugging output is displayed correctly. A message indicating the start of Edge Impulse inferencing is printed to the Serial monitor. The function then initializes the BLE stack using the `BLE.begin()` method, and if BLE fails to initialize, it halts execution and reports an error. Finally, it validates the Edge Impulse classifier configuration to ensure the raw sample frame matches the expected format of three axes (X, Y, Z). If the configuration is invalid, an error message is printed, and the function stops further execution.
451453

452454
```arduino
453455
void setup() {
@@ -615,12 +617,13 @@ bool connectToPeripheral() {
615617

616618
## Full Motor Anomaly Detection Example
617619

618-
All the necessary files to replicate this application notes can be found below:
620+
All the necessary files to replicate this application notes can be found [here](assets/Nicla_Opta_ML_Vibration_Anomaly_Detection.zip):
621+
622+
This file contains the following codes: Nicla Sense ME firmware, Opta™ training firmware and Opta™ deployment firmware.
619623

620-
- You can download a compressed file containing all the necessary codes [here](assets/Nicla_Opta_ML_Vibration_Anomaly_Detection.zip). This file contains the following codes: Nicla Sense ME Firmware, Opta™ Firmware, and Opta™ Deployment Firmware.
621-
- **Nicla Sense ME Firmware:** This code configures the Nicla Sense ME as a BLE peripheral to collect vibration data from the motor and transmit it wirelessly via Bluetooth® Low Energy (BLE).
622-
- **Opta™ Firmware:** This code sets up the Opta™ as a BLE central device to receive vibration data from the Nicla Sense ME and forward it to the connected computer via serial communication.
623-
- **Opta™ Deployment Firmware:** This code embeds the trained machine learning model into the Opta™ for real-time motor anomaly detection, allowing it to process vibration data and identify anomalies locally.
624+
- **Nicla Sense ME firmware:** This code configures the Nicla Sense ME as a BLE peripheral to collect vibration data from the motor and transmit it wirelessly via Bluetooth® Low Energy (BLE).
625+
- **Opta™ training firmware:** This code sets up the Opta™ as a BLE central device to receive vibration data from the Nicla Sense ME and forward it to the connected computer via serial communication.
626+
- **Opta™ deployment firmware:** This code embeds the trained machine learning model into the Opta™ for real-time motor anomaly detection, allowing it to process vibration data and identify anomalies locally.
624627
- The Machine Learning Tools project is public [here](https://studio.edgeimpulse.com/public/580971/live) so you can clone it and modify it to adapt it to your needs by improving the dataset or model architecture for a custom deployment.
625628

626629
## Conclusion

0 commit comments

Comments
 (0)