Skip to content

MicrochipTech/ml-arc-fault-detection

Repository files navigation

Microchip Edge AI

Status Platforms Domain ML License

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

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.

A Pro version is also available, visit MPLAB Machine Learning Development Suite to learn more.

3. Follow the AFD Complete Guide

Download 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:

#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

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

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 and follow along with the included datasets and notebooks!

About

A baseline model for Arc Fault Detection using an IEEE dataset

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published