Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/microchiptech/ml-dspic33ck-predictive-maintenance-in-motor-control-applications
dsPIC33CK Predictive Maintenance System for Industrial Motors
https://github.com/microchiptech/ml-dspic33ck-predictive-maintenance-in-motor-control-applications
control dspic dspic33 ml motor predictive-maintenance
Last synced: 11 days ago
JSON representation
dsPIC33CK Predictive Maintenance System for Industrial Motors
- Host: GitHub
- URL: https://github.com/microchiptech/ml-dspic33ck-predictive-maintenance-in-motor-control-applications
- Owner: MicrochipTech
- Created: 2024-04-25T15:56:00.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-10-06T15:16:12.000Z (4 months ago)
- Last Synced: 2024-11-11T21:11:53.397Z (2 months ago)
- Topics: control, dspic, dspic33, ml, motor, predictive-maintenance
- Language: C
- Homepage:
- Size: 17.1 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![logo_microchip](assets/microchip.png) ![logo_ml](assets/MPLAB-MachineLearning.png)
# Predictive Maintenance in Motor Control Applications
| ![Deployed gesture recognizer](assets/PredictiveMaintananceDemo.gif) |
| :----------------------------------------------------------: |
| Deployed Predictive Maintenance System |## Repository Overview
This repository is a companion to the [Predictive Maintenance with MPLAB ML tutorial](https://onlinedocs.microchip.com/oxy/GUID-80D4088D-19D0-41E9-BE8D-7AE3BE021BBF-en-US-3/GUID-E6CBB10A-FFC8-4EF3-8C07-D29B64446EB6.html). It contains the firmware to classify the operational state of a motor - whether the motor is in normal condition or experiencing any anomalies such as unbalanced load by monitoring Iq current of the motor on [dsPIC33CK LVMC Development Board](https://www.microchip.com/en-us/development-tool/dm330031) with the [24V 3-Phase Brushless DC Motor](https://www.microchip.com/en-us/development-tool/ac300020)The supported Classifications (shown in the video above) are:
- *Normal operation*
- *Unbalanced load*In addition, there is also an 'unknown' class for the operation those don't fall under these categories.
## Hardware Used
* dsPIC33CK LVMC Development Board [(DM330031)](https://www.microchip.com/en-us/development-tool/dm330031)
* 24V 3-Phase Brushless DC Motor [(AC300020)](https://www.microchip.com/en-us/development-tool/ac300020)## Software Used
* [MPLAB® X IDE](https://microchip.com/mplab/mplab-x-ide)
* [MPLAB® XC16 Compiler](https://microchip.com/mplab/compilers)
* [MPLAB® Code Configurator](https://www.microchip.com/en-us/tools-resources/configure/mplab-code-configurator)
* [MPLAB® ML Model Builder](https://onlinedocs.microchip.com/v2/keyword-lookup?keyword=MPLAB-ML-Documentation&redirect=true)## Related Documentation
* dsPIC33CH512MP508 [Product Family Page](https://www.microchip.com/en-us/product/dspic33ch512mp508)
* motorBench® Development Suite [Software Plugin Details](https://www.microchip.com/en-us/solutions/technologies/motor-control-and-drive/motorbench-development-suite)## Data Collection
The [dataset](/dataset) used for the development of this application consists of Motor IQ current and Motor RPM measurements taken from a 24V 3-Phase Brushless DC Motor connected to a dsPIC33CK LVMC Development Board, running on an FOC motor control algorithm. No sensors were used in this application. For further description of the application setup, see the [Predictive Maintenance with MPLAB ML tutorial](https://onlinedocs.microchip.com/oxy/GUID-80D4088D-19D0-41E9-BE8D-7AE3BE021BBF-en-US-3/GUID-E6CBB10A-FFC8-4EF3-8C07-D29B64446EB6.html).## Data Collection Firmware
A binary build of the data logging firmware used in the data collection for this project can be found in the [binaries folder of this repo](/binaries); to build data logging firmware for different configurations, visit the [ml-33ck265mp508-lvmc-datalogger](https://github.com/MicrochipTech/ml-dsPIC33CK-LVMC-Data-Logger) repository.## Firmware Operation
The behavior of the firmware can be summarized as operating in one of the distinct states described in the table below.
| State | UART Terminal output | Description |
| --------------- | ----------------------------- | ------------------------------------------------------------ |
| Motor OFF | Motor is in idle state! | Motor is in off state |
| Normal | Normal_Operation | Motor is running normally(no load or balanced load) |
| Unbalanced load | Unbalanced_load | Unbalanced load is detected |
| Buffer Overflow | Overrun! | Processing is not able to keep up with real-time; data buffer has been reset. |
| ERROR | ERROR: Got a bad motor status | The motor controller has recognized a fault condition, under which it is unable to proceed safely with normal control activities. |Note the firmware class ID mapping is as below:
- *Unknown* - 0 (input outside of modeled behavior)
- *Normal_Operation* - 1
- *Unbalanced load* - 2## Running the application Demo
- Start MPLAB X IDE and open the project `anomaly-detection-ml-33ck256mp508-lvmc.X` with device selection dsPIC33CK256MP508.
- Set the project `anomaly-detection-ml-33ck256mp508-lvmc.X` as the main project.
- Open the `app_config.h` file located under Header Files.
- Ensure that the macro **`DATA_STREAMER_FORMAT`** is set as **`DATA_STREAMER_FORMAT_NONE`**
![macros](assets/macros.png)
- Open project properties and ensure that the selected MPLAB® XC16 Compiler and Device Pack support the device configured in the firmware.
- Build the project and program the device.
- Open the terminal window on Data Visualizer, select the COM port of the LVMC board, and set the below configurations
- Baud rate 115200
- Data bits 8
- Stop bits 1
- Parity NoneThe below message will be printed right after the device reset. Indicating Knowledge pack number and the motor status.
![after_reset](assets/afterreset_idel.png)
- Press switch SW1 to start the motor. If the motor runs normally, the below output will be shown.
![normal](assets/normal.png)
If an unbalanced load is detected:
![unabalnced_load](assets/unabalnced_load.png)
## Firmware Benchmark
With ``-O2`` level compiler optimizations, and 100MHz clock (Fcy)
- 25.9kB Flash
- 9.3kB RAM
- 25ms Inference time(average)## Classifier Performance
Below is the confusion matrix for the test dataset. Note that the classes are highly imbalanced so accuracy is not a good indicator of overall performance.![Test set confusion matrix](assets/confusion_matrix.png)