Skip to content

Repository files navigation

Mind-Controlled Bionic Arm — Brain to Machine

🧠 Mind-Controlled Bionic Arm with Sense of Touch

Decoding thought into motion — a non-invasive EEG-driven bionic prosthetic with haptic feedback

Stars License Protocol Blog

MATLAB Python EEGNet Simulink Arduino


📋 Table of Contents


🌟 Overview

The Mind-Controlled Bionic Arm with Sense of Touch (MCBA) is an innovative, non-invasive, and cost-effective bionic prosthetic limb designed to restore complex hand function for upper-limb amputees and individuals with partial paralysis.

The system decodes non-invasive EEG brain signals into PWM control commands that drive servo motors in a 3-DOF bionic hand. Integrated haptic feedback sensors in the gripper send tactile signals back to the user, enabling intuitive object manipulation and preventing accidental slippage or injury.

Key Innovation: We combine 8-class motor imagery EEG classification with real-time haptic feedback — bridging the gap between neural intent and physical action, all without surgical implants.


🎯 Core Pillars

🧠 Mind Control

Decodes 8 distinct motor imagery states from non-invasive EEG signals using EEGNet and classical ML for thought-driven prosthetic operation.

🤖 Haptic Feedback

Tactile, force, and proximity sensors in the gripper deliver real-time sensory signals back to the user for safe, intuitive object handling.

💰 Accessibility

Non-invasive and cost-effective design eliminates surgical procedures, optimizing comfort, affordability, and global accessibility.


🏗 System Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                         MIND-CONTROLLED BIONIC ARM                         │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌─────────────┐    ┌──────────────┐    ┌──────────────┐    ┌───────────┐  │
│  │  EEG Headset │───▶│ Preprocessing │───▶│  ML / EEGNet  │───▶│  PWM Ctrl │  │
│  │  (16ch/64ch) │    │ BP + Notch    │    │  Classification│    │  Servos   │  │
│  │  125/512 Hz  │    │ CAR + Z-norm  │    │  8 Classes     │    │  3-DOF    │  │
│  └─────────────┘    └──────────────┘    └──────────────┘    └─────┬─────┘  │
│                                                                     │       │
│                           ┌──────────────────────────────────┐      │       │
│                           │     HAPTIC FEEDBACK LOOP         │      │       │
│                           │  IR + Ultrasonic + Tactile Sensors│◀─────┘       │
│                           │  → Sensory signal to user        │              │
│                           └──────────────────────────────────┘              │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Signal Processing Pipeline

Raw EEG ─▶ Bandpass (8-30 Hz) ─▶ 60 Hz Notch ─▶ CAR ─▶ Artifact Rejection
                                                              │
                    ┌─────────────────────────────────────────┤
                    ▼                                         ▼
           ┌───────────────┐                        ┌──────────────┐
           │ Feature Extract│                        │   Raw Trials  │
           │ Band Power     │                        │ [C × T × 1]   │
           │ Hjorth, AR     │                        └───────┬──────┘
           │ Wavelet, Asym. │                                │
           └───────┬───────┘                                │
                   ▼                                         ▼
           ┌───────────────┐                        ┌──────────────┐
           │ Classical ML   │                        │    EEGNet     │
           │ SVM / RF / KNN │                        │  Temporal +   │
           │ (368 features) │                        │  Spatial CNN  │
           └───────┬───────┘                        └───────┬──────┘
                   └─────────────────┬──────────────────────┘
                                     ▼
                            ┌──────────────┐
                            │  Evaluation   │
                            │  Acc / F1 /   │
                            │  Kappa / CM   │
                            └──────────────┘

📁 Project Structure

Mind-Control-Bionic-Arm/
│
├── main.m                          # 🚀 Master pipeline — run this
├── ModelCreation_8Classes.m        # 📜 Legacy YAMNet approach (reference only)
│
├── src/
│   ├── preprocessing/
│   │   ├── load_milimbeeg.m        # MILimbEEG dataset loader (16ch, 125Hz)
│   │   ├── load_gigadb.m           # GigaDb dataset loader (64ch, 512Hz)
│   │   ├── eeg_preprocess.m        # Bandpass + Notch + CAR + Artifact rejection
│   │   ├── extract_features.m      # V1 features (208 dims: PSD, Hjorth, Stats)
│   │   ├── extract_features_v2.m   # V2 features (368 dims: + AR, Wavelet, Asymmetry)
│   │   └── remap_labels.m          # 8-class → 4/3/5 class remapping
│   │
│   ├── models/
│   │   ├── build_eegnet.m          # EEGNet architecture (Lawhern et al. 2018)
│   │   ├── train_eegnet.m          # EEGNet training with stratified K-fold CV
│   │   └── train_classical.m       # SVM / Random Forest / KNN with class balancing
│   │
│   └── evaluation/
│       └── evaluate_model.m        # Metrics: Accuracy, F1, Kappa, confusion matrix
│
├── Simulation/
│   ├── simulationModel.slx         # Simulink 3-DOF arm dynamics model
│   ├── ArduinoCollectionEEGSimulation.slx  # Arduino EEG acquisition simulation
│   └── classNames.mat              # 8-class label definitions
│
├── Utility Functions/
│   ├── audioPreprocess.m           # Legacy YAMNet mel-spectrogram preprocessor
│   ├── audioPreprocessDiff.m       # Legacy variant for raw feature extraction
│   └── statsOfMeasure.m            # Confusion matrix statistics calculator
│
├── datasets/                       # EEG datasets (git-ignored)
│   └── datasourceDatasets/
│       ├── MILimbEEG/              # 60 subjects, 16ch, 125Hz, 8 classes
│       └── GigaDb/                 # 52 subjects, 64ch, 512Hz, L/R imagery
│
├── models/                         # Saved trained models (git-ignored)
├── paper/                          # Research manuscript
├── assets/                         # Images and media
└── env/                            # Python virtual environment

⚡ Pipeline

Quick Start

% Run the entire pipeline in MATLAB
>> main

The main.m script executes the full pipeline:

Step Module Description
1 load_milimbeeg() Load MILimbEEG dataset (60 subjects, 8 classes, 16 channels)
2 eeg_preprocess() Bandpass filter (0.5–40 Hz), 50 Hz notch, CAR, artifact rejection
3 extract_features() Extract 208 EEG features (band power, Hjorth, PSD, stats)
4 train_classical() Train SVM, Random Forest, KNN with class balancing
5 train_eegnet() Train EEGNet CNN on raw preprocessed trials
6 evaluate_model() Compare all models — accuracy, F1, Cohen's Kappa

Class Mapping (8 Classes)

Class Abbreviation Motor Action
1 BEO Both Eyes Open (Baseline)
2 CLH Close Left Hand
3 CRH Close Right Hand
4 DLF Dorsiflex Left Foot
5 PLF Plantarflex Left Foot
6 DRF Dorsiflex Right Foot
7 PRF Plantarflex Right Foot
8 Rest Resting State

For practical BCI control, labels can be remapped using remap_labels():

% Standard 4-class BCI paradigm
[newLabels, classes, idx] = remap_labels(labels, '4class');
% → LeftHand, RightHand, Feet, Rest

📊 Datasets

MILimbEEG

Asanza et al. (2023) — Upper and lower limb motor execution & imagery

Property Value
Subjects 60 volunteers
Channels 16 (10-10 system)
Sampling Rate 125 Hz
Classes 8 (motor execution + imagery)
Total Recordings 8,680

GigaDb

Cho et al. (2017) — Left/Right hand motor imagery

Property Value
Subjects 52
Channels 64 EEG + 4 reference
Sampling Rate 512 Hz
Classes 2 (Left/Right hand imagery)
Trials per Class 100 per subject

🚀 Getting Started

Prerequisites

  • MATLAB R2024b+ with the following toolboxes:
    • Signal Processing Toolbox
    • Deep Learning Toolbox
    • Statistics and Machine Learning Toolbox
    • Wavelet Toolbox
    • (Optional) Audio Toolbox (for legacy YAMNet pipeline)
    • (Optional) Simulink + Simscape (for simulation models)

Installation

# Clone the repository
git clone https://github.com/Creatrix-Net/Mind-Control-Bionic-Arm.git
cd Mind-Control-Bionic-Arm

Dataset Setup

  1. MILimbEEG — Download from IEEE DataPort and extract into:

    datasets/datasourceDatasets/MILimbEEG/data/
    
  2. GigaDb — Download from GigaScience Database and extract .mat files into:

    datasets/datasourceDatasets/GigaDb/data/
    

Run

% Open MATLAB and navigate to the project root
cd('path/to/Mind-Control-Bionic-Arm')

% Run the full pipeline
main

📈 Results & Performance

Model Comparison (MILimbEEG, 4-Class)

Model Accuracy Balanced Accuracy Method
SVM (RBF) 25.49% 25.45% V2 features (368 dims)
Random Forest 26.70% 26.64% V2 features (368 dims)
KNN (k=11) 24.81% 24.82% V2 features (368 dims)
EEGNet 25.80% Raw EEG (16×500)

Model Comparison (GigaDb, 2-Class Left/Right)

Model Accuracy Notes
EEGNet Training in progress 64ch, 512Hz, 8-30Hz bandpass

Note: Motor imagery EEG classification is an inherently challenging task. State-of-the-art BCI competition results typically report 60-80% on 2-class problems. Our pipeline establishes a rigorous baseline with proper stratified cross-validation, class balancing, and comprehensive evaluation metrics. Active research continues to improve accuracy through architecture tuning and cross-dataset transfer learning.

Evaluation Metrics

Every model is evaluated with:

  • Stratified K-Fold Cross-Validation (5 folds)
  • Balanced Accuracy (class-imbalance aware)
  • Per-class Precision, Recall, F1-Score
  • Cohen's Kappa (agreement beyond chance)
  • Confusion Matrix with row/column normalized summaries
  • Precision-Recall scatter with iso-F1 curves

🔧 Simulation

Two Simulink models bridge the gap between AI classification and hardware control:

Model File Description
3-DOF Arm Dynamics Simulation/simulationModel.slx Simscape model of the bionic arm mechanics, servo actuation, and control response
Arduino EEG Acquisition Simulation/ArduinoCollectionEEGSimulation.slx Models real-time EEG signal acquisition via Arduino analog input with FIR filtering

🏆 Awards & Recognition

Award Event Year
🥈 2nd Prize (Poster Presentation) IIT Ropar — EE Research Day 2024
📜 Conference Selection & Presentation 5th International Conference on Intelligent Circuits and Systems (ICICS) 2023
🚀 Hackathon Selection Smart India Hackathon (SIH) — Internal Round 2023
🎙️ Pitching Competition IEEE SA Telehealth Pitching Competition
🎓 Student Event Feature IEEE SysCon Systems Council Student Event
📋 Patent Filed Through Lovely Professional University

📄 Research & Publications

  • Protocol: "Mind Controlled Bionic Arm with Sense of Touch [8 class version]"DOI: 10.17504/protocols.io.n92ldr869g5b/v2

  • Conference Paper: Presented at the 5th International Conference on Intelligent Circuits and Systems (ICICS 2023), Lovely Professional University.

  • Journal Manuscript: "Mind Control Bionic Arm with Sense of Touch" — submitted to the Journal of The Institution of Engineers (India): Series B.

  • Blog: thecreativenet.in/products/mcba


👥 Team

Dhruva Shaw
Lead Researcher
Robotics & Automation
Founder, Creative Net
GitHub

Arittrabha Sengupta
Researcher
Bioinformatics &
Data Analytics

Jay B. Khaple
Co-Researcher
Electronics &
Communication Engg.

Bhavya Chowdhary
Co-Researcher
Contributor

Dr. G. Raam Dheep
Faculty Advisor
School of EEE
Lovely Professional University


📝 Citation

If you use this work in your research, please cite:

@misc{shaw2024mcba,
  title     = {Mind Controlled Bionic Arm with Sense of Touch},
  author    = {Shaw, Dhruva and Sengupta, Arittrabha and Khaple, Jay Baswaraj and Dheep, G. Raam},
  year      = {2024},
  publisher = {protocols.io},
  doi       = {10.17504/protocols.io.n92ldr869g5b/v2},
  url       = {https://dx.doi.org/10.17504/protocols.io.n92ldr869g5b/v2}
}

📜 License

This project is maintained by Creative Net (Creatrix-Net) — a deep-tech robotics and automation initiative registered as an MSME on the Government of India's Udyam portal.

See the LICENSE file for details.


🧠 From thought to touch — making prosthetics intelligent.

⭐ Star this repo📖 Read the blog🔬 View protocol

About

Imagine a prosthetic arm that functions like your natural arm. You wear a headband, and with the thought process, the working signal from mind connects to the prosthetic about moving the arm, it responds accordingly—just like your real arm!“

Resources

Stars

0 stars

Watchers

1 watching

Forks

Sponsor this project

Used by

Contributors

Languages