The PIR Motion Detection application is an Edge AI solution that runs on the MSPM0G5187 microcontroller with integrated Neural Processing Unit (NPU). It classifies passive infrared (PIR) sensor signals into different motion categories in real-time, enabling intelligent motion detection for security systems, smart home automation, and occupancy sensing.
- CC35X1
- CC1312
- CC1314
- CC1352
- CC1354
- CC2755
Check the config_<device>.yaml files for device-specific configurations.
- Traditional PIR sensors only detect presence/absence without distinguishing motion sources
- False alarms from pets and environmental factors reduce security system effectiveness
- Manual threshold tuning is unreliable across different environments and conditions
- Edge AI enables intelligent motion classification, reducing false positives while maintaining detection sensitivity
- Real-time motion classification
- Greater than 90% classification accuracy
- Low power consumption for battery-operated devices
-
Hardware:
- MSPM0G5187 microcontroller with integrated NPU Link
- EdgeAI Sensor Boosterpack (TIDA-010997) with PIR sensor
-
Software:
- Code Composer Studio 12.x or later
- MSPM0 SDK 2.08.00 or later
- TI Edge AI Studio
The example uses the pir_detection_classification Link dataset which contains labeled PIR sensor recordings categorized into three motion classes:
- Human Motion: Movement patterns characteristic of human activity
- Background Motion: Environmental disturbances and noise
- Dog Motion: Movement patterns characteristic of pet dog activity
Data was captured using the EdgeAI Sensor Boosterpack with motion recorded from 6-8 meter range.
- ADC Sampling
- DC Offset Removal
- Windowed Processing
- Symmetric Mirroring
- FFT Computation
- Magnitude Calculation
- Average Pooling
- Additional Features:
- Zero Crossing Rate (ZCR)
- Slope Changes
- Dominant Frequency
- Feature Concatenation
- PIRDetection_model_1_t (Default):
- Compact CNN architecture
- ~53K+ parameters
- NPU compatible
- Optimized for multivariate input signals
- Accuracy: ~98% (Accuracy numbers for CC1352 with floating point feature extraction)
- Accuracy: ~92.46% (Accuracy numbers on MSPM0 with fixed point feature extraction)
NOTE: Running the config yaml handles everything including feature extraction, training, quantization, and compilation.
-
Training:
- Use TI Edge AI Studio (GUI) or tinyml-tensorlab (CLI)
- Batch size: 64, Learning rate: 0.00001, Optimizer: Adam
- Weight decay: 1e-20
- Training epochs: 100
-
Quantization:
- INT8 quantization for NPU compatibility
- Aggressive quantization targeting TI MCUs
-
Compilation:
- TI Neural Network Compiler converts trained model
- Generates model.a and tvmgen_default.h header file
- Hardware accelerated inference using TinyEngine NPU
After completing the repository setup, run the following command from the tinyml-modelzoo directory:
Windows:
.\run_tinyml_modelzoo.bat examples\pir_detection\config_MSPM0.yamlLinux:
./run_tinyml_modelzoo.sh examples/pir_detection/config_MSPM0.yaml- config_MSPM0.yaml - MSPM0G5187
- config_CC1312.yaml - CC1312
- config_CC1314.yaml - CC1314
- config_CC1352.yaml - CC1352
- config_CC1354.yaml - CC1354
- config_CC2755.yaml - CC2755
- config_CC35X1.yaml - CC35X1
- MSPM0G5187 Technical Reference Manual https://www.ti.com/product/MSPM0G5187
- EdgeAI Sensor Boosterpack (TIDA-010997) https://www.ti.com/tool/TIDA-010997
- https://software-dl.ti.com/mctools/nnc/mcu/users_guide/
- TI Model Training Guide: https://github.com/TexasInstruments/tinyml-tensorlab/tree/main
- https://en.wikipedia.org/wiki/Passive_infrared_sensor
- EdgeAI Software Guide: https://dev.ti.com/tirex/explore/node?node=A__AKCnvqDed-Plz2JO5Umb3Q__MSPM0-SDK__a3PaaoK__LATEST
- MSPM0 SDK: https://www.ti.com/tool/MSPM0-SDK