# ml-arc-fault-detection **Repository Path**: MicrochipTech/ml-arc-fault-detection ## Basic Information - **Project Name**: ml-arc-fault-detection - **Description**: A baseline model for Arc Fault Detection using an IEEE dataset - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-23 - **Last Updated**: 2026-07-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Microchip Edge AI

![Status](https://img.shields.io/badge/status-active-brightgreen) ![Platforms](https://img.shields.io/badge/platforms-MCU%20%7C%20MPU%20%7C%20FPGA%20%7C%20dsPIC-red) ![Domain](https://img.shields.io/badge/Edge%20AI-%20Applications-orange) ![ML](https://img.shields.io/badge/Machine%20Learning-Embedded-yellow) ![License](https://img.shields.io/badge/license-Microchip-blue) # ML Arc Fault Detection (AFD) Baseline Model A baseline machine learning model for Arc Fault Detection demonstrating high accuracy and small memory footprint suitable for deployment on embedded systems. ## Motivation Arc fault detection is a critical safety challenge in electrical systems, where undetected faults can lead to fires and equipment damage. Traditional rule-based methods struggle to distinguish genuine arc faults from normal switching transients and varying load conditions. This repository demonstrates how **machine learning dramatically outperforms traditional approaches** while remaining practical for deployment on resource-constrained embedded devices. Using the MPLAB ML Development Suite and the publicly available IEEE dataset, we achieve: - **100% classification accuracy** on benchmark data - **Sub-millisecond inference** latency enabling real-time detection - **Small memory footprint** suitable for microcontrollers - **Production-ready** embedded deployment with simple C API ## Overview This repository provides a complete workflow for building arc fault detection models using: - **MPLAB ML Development Suite** - Automated ML pipeline for embedded systems - **IEEE Dataset** - Publicly available labeled arc fault data - **Pre-processed Data** - Cleaned datasets ready for training - **Documentation** - Comprehensive guide from data to deployment ## Repository Contents ``` ├── ieee-dataset/ │ └── ieee-dataset-cleaned.zip # Compressed cleaned datasets │ ├── cleaned_sequential_parallel_basic.csv # Parallel AFD without load │ ├── cleaned_sequential_parallel_load.csv # Parallel AFD with load │ ├── cleaned_sequential_series_basic.csv # Series AFD without load │ └── cleaned_sequential_series_load.csv # Series AFD with load ├── notebooks/ │ ├── ieee-data-cleaning.ipynb # Data validation notebook │ └── export-to-mplab-ml.ipynb # MPLAB ML export notebook ├── AFD_MPLAB_ML_Complete_Guide.md # This complete guide (Markdown version) ├── AFD_MPLAB_ML_Complete_Guide.pdf # PDF version of the complete guide └── README.md # Quick start guide and repository overview ``` ## Quick Start ### 1. Get the IEEE Dataset The cleaned datasets are included in this repository. The original data is available at: [IEEE DataPort - Low Voltage DC Series Arc Fault](https://ieee-dataport.org/) ### 2. Install MPLAB ML Development Suite The MPLAB ML Development Suite is bundled for free as a plugin to the MPLAB X IDE which can be downloaded [here](https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide). A Pro version is also available, visit [MPLAB Machine Learning Development Suite](https://www.microchip.com/en-us/tools-resources/develop/mplab-machine-learning-development-suite) to learn more. ### 3. Follow the AFD Complete Guide Download [AFD_MPLAB_ML_Complete_Guide.pdf](AFD_MPLAB_ML_Complete_Guide.pdf) for step-by-step instructions covering: - Data preparation and queries - Feature extraction - Model training - Performance evaluation - Embedded deployment ## Dataset Information **IEEE Dataset Labels:** | Label | Description | |-------|-------------| | -1 | Normal conditions, no arc present | | 0 | Transient, typically at beginning/end of arc | | 1 | Arc observed | **Data Characteristics:** - Sampling rate: 16 kHz - Window size: 160 samples (10 ms) - Four dataset variants: series/parallel × with/without load **Data Quality:** The original IEEE dataset contained some invalid entries (NaN values, incorrect labels). Cleaning notebooks are provided, and the repository includes pre-cleaned versions ensuring reproducible results. ## Key Features for Arc Detection The baseline model uses four carefully selected features providing optimal class separation: 1. **Statistical: Absolute Mean** - Average signal magnitude 2. **Statistical: Minimum** - Negative excursions characteristic of arcs 3. **Frequency: MFE** - Median frequency energy capturing spectral characteristics 4. **Time: Percent Time Over Zero** - Duty cycle and polarity information These features enable **100% sensitivity** (no missed arc faults) and **100% specificity** (no false alarms). ## Model Performance **Baseline Model Results:** - ✅ 100% accuracy across all test datasets - ✅ 100% sensitivity (no false negatives) - ✅ 100% specificity (no false positives) - ✅ Excellent generalization across series/parallel and loaded/unloaded scenarios - ✅ Consistent performance on validation, training, and cross-validation sets ## Deployment The trained model exports as a "knowledge pack" containing: - Optimized C code for target processor - Feature extraction routines - Inference engine - Simple integration API **Example Integration:** ```c #include "kb.h" // Initialize at startup kb_model_init(); // Run inference on 160-sample window ret = kb_run_model((SENSOR_DATA_T *)data, num_sensors, KB_MODEL_rank_0_INDEX); if (ret >= 0) { sml_output_results(KB_MODEL_rank_0_INDEX, ret); kb_reset_model(KB_MODEL_rank_0_INDEX); } ``` **Resource Requirements:** - Flash: ~4-6 KB (model + features) - RAM: ~1-2 KB (inference workspace) - Latency: <2 ms on typical dsPIC and MCUs ## Documentation For complete details including: - Motivation and background - Step-by-step model building - Feature analysis and visualization - Performance evaluation - Deployment instructions **→ Download the [Complete Guide PDF](AFD_MPLAB_ML_Complete_Guide.pdf)** ## Hardware Recommendations For production arc fault detection systems, consider processors with DSP capabilities: - **dsPIC33A series** - Integrated DSP with 40 MSPS ADCs - Any MCU with hardware MAC for accelerated feature extraction ## Notebooks ### ieee-data-cleaning.ipynb - Identifies and removes invalid data entries - Documents data quality issues found in original dataset - Generates cleaned CSV files ### export-to-mplab-ml.ipynb - Demonstrates formatting data for MPLAB ML import - Shows auto-labeling process - Provides dataset statistics ## Contributing This is a baseline model demonstrating the workflow. For your specific application: 1. Collect data from your hardware platform 2. Test under all expected operating conditions 3. Fine-tune features and models as needed ## Additional Resources - [MPLAB ML Development Suite Documentation](https://onlinedocs.microchip.com/oxy/GUID-80D4088D-19D0-41E9-BE8D-7AE3BE021BBF-en-US-3/GUID-5C3084BA-4706-40CF-AD6E-6AC561A13DF9.html) - [IEEE Research Paper](https://ieee-dataport.org/) - "Why AI: A Comparative Study for Detection Methods in DC Series Arc Fault" - [Technical Support](https://microchip.com/support) ## License Copyright © Microchip Technology Inc. All rights reserved. ## Why This Matters Arc fault detection saves lives and prevents property damage. Machine learning enables more reliable detection than traditional methods while remaining practical for embedded deployment. This guide provides a proven starting point for developing production-ready arc fault detection systems. --- **Ready to get started?** Download the [Complete Guide](AFD_MPLAB_ML_Complete_Guide.pdf) and follow along with the included datasets and notebooks!