Skip to content

Keith-Khadar/Gh05t

Repository files navigation

Gh05t

Project Overview

This project aims to design and develop an EEG headset. The headset will have a compact design, integrated into a removable hat to provide comfort and discreteness. It will be equipped with at least 4 electrodes with the modularity to add additional electrodes if required/desired. The electrodes will connect to an ADC purpose designed for measuring weak signals. The samples generated by the ADC will be sampled by a micro-controller. Using an ESP32 (Seeed Studio XIAO ESP32C6), we can communicate wirelessly and sample at high frequency rates for a lower cost. It will communicate with a computer for analysis by a machine learning (ML) model to detect gestures or possibly speech; potentially adding integration with Virtual-Reality. Lastly, the system will also interface with a GUI, allowing users to visualize the EEG data in real-time. We can leverage multiple open-source libraries available through OpenBCI and PiEEG for displaying the GUI.

We provide various levels to users depending on cost and precision:

  • High Performance Microcontroller board with 24-bit ADC: The system captures EEG signals using snap electrodes, processes them with an ESP32, and transmits data via ESP-NOW to an ESP32-C6. The ESP32-C6 relays the 8-channel EEG data to a laptop via serial, where a Python script logs and formats it for OpenBCI GUI visualization.
  • High Cost (Custom ADS1299 PCB): This pipeline provides the high precision that you would receive from the high performance pipeline but with a lower cost on the custom hardware. The pipeline integrates the ESP32 microcontroller as well.
  • Lower Cost (Custom filtering and component circuit): The least expensive pipeline at the cost of precision, is a breadboard/featherboard circuit that integrates instrumentation amplifiers, multiplexers, filters, and RPi Pico w to read 8 channel data. This eliminates the need for custom PCB or expensive chips, allowing the user to choose at home components.

Completed Work/In Progress for Milestone Beta

  • Working High Cost Pipeline (ADS1299 PCB): The communication between the electrodes, ADS1299 PCB, ESP32, and GUI was made successful after the alpha test plan.
    • Work in progress on recovering valid information from the electrode channel readings.
  • Working Low Cost Circuit/Pipeline: A working filtering circuit and communication was completed by connecting a custom electrode headband to the circuit and RPi Pico w.
    • Work in process on creating a stable prototype that connects to the GUI for real-time sampling.
  • Optimizing Real Time Reading on the GUI: The GUI is able to read in real time with minimal frame lag in the plotting features. Latency is prevalent in between the ESP32 SPI sampling and the GUI processing of about 10-15 seconds.
    • Further optimization work in progress during the beta test planning.
  • Working High Performance Pipeline: A high-performance EEG pipeline seamlessly acquires, transmits, and processes brain signals with ultra-low noise and real-time wireless efficiency. Using a EEG ESP32 development board connected to a ESP32 C6, data can be successfully read and processed for valid information using the OpenBCI GUI. Alpha waves (8-10 Hz) were successfully detected, confirming neural activity.
  • Second Version ADS1299 PCB Design: A new design of the custom ADS1299 PCB is created to decrease the size of the first version and have the addition of headers to connect microcontroller directly to for a smaller and more stable package.
    • The design is still being iterated upon and tested before sending for printing.
  • Signal Preprocessing : The EEG signal preprocessing pipeline is fully implemented, ensuring artifact removal, filtering, and independent component extraction before further processing. FastICA, InfoMax, NLMS and VSS-APA are implemented to extract information components from raw EEG signals in real-time.
  • Event Detection/Prediction Model: The EEG-based event detection pipeline and machine learning models have been developed to analyze real-time brain activity and infer motor function. NLMS, Batch-Wiener Filter and VSS-APA have been implemeted for predictions - Statistical Deviation Event Detection Model and Information Theoretic Learning Point Process Detection Models have been implemented for more sophisticed event flagging.

Project Architecture

The architecture of the project is structured as follows:

Hardware-Software

Hardware:


Hardware-BW

  • CAD: Custom electrodes made from conductive PLA
  • PCB: Custom breakout board for ADS1299 ADC
  • Components: ESP32 (Seeed Studio XIAO ESP32C6), Voltage Booster, LiPo Battery

High-Performancce-Board Figure: EEG dataset pipeline from data collection to visualization

Software:


Software

  • BLE(Bluetooth Low Energy): Serialized communication over bluetooth from the Xiao ESP32-C6 to the computer with the GUI or ML model for training.

  • ESP-NOW (WiFi Direct Protocol): Ultra-fast, low-latency wireless communication enabling seamless transmission of high-frequency EEG data between ESP32 modules, ensuring real-time processing and analysis.

  • GUI:

  • EEG Signal Pre-processing:

    • Format:
      • Input: Raw 4 channel electrode data
      • Output: K-Independent Signals (Components)
    • Processing Options:
      • FastICA , NLMS: Fast Inference
      • InfoMax or VSS-APA: Versatility & Robustness
  • EEG Signal Machine Learning:

    • Format:
      • Input: K-Independent Signals (Components)
      • Output: User Defined Target Output
    • Target:
      • User Defined Target Desired Output, i.e. eye activity or motion.
    • Model:
      • Structure: Artifical Neural Network (Regressor)
      • Pre-Training: PCA-Pretraining for optimal features
      • Training: Network Tuning based on Target Data

Known Bugs

  • PCB Data Collection: Unable to collect valid data from the PCB.
    • The ADS1299 PCB is able to communicate channel data to the ESP32 but the data is not consistent with any valid information. This will be debugged during the beta test plan with more iterations on electrode placement, new register values, and SPI clock rates.
  • GUI Real Time Data Reading: Real Time data for the FFT plotting and signal processing.
    • When data is coming in real time, updating the framings between two plots causes extreme latency issues and occasionally causes crashes. Introducing signal processing into the plots will be bugged until the latency and timing issues are optimized.
    • When connecting over BLe, the GUI will successfully connect but then throw an error regarding the BLE characteristic not being found. This is suspected to be a timing issue between the ESP32 registering a connection and the GUI BLE notifications.

Difficulties/Challenges

  • 3D Printing Fail: Weak legs on 3D electrodes

    • The initial model found and used for the electrodes has spindly legs. In combination with two snaps of the filament during printing, the legs were incredibly weak and many snapped during removal from the print bed.
    • Fix: Load filament onto spool to eliminate snapping during print. Custom design electrodes with filleted legs to enhance their strength. Increase the number of walls when slicing model for printing.
    • Above fix solved combined with printing on a higher quality printer and in a different orientation fixed the issues.
  • Snap Plating: Purchased snaps are covered in non-conductive coating

    • Prevented soldering, but can be scrapped off with a knife.
    • Reduces signal integritty of electrodes.
    • Fix: Looking into alternative unplated snap connectors.
    • Above fix solves the issue in initial testing. Will continue to monitor as further testing is conducted.
  • Inaccurate EEG Data: Data recorded during initial testing is inaccurate.

    • The poor quality electrodes(see snap plating challenge & 3d printing fail) as well as the ADC optimized for Electromyography (EMG) data recording instead of the use case of Electroencephalography (EEG), resulted in poor quality data.
    • Fix: Custom designed PCB breakout board for the ADS1299 which is designed for EEG data acquisition.
    • Update: Fix in progress
  • GUI Real Time Data: Optimizing the timing between data conversion from the ADS1299 to the GUI has introduced latency.

    • Update: More testing in progress

License

Contact

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published