If you are an advanced user and looking to work outside the machine learning provided by Crown, then you'll find this guide useful. We're writing this guide with the understanding that the reader knows how to run python3 and work with unfiltered EEG data.
Warning: LSL is experimental and time intervals can vary between samples due to resource constraints on the embedded Linux running within the Crown. Please consider using the Python SDK to send data through LSL instead of the embedded Linux if you run into issues.
Install Virtual Environment
I use a virtual environment for usability and consistency. If you want to as well, I recommend installing virtualenv.
pip3 install virtualenv
If you run into issues, then you may want to run with sudo:
sudo -H pip3 install virtualenv
Create Virtual Environment
I've got a starter project if you want to follow along, you may download it from github.com/neurosity/notion-pylsl-starter. Otherwise, create a new directory for your project. Once you have the starter downloaded or new directory created, run:
Required steps for Notion
We assume you have already:
- Created an account
- Powered on and charged your Notion
- Got your notion online
- Claimed your Notion
- Activated LSL to get EEG data from Notion.
Working with PyLSL
The first step is to install the PyLSL dependency. From your terminal, run:
pip install pylsl
Create a Python File
Make a new file called main.py.
"""Example program to show how to read a multi-channel time series from LSL."""
from pylsl import StreamInlet, resolve_stream
# first resolve an EEG stream on the lab network
print("looking for an EEG stream...")
streams = resolve_stream('type', 'EEG')
# create a new inlet to read from the stream
inlet = StreamInlet(streams)
# get a new sample (you can also omit the timestamp part if you're not
# interested in it)
sample, timestamp = inlet.pull_sample()
except KeyboardInterrupt as e:
Make sure you have
- LSL turned on in the developer console
- Your Notion is online and not charging
- Your computer is on the same computer network as your Notion.
Use the developer console to verify the WiFi network of your Notion:
Then in the terminal run:
Which will automatically find the stream and read data from it!
If you run into any problems or have any suggestions on how to improve this tutorial, please comment below.