This is a public Edge Impulse project, use the navigation bar to see all data and models in this project; or clone to retrain or deploy to any edge device.
Magnetic Vision
About this project
Magnetic Vision: Teaching AI to See Motion Without a Camera
A TinyML project using a Hall-effect sensor and Edge Impulse to classify motion speed and patterns — no camera required. Runs entirely on-device on a Seeed Wio Terminal.
Table of Contents
- Overview
- Hardware Setup
- Experiment 1: Speed Classification
- Experiment 2: Motion Pattern Classification
- Video Demos
- How to Deploy
- Repository Structure
- Results Summary
- Future Work
- Credits
- Links
Overview
This project explores whether a simple Hall-effect sensor can capture enough information about a moving object for a machine-learning model to recognize its motion — without any camera or computer vision.
It contains two experiments:
- Experiment 1: Classify motion speed (FAST / SLOW / NO_CAR) — achieved 100% accuracy using the Flatten processing block.
- Experiment 2: Classify motion patterns (STRAIGHT / OSCILLATE / PAUSE) — achieved 76.3% validation accuracy using a 1D CNN on raw signals.
Key finding: Statistical features (Flatten) work well for amplitude-based problems, but temporal patterns require more sophisticated modeling (1D CNN).
Hardware Setup
Components
| Component | Quantity | Notes |
|---|---|---|
| Seeed Studio Wio Terminal | 1 | ARM Cortex-M4F, built-in LCD |
| A1302 Linear Hall-Effect Sensor | 1 | Analog output |
| Magnetic toy car | 1 | Any magnet works |
| Jumper wires | 3 | For sensor connection |
Wiring Diagram
| A1302 Pin | Wio Terminal Pin | Notes |
|---|---|---|
| VCC | 3.3V | Wider ADC dynamic range |
| GND | GND | Common ground |
| VOUT | A0 (Pin 13) | Analog magnetic field strength |
Experiment 1: Speed Classification
Classes
- FAST: Car moves rapidly past the sensor.
- SLOW: Car moves slowly past the sensor.
- NO_CAR: No car present near the sensor.
Data Collection
Impulse Design
- Window size: 6000 ms (6 seconds at 100 Hz)
- Window increase: 3000 ms
- Processing block: Flatten (extracts 7 statistical features)
- Learning block: Classification (Keras)
Features Extracted by Flatten
- Mean
- Standard Deviation
- Minimum
- Maximum
- RMS
- Skewness
- Kurtosis
Neural Network
- Input: 7 features
- Dense (20 neurons, ReLU) → Dense (10 neurons, ReLU) → Dropout (0.2)
- Output: 3 classes, Softmax
Results
- Validation accuracy: 100%
- Test accuracy: 100%
- Dataset: 10 recordings per class (30 total) → 90 windows
Deployment
The model was deployed as an Arduino library using the EON Compiler for optimized on-device performance.
Experiment 2: Motion Pattern Classification
Classes
- STRAIGHT: Steady movement in one direction.
- PAUSE: Movement, brief pause, then continuation.
- OSCILLATE: Back-and-forth movement within the window.
Data Collection
Each recording lasts 3 seconds (300 samples at 100 Hz). Below are examples of each class:
The dataset consists of 86 recordings split across three classes:
Processing
- Window size: 3000 ms (3 seconds at 100 Hz)
- Processing block: Raw Data (full 300-sample signal)
- Learning block: Classification (Keras with 1D CNN)
Neural Network
- Input: 300 raw samples → Reshape (300 × 1)
- 1D Conv/Pool (4 filters, kernel 3) → 1D Conv/Pool (16 filters, kernel 3)
- Flatten → Dense (20, ReLU) → Dropout (0.2)
- Output: 3 classes, Softmax
Results
- Validation accuracy: 76.3%
- Test accuracy: 66.67%
- Dataset: 28–29 recordings per class (86 total)
Finding: Flatten was tested first and reached only 61.5%, confirming that amplitude-based statistics are insufficient for temporal pattern recognition.
Deployment
The model was deployed as an Arduino library using the EON Compiler for optimized on-device performance.
On-device performance:
- Inference latency: 5 ms
- Peak RAM usage: 13.8 KB
- Flash usage: 68.5 KB
Video Demos
Experiment 1: Speed Classification (FAST / SLOW / NO_CAR)
Experiment 2: Motion Pattern Classification (STRAIGHT / OSCILLATE / PAUSE)
How to Deploy
Prerequisites
- Arduino IDE (v1.8.19 recommended for stability)
- Seeed SAMD board package installed
- TFT_eSPI library
- Edge Impulse Arduino library (specific to your impulse)
Step 1: Install the Board
- Open Arduino IDE.
- Go to
File → Preferences. - Add this URL to "Additional Boards Manager URLs":
https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json - Go to
Tools → Board → Board Manager. - Search for "Seeed SAMD" and install it.
- Select
Tools → Board → Seeeduino Wio Terminal.
Step 2: Install Libraries
- Install
TFT_eSPIviaSketch → Include Library → Manage Libraries. - Download the Edge Impulse Arduino library from your project's Deployment page on Edge Impulse Studio.
- Install it via
Sketch → Include Library → Add .ZIP Library...
Step 3: Upload the Firmware
- Open the desired
.inofile fromfirmware/. - Connect the Wio Terminal via USB.
- Select the correct port in
Tools → Port. - Press Upload.
Step 4: Run the Project
- Open Serial Monitor at 9600 baud.
- Press B1 on the Wio Terminal to start recording.
- Move the magnet/car during the recording window.
- The result will appear on the Wio Terminal's screen.

Step 5: PC Logger (Optional)
If you want to collect your own dataset:
- Install Python 3 and
pyserial:pip install pyserial - Edit SERIAL_PORT in pc_tools/logger.py to match your COM port.
- Run: python pc_tools/logger.py
- Press B1 on the Wio Terminal; the data will be saved automatically to dataset/<CLASS>/.
Repository Structure
https://github.com/aula9/Magnetic-Vision-Teaching-AI-to-See-Motion-Without-a-Camera
Magnetic-Vision-Teaching-AI-to-See-Motion-Without-a-Camera/
│
├── firmware/ Arduino sketches
│ ├── experiment1_speed/ (FAST / SLOW / NO_CAR)
│ └── experiment2_patterns/ (STRAIGHT / OSCILLATE / PAUSE)
│
├── pc_tools/ Python scripts
│ ├── logger.py (receives CSV data via Serial)
│ └── visualize.py (plots time-series signals)
│
├── dataset/ Collected CSV recordings (organized by class)
│
├── images/ Project screenshots and diagrams
│
└── README.md Project documentation
Results Summary
| Experiment | Task | Method | Validation | Test |
|---|---|---|---|---|
| 1 | Speed classification | Flatten + Dense | 100% | 100% |
| 2 | Pattern classification | 1D CNN on Raw Data | 76.3% | 66.67% |
Future Work
- Multi-axis sensing: Use 3-axis magnetometers to capture richer magnetic signatures.
- Directional detection: Add a second Hall-effect sensor to detect motion direction.
- Larger datasets: Vary magnet size, orientation, speed, and distance to test generalization.
Credits
Author: Aula Jazmati
Platform: Seeed Studio Wio Terminal
ML Pipeline: Edge Impulse
License: MIT
Full Write-up
Run this model
Dataset summary
Data collected
14m 37sSensor
value @ 27HzLabels
OSCILLATE, PAUSE, STRAIGHTProject info
| Project ID | 1112065 |
| License | 3-Clause BSD |
| No. of views | 9 |
| No. of clones | 0 |