README.md

June 25, 2026 · View on GitHub

main

Python OS Supported

Python Package using Conda Status Pipeline Tests Passing Code Coverage

GitHub Stars License MIT Docs Available

Brain Computer Interface to drive video game cars with EEG signals.


FOR DETAILED DOCUMENTATION VISIT HERE

Grateful:

❤️ "Invisible Driver" is a now a part of awesome readme list. Check here.

Play Guide:

game

  • If hardware is available, complete the setup as per instructions and run the server.
  • If hardware is not available, run the server and run simulation.

What are Brain Waves?

Brain waves refer to the electrical activity of the brain, characterized by different frequencies ranging from 0.1 to over 100 Hz, with specific classes including beta, gamma, alpha, theta, and delta waves, each associated with varying states of alertness, cognitive activity, and sleep.[3]

What is Brain-Computer Interface?

A Brain–Computer Interface (BCI) establishes a direct communication pathway between the brain's bioelectrical activity and an external computational device, bypassing traditional neuromuscular pathways [1].

BCI diagram
Figure 1: Brain-Computer Interface(BCI)

What is EEG?

An electroencephalogram (EEG) is a test that measures electrical activity in the brain.[2] This test also is called an EEG.

EEG diagram
Figure 2: Electroencephalogram(EEG)

Table of Contents:

ContentDescription
HardwareHardware requirements
SoftwareSoftware requirements
Hardware Connection StepsSteps to connect hardware
Software Connection StepsSteps to connect software
Directory StructureRepository layout
PipelineML Pipeline steps
ResultsEvaluation Metrics
ReferencesReferences
Wanna Chat?Contact Information

Hardware:

ComponentImageQuantity
BioAmp EXG Pill
(with JST PH 2.0 connector and a header pin)
BioAmp EXG Pill1
BioAmp Cable v3BioAmp Cable v31
Gel ElectrodesGel Electrodes3
Jumper CablesJumper Cables3
Arduino UnoArduino Uno1
Nuprep Skin GelNuprep Gel1
Wet wipeWet Wipe1
Brain BioAmp Band
(Optional)
Brain BioAmp Band1
Electrode Gel
(If using Brain BioAmp Band)
Electrode Gel1

Software:

  • Arduino IDE
  • Visual Studio Code
  • Google Colab (Optional)

Hardware connection steps:

Step 1: Assembly

If your BioAmp EXG Pill did not come pre-soldered, solder the header pins and the JST PH 2.0 connector onto the board.

Assembly Diagram

Step 2: Skin Preparation

Gently rub Nuprep Skin Preparation Gel onto your forehead and behind your earlobes to lower skin impedance and improve signal accuracy. Wipe the areas clean with a wet wipe.

Skin Preparation

Step 3: Connecting Electrode Cable

Plug the BioAmp Cable v3 directly into the JST PH 2.0 connector on the BioAmp EXG Pill.

Cable Connection

Step 4: Electrode Placement

Snap the cable onto 3 gel electrodes and peel off their plastic backings. Place the IN+ electrode on your forehead (between Fp1 and Fp2 positions). Place the IN- and REF electrodes on the bony areas behind your earlobes.

Electrode Placement Diagram

Step 5: Connect Development Board

Use jumper cables to connect the BioAmp EXG Pill to your Arduino Uno / Maker Uno.

CRITICAL: Double-check your VCC and GND connections. Reversing them can permanently damage your sensor.

  • VCC = 5V
  • GND = GND
  • OUT = A0

Wiring Diagram

Software connection steps:

Step 1: Clone the Repository

git clone https://github.com/CoffeeIsAllYouNeed/Invisible-Driver 
cd Invisible-Driver

Step 2: Install dependencies

pip install -r requirements.txt

Step 3: Flash Hardware

  1. Connect EEG hardware module to computer via USB.
  2. Open the file located at hardware/eeg.ino using the Arduino IDE.
  3. Select board type and active communication port.
  4. Click Upload to flash the code into the hardware.

Step 4: Run the following command in terminal

uvicorn server:app --reload --port 8000

Step 5: Navigate to the Game Platform to Drive with Brain

Navigate: http://127.0.0.1:8000

Directory structure:

Invisible-Driver/
├── .github/
│   └── workflows/
│       └── python-package-conda.yml # CI pipeline configuration.
├── data/                    # Stores sample data & live data.
│   ├── data.csv             # Sample 5 min data for simulation.
│   └── signal.parquet       # Live data.
├── docs/                    # documentation.
│   ├── evaluation.md        # documentation for evaluation method & results.
│   ├── feature_engineer.md  # documentation for feature engineering.
│   ├── game.md              # documentation for game logic.
│   ├── hardware.md          # documentation for hardware & data collection.
│   ├── ingestion.md         # documentation for data ingestion.
│   ├── prediction.md        # documentation for model training.
│   ├── preprocess.md        # documentation for data preprocessing.
│   └── README.md            # Updates documentation.
├── hardware/                # hardware scripts.
│   └── eeg.ino              # Arduino C++ sketch for live EEG data fetch.
├── model/                   # Stores pre-trained models.
│   └── model.pkl            # Pre-trained unsupervised model.
├── notebooks/               # Jupyter notebooks for exploration and prototyping.
│   ├── eda.ipynb            # Exploratory Data Analysis.
│   └── prediction.ipynb     # Unsupervised model.
├── src/                     # Pipeline modules.
│   ├── __init__.py
│   ├── feature_engineer.py  # Pipeline step: Feature engineering.
│   ├── ingest.py            # Pipeline step: Data ingestion.
│   ├── prediction.py        # Pipeline step: Model training.
│   ├── preprocess.py        # Pipeline step: Data preprocessing.
│   └── reproducible.py      # Pipeline step: Reproducibility.
├── templates/
│   ├── index.html           # Racing car UI structure
│   ├── script.js            # Frontend logic, WebSocket handling & Canvas rendering
│   └── style.css            # Cyberpunk BCI terminal styling
├── .gitignore
├── environment.yml          # Conda environment configuration.
├── LICENSE                  # Open-source MIT distribution terms
├── README.md                # Project overview.
├── requirements.txt         # Dependencies.
├── run.py                   # Pipeline run file.
├── server.py                # FastAPI server.
├── test_pipeline.py         # Pipeline tests for CI runner execution.
└── test_unit.py             # Unit tests

Pipeline:

Pipeline

Results:

MetricScore
Silhouette Coefficient (↑)0.916
Davies-Bouldin Index (↓)0.114
Calinski-Harabasz Score (↑)1210.847

References:

[1] Wikipedia contributors, "Brain–computer interface," Wikipedia, The Free Encyclopedia, [Online]. Available: https://en.wikipedia.org/wiki/Brain%E2%80%93computer_interface.

[2] Mayo Clinic Staff, "EEG (electroencephalogram) - About," Mayo Clinic, [Online]. Available: https://www.mayoclinic.org/tests-procedures/eeg/about/pac-20393875.

[3] "Brain Waves," ScienceDirect Topics, Agricultural and Biological Sciences, [Online]. Available: https://www.sciencedirect.com/topics/agricultural-and-biological-sciences/brain-waves.

[4] Cleveland Clinic Professional, "Electroencephalogram (EEG): What It Is, Purpose, Procedure & Results," Cleveland Clinic, [Online]. Available: https://my.clevelandclinic.org/health/diagnostics/9656-electroencephalogram-eeg.

[5] J. Melby, "Controlling Video Game Using Brainwaves (EEG)," Instructables. Available: https://www.instructables.com/Controlling-Video-Game-Using-Brainwaves-EEG/

Wanna Chat?