Neuroveil synchronizes brainwaves between participants, allowing them to converge to a shared brain state, and control that brain state to elicit certain effects. Brainwaves are measured via the OpenBCI electrode cap and Cyton receivers and sent to an ESP32 module. Frequencies are selected from the input data and outputted to photo biomodulation glasses and a cymatics generator that visualizes the synchronization state. The data from the ESP32 is also sent to a Qualcomm® RB3 Gen 2 development kit to perform inference on a user’s brain data.
Objective
Our inspiration originates with the Dream Machine from the 60s, a simple flickering light causing profound visual effects, and the plethora of research after it showing health improvements, neuron regeneration, and treatments of mental disease.
Tools
|
Part Name |
Description / Link to purchase |
|
Qualcomm RB3 Gen 2 |
https://www.qualcomm.com/developer/hardware/rb3-gen-2-development-kit |
|
OpenBCI Cyton x2 |
https://shop.openbci.com/products/cyton-biosensing-board-8-channel |
|
OpenBCI Electrode Cap x2 |
|
|
ESP32 x2 |
|
|
WiFi hotspot |
|
|
Speaker |
https://www.simplyspeakers.com/boston-acoustics-style-replacement-a60-a70-woofer-w-875.html |
Source Code
|
Description |
Link |
|
Source Code: GitHubLink for project source code
|
Additional Resources
|
Resource Title |
Link |
|
Sample Python scripts for Qualcomm RB3 Gen 2 |
https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-50/python-sample-applications.html |
|
Connecting to Qualcomm RB3 Gen 2 with Windows Host PC |
|
|
OpenBCI GUI |
|
|
OpenBCI Documentation |
|
|
Arduino IDE |
Build / Assembly Instructions
Windows Host PC
- Install Docker onto Windows host PC
- Clone the GitHub repo to host PC
- Install Python packages that are in the project directory - Synchroflow/python/ai-model-dev
Qualcomm RB3 Gen 2
- Connect host PC to Qualcomm RB3 Gen2 following the instructions at this link
- Setup SSH either over Ethernet or WiFi with PuTTY
- SCP the following files into the same directory on the Qualcomm RB3 Gen2:
- Synchroflow/qualcomm/Docker
- Sychroflow/python/demo/.
OpenBCI Cyton
- Follow OpenBCI documentation to setup connection to PC and stream real-time data: https://github.com/openbci-archive/Docs/blob/master/Tutorials/01-Cyton_Getting%20Started_Guide.md
- Run the command - python3 python/brainflow/brain_serve_delta.py from PC terminal while on 2.4GHz network
ESP-32 (Photobiomodulation glasses)
- Install Arduino IDE
- Upload Arduino/delta_power_wifi.ino to ESP32 on LED glasses
- Repeat this setup on a separate host IP and port for each LED glasses
- Trade glasses so each user gets each other's brain data
ESP-32 (Speaker)
- Upload Arduino/speaker_wifi.py to ESP32 connected to speaker
Project Walkthrough
OpenBCI cap uses Cyton microcontroller to stream raw EEG readings to local web server using WiFi and web sockets
- ESP32s connected to LED glasses and cymatic speaker receive data via the websocket using the delta_power_wifi.ino file. which does:
- converts power values to frequency
- informs glasses to flash at the determined frequency
- outputs the determined frequency to the speaker
- New user data is saved to the host PC, and then sent to the Qualcomm RB3 Gen 2 for inference
- Data was collected by having each team member wear the headset for 5 minutes, and labelling each streaming session by the team member ID (integer 1-5)
- Since there are 5 team members, there is a label for each of the five groups respectively
- Transformer model was then trained on this data
- Test data, generated from a different user wearing the headset, will be analyzed by the transformer model and will infer which team member’s brain data the user’s brain data is most similar to.
Usage Instructions
Host PC
- Streamed data from OpenBCI hardware will be saved locally to Host PC
- Prepare raw data for model by inputting it into Sychroflow/python/ai-model-dev/preprocessdata2.py
- SCP processed user data to Qualcomm RB3 Gen 2 using PuTTY
Qualcomm RB3 Gen 2
- Navigate to directory with all of the project files
- Build Docker container:
- docker build -t docker1 .
- Successful output:
root@qcs6490-rb3gen2-vision-kit:/home# docker build -t docker1 .
Sending build context to Docker daemon 84.53MB
Step 1/9 : FROM python:3.9-slim
---> 4681481d939a
Step 2/9 : WORKDIR /app
---> Using cache
---> 2e16ea6ff179
Step 3/9 : RUN apt-get update && apt-get install -y --no-install-recommends gcc python3-dev && rm -rf /var/lib/apt/lists/*
---> Using cache
---> d4a192d8f33
Step 4/9 : COPY testmodel1.py .
---> Using cache
---> 766bafe9dc4f
Step 5/9 : COPY transformer_model.pth .
---> Using cache
---> 465c27784e66
Step 6/9 : COPY testdata1.csv .
---> Using cache
---> 26eb73918a83
Step 7/9 : RUN pip3 install --no-cache-dir torch pandas numpy scikit-learn
---> Using cache
---> 33674e583de9
Step 8/9 : RUN chmod +x testmodel1.py
---> Using cache
---> 8a37ae73ab38
Step 9/9 : CMD ["python3", "testmodel1.py"]
---> Using cache
---> 61a623845395
Successfully built 61a623845395
- Run Docker container:
- docker run -it docker1
- The following will then happen:
- Docker will install necessary python packages
- testmodel3.py will load in transformer_model.pth and feed it the data from labeled_data.csv
- The loaded model from transformer_model will run inference on the inputted data and output a string result to the command line.
- Successful output:
Loading the entire dataset with progress bar...
Loading data: 100%|█████████████████████████████████████████| 2/2 [00:00<00:00, 2500.00batch/s]
Dataset loaded with 10000 entries.
Scaler file 'scaler.save' not found. Fitting a new scaler.
Scaler fitted and saved to 'scaler.save'.
Scaler Parameters:
Feature-wise Min Values: [0.0000 0.3189 0.9739 0.9927 0.4227 0.5028 0.9808 0.1332]
Feature-wise Max Values: [0.0097 0.3386 1.0000 0.9994 0.4315 0.5105 1.0000 0.1378]
Feature-wise Scale Factors: [102.0408 50.0000 40.0000 160.0000 111.1111 142.8571 50.0000 500.0000]
Feature-wise Min (scaled): [-0.0005 -0.0159 -0.0243 -0.0305 -0.0469 -0.0571 -0.0196 -0.0661]
Original Data Statistics:
Feature Min Max Mean Std
Feature 1 0.0000 0.0098 0.0031 0.0029
Feature 2 0.3189 0.3386 0.3275 0.0051
Feature 3 0.9739 1.0000 0.9865 0.0062
Feature 4 0.9927 0.9994 0.9952 0.0016
Feature 5 0.4227 0.4315 0.4262 0.0022
Feature 6 0.5028 0.5105 0.5062 0.0024
Feature 7 0.9808 1.0000 0.9894 0.0046
Feature 8 0.1332 0.1378 0.1354 0.0014
Scaled Data Statistics:
Feature Min Max Mean Std
Feature 1 0.0000 1.0000 0.3200 0.2976
Feature 2 0.0000 1.0000 0.5198 0.2550
Feature 3 0.0000 1.0000 0.3152 0.1573
Feature 4 0.0000 1.0000 0.3125 0.1002
Feature 5 0.0000 1.0000 0.3889 0.1980
Feature 6 0.0000 1.0000 0.4786 0.1714
Feature 7 0.0000 1.0000 0.4240 0.2300
Feature 8 0.0000 1.0000 0.4400 0.1952
Total groups for inference: 10
Using device: cuda
Starting inference...
Inference Progress: 0%| | 0/10 [00:00<?, ?batch/s]
Inference Progress: 10%|█ | 1/10 [00:00<00:00, 8.50batch/s]
Inference Progress: 20%|██ | 2/10 [00:00<00:00, 8.33batch/s]
Inference Progress: 30%|███ | 3/10 [00:00<00:00, 8.25batch/s]
Inference Progress: 40%|████ | 4/10 [00:00<00:00, 8.14batch/s]
Inference Progress: 50%|█████ | 5/10 [00:00<00:00, 8.05batch/s]
Inference Progress: 60%|██████ | 6/10 [00:00<00:00, 7.98batch/s]
Inference Progress: 70%|███████ | 7/10 [00:00<00:00, 7.91batch/s]
Inference Progress: 80%|████████ | 8/10 [00:00<00:00, 7.85batch/s]
Inference Progress: 90%|█████████ | 9/10 [00:01<00:00, 7.80batch/s]
Inference Progress: 100%|██████████| 10/10 [00:01<00:00, 7.76batch/s]
Inference completed.
EEG data signals are most similar to Rui's EEG data
