Real-time gesture classification of sword strike types using IMU data, deployed on an Arduino Nano 33 BLE Sense. Built with Edge Impulse for data pipeline management, CNN-based model training, and TFLite deployment.
This project implements an end-to-end TinyML pipeline for classifying distinct sword strike motions (e.g., overhead, lateral, diagonal, idle) from inertial measurement unit (IMU) data. The trained model runs entirely on-device via TFLite Micro, with live inference results streamed over BLE to a browser-based web interface — no cloud dependency at inference time.
Edge Impulse project: https://studio.edgeimpulse.com/public/1014843/live
sword_strike_classifier/
├── data_collect/
│ └── Arduino firmware for collecting IMU data over BLE
│
├── live_inference/
│ └── Arduino firmware for real-time sword strike classification
│
├── logger.html
│ └── Web interface for data collection and labeling
│
├── inference.html
│ └── Live dashboard for visualizing sensor streams and model predictions
│
└── README.md
data_collect/ contains an Arduino sketch that streams raw 6-axis IMU data (accelerometer + gyroscope) from the Nano 33 BLE Sense over BLE Serial. logger.html connects to the board in-browser, lets you label gesture windows in real time, and exports CSV files for upload to Edge Impulse.
The full training pipeline lives in the public Edge Impulse project linked above. Key configuration:
- Input block: fixed-length time-series windows of raw acc/gyro samples
- Processing block: spectral features (FFT-based frequency domain representation)
- Learning block: DNN trained on labeled strike classes
- Data augmentation: noise injection and axis jitter to improve generalization across users and grip styles
- Export: INT8 quantized TFLite model compiled into a C header for deployment
live_inference/ runs the exported TFLite Micro model directly on the nRF52840 MCU. Inference results are transmitted over BLE and displayed in real time through inference.html in the browser — no USB connection required during use.
| Component | Detail |
|---|---|
| Board | Arduino Nano 33 BLE Sense |
| MCU | Nordic nRF52840 (ARM Cortex-M4F, 64 MHz) |
| IMU | LSM9DS1 — 3-axis accelerometer + 3-axis gyroscope |
| SRAM | 256 KB |
| Flash | 1 MB |
| Connectivity | Bluetooth Low Energy (BLE) |
Arduino libraries:
- Arduino_LSM9DS1
- ArduinoBLE
- Arduino_TensorFlowLite (TFLite Micro)
Toolchain:
- Edge Impulse Studio (model training, DSP pipeline)
- Edge Impulse CLI (optional, for local dataset management)
- Arduino IDE 2.x with the Mbed OS Nano board package
Data collection:
- Flash
data_collect/data_collect.inoto the Nano 33 BLE Sense - Open
logger.htmlin a Web Bluetooth-compatible browser (Chrome recommended) - Connect to the board, select a gesture label, and record strike windows
- Export and upload CSV data to Edge Impulse
Live inference:
- Train and export the model from Edge Impulse as an Arduino library
- Place the exported library in
live_inference/and flashsword_inference.ino - Open
inference.htmlin browser, connect over BLE - Perform strikes — predicted class and confidence appear in real time
Developed for EE 446: TinyML at the University of Washington. Demonstrates the full embedded ML workflow from IMU data collection through DNN training, INT8 quantization, TFLite Micro deployment, and BLE-based inference streaming on a resource-constrained microcontroller.