Chords-Python#
Overview#
Chords-Python is an open-source bag of tools for recording biopotential signals like ECG, EMG, EEG, or EOG, along with visualization using BioAmp hardware. It’s ideal for educational purposes as it promotes DIY Neuroscience and makes biopotential signal exploration more accessible for students and researchers.
Features#
Feature |
Description |
---|---|
Connection |
Supports both wired and wireless connections via Wi-Fi, Bluetooth, or USB (Serial). |
Data Reading |
Reads data packets from development board in real-time, efficiently processing them to prevent data loss and ensure accurate signal representation for analysis and visualization. |
CSV Logging |
Optionally logs incoming data to a CSV file with columns for counter and channel data, enabling easy storage, analysis, and sharing. |
LSL Streaming |
Streams data via Lab Streaming Layer (LSL), a protocol for time-synchronized data sharing. Enables real-time analysis, visualization, or integration with tools like BrainVision. |
Applications |
Provides an interface to run multiple applications simultaneously via the LSL stream. |
Create Custom Application |
Allows users to develop and integrate their own applications with the system. |
Software Requirements#
Arduino IDE – Required to upload the Chords Arduino firmware to your development board.
Python – Ensure you have the most recent version installed.
VS Code or any other code editor (Alternatively, you can use the Command Prompt).
Hardware Requirements#
To use Chords-Python, you need:
A development board (Compatible Boards)
A USB cable (type depends on the board)
BioAmp Hardware and its accessories
Setting up the hardware#
Make all the connections according to the hardware you are using , including sensor connections with the development board, body connections with the sensor, and connections from the development board to your laptop.
Uploading the code#
Once you are all set, it is time to upload the code to your development board. Go to Chords Arduino Firmware GitHub repo, scroll down to the supported boards table, find your board name, and click on the Arduino sketch corresponding to that row. Copy the sketch and paste it into Arduino IDE. Go to tools, select your board, and the correct COM port. Now, hit the upload button.
Opening Chords-Python#
Follow these steps to set up and install Chords-Python:
Ensure you have latest version of Python installed.
Download the GitHub repository:
You can download the Chords-Python repository from GitHub by visiting the following link: Chords-Python.
Or, You can clone the repository using Git by running the following command:
git clone https://github.com/upsidedownlabs/Chords-Python.git
Create a Virtual Environment:
A virtual environment allows you to manage dependencies for your project in isolation.
Open a terminal or command prompt.
Navigate to the directory where you have cloned the repository.
Run the following command to create a virtual environment:
python -m venv venv
- To activate the virtual environment:
On Windows:
.\venv\Scripts\activate
On macOS/Linux:
source venv/bin/activate
Install the Required Python Libraries:
Once the virtual environment is activated, you need to install the required libraries for the project.
In the terminal or command prompt, run the following command to install the dependencies needed to run the python script listed in the requirements.txt file:
pip install -r requirements.txt
This will install all the necessary Python libraries and dependencies for Chords-Python.
To launch the Flask server, run the following command :
python app.py
Click on the generated link to open the web interface.

Interface in Light Mode#

Interface in Dark Mode#
Connection#
The first step is to establish a connection with your device and start the stream.
There are three connection options available:
Wi-Fi
Bluetooth
Serial (USB)
Wi-Fi#
Upload the Wi-Fi firmware through the
Chords-Arduino-Firmware
repositoryTurn on the device and connect to the access point created by the device (e.g.,
npg-lite-2
)In the web interface:
Click the Wi-Fi button
Click the Connect button
A pop-up notification will appear indicating a successful connection.
Bluetooth#
Upload the Bluetooth firmware through the
Chords-Arduino-Firmware
repositoryTurn on the device and enable Bluetooth on your computer
In the web interface:
Click the Bluetooth button
Select your device from the list of available devices
Hit the Connect button
A pop-up notification will appear indicating a successful connection.
Serial (USB)#
Upload the Serial firmware through the
Chords-Arduino-Firmware
repositoryConnect the device to your computer using a USB cable
In the web interface:
Click the Serial button
Click the Connect button
A pop-up notification will appear indicating a successful connection.
Note
The connection step is essential as it initiates the LSL Stream, which is required for running applications.
CSV Logging#
The raw data received from the device can be logged to a CSV file for further analysis or record-keeping. This optional feature can be enabled or disabled in the web interface.
To use CSV logging:
Click the Start recording button to begin logging - A file with name is created
ChordsPy_{timestamp}.csv
in the same folder. - File includes columns for counter and channel dataClick the Stop recording button to end logging - File will be saved in the same folder

CSV Logging#
Applications#
There are many applications available that stream the LSL and can be run for various purposes.
List of available applications:
1. ECG with Heart Rate#
Overview#
The ECG with Heart Rate is a real-time application designed to visualize and analyze Electrocardiogram (ECG) data using the Lab Streaming Layer (LSL) protocol. Built with Python and PyQt5, this application provides a graphical interface for monitoring ECG signals, detecting R-peaks (heartbeats), and calculating the heart rate in real time. It applies signal processing techniques and utilizes the neurokit2 library to estimate R-peak detection and heart rate.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
|
|
A GUI window will appear, displaying the real-time ECG signal along with the calculated heart rate.

Heart Rate with ECG#
2. EMG with Envelope#
Overview#
The EMG with Envelope is a Python-based application designed to visualize and analyze Electromyography (EMG) signals in real-time. It connects to an EMG data stream using the Lab Streaming Layer (LSL) protocol, processes the signal to extract the EMG envelope, and displays both the filtered EMG signal and its envelope in a user-friendly graphical interface. Built with PyQt5 and pyqtgraph, the application provides a responsive and interactive visualization tool for students, researchers, or developers working with EMG data.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
|
|
A GUI window will appear, displaying the real-time EMG signal along with the calculated EMG Envelope.

EMG with Envelope#
3. EOG with Blinks#
The EOG with Blinks is a Python-based application designed to visualize and detect eye blinks in real-time using Electrooculography (EOG) signals. Built with the PyQt5 framework and PyQtGraph for plotting, the application connects to an LSL (Lab Streaming Layer) stream to acquire EOG data, processes the signal using a low-pass filter, and detects blinks based on dynamic thresholds. The application provides a dual-plot interface to display the filtered EOG signal and detected blinks, making it a useful tool for real-time monitoring and analysis of EOG data.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
A GUI window will appear, displaying the real-time EOG signal along with the Blinks marked as Red dot.

EOG with Blinks#
4. EEG with FFT#
Overview#
The EEG with FFT and Brainwave Power is a Python-based application designed to visualize and analyze Electroencephalography (EEG) signals in real-time. It connects to an EEG data stream using the Lab Streaming Layer (LSL) protocol, processes the signal to remove noise, and performs Fast Fourier Transform (FFT) to compute the power of different brainwave frequency bands (Delta, Theta, Alpha, Beta, and Gamma). The application provides a graphical user interface (GUI) built with PyQt5 and pyqtgraph for real-time visualization of raw EEG signals, FFT results, and brainwave power distribution.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
|
|
A GUI window will appear, displaying the real-time EEG signal along with the calculated FFT and Brainwave power distribution.

EEG with FFT#
5. EEG Tug of War Game#
Overview#
The EEG Tug of War Game is a Python-based application that leverages Electroencephalography (EEG) signals to create an interactive two-player game. Players control the movement of a ball on the screen by modulating their brain activity, specifically the Alpha and Beta frequency bands. The game uses the Lab Streaming Layer (LSL) protocol to acquire real-time EEG data, processes the signals to calculate relative power in the Alpha and Beta bands, and translates these into forces that move the ball. The first player aims to push the ball onto the opponent’s side to score and win the game. The application is built using the pygame library for the graphical interface and integrates with pylsl for EEG data acquisition.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
|
|
The game window will open, featuring buttons for START/RESTART, PLAY/PAUSE, and EXIT. These buttons offer intuitive control, allowing players to easily start, pause, resume, or exit the game as needed.

EEG Tug of War#
For detailed instructions, check out the EEG Tug of War Game Instructable.
6. EEG Beetle Game#
Overview#
The EEG Beetle Game is a Python-based application that uses Electroencephalography (EEG) signals to control a beetle’s movement in a 2D game environment. The game leverages the Lab Streaming Layer (LSL) protocol to acquire real-time EEG data, processes the signal to detect the user’s focus level, and translates it into upward or downward movement of the beetle. The application is built using the pygame library for the game interface and integrates signal processing techniques to analyze EEG data in real-time.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
A GUI window will appear, showing all calibration messages, followed by the game starting, and finally displaying the game with the beetle.

EEG Beetle Game#
7. GUI#
Overview#
The GUI application is a Python-based tool designed to visualize real-time data streams from an Arduino device using the Lab Streaming Layer (LSL) protocol. The application connects to an LSL stream, retrieves multi-channel data, and plots it in real-time using the pyqtgraph library.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
A GUI window will appear that shows the data in real-time.

GUI#
8. EOG Keystroke Emulator#
Overview#
The EOG Keystroke Emulator is a Python-based application designed to detect eye blinks using Electrooculography (EOG) signals and translate them into keystrokes. The application leverages the Lab Streaming Layer (LSL) protocol to acquire real-time EOG data, processes the signal to detect blinks, and simulates a spacebar press whenever a blink is detected. The application is built using the tkinter library for the graphical user interface (GUI) and integrates with pyautogui for keystroke emulation.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
A small window appears in the corner, displaying a Connect button. Once connected, a Start button becomes visible. Pressing the Start button initiates blink detection, and each detected blink triggers a spacebar key press.

Keystroke Emulator#
9. CSV Plotter#
Overview#
The CSV Plotter is a Python-based application designed to visualize data from CSV files. Built using the tkinter library for the graphical user interface (GUI) and plotly for data visualization, this tool allows users to load CSV files, select specific data channels, and generate interactive line plots.
Features#
Features |
Description |
---|---|
|
|
|
|
|
|
|
|
A small pop-up will appear, providing options to load the file, select the channel, and plot the data.

CSV Plotter#
Create Custom application#
You can create custom applications using the provided framework by following these steps:
Configure Application Metadata:
Edit the apps.yaml
file in the config
folder with your application details:
- title: "Your Application Title"
icon: "path/to/your/icon.png"
color: "your_hex_color"
script: "path/to/{app_name}.py"
description: "Brief description of your application"
category: "Your Category"
Add this as a new entry in the YAML list. Replace all placeholders with your actual application details.
Note
The
icon
path should be relative to the application root directorycolor
should be in HEX format (e.g., “#FF5733”)The
script
path should point to your Python file
Create application script:
Create a new Python script in the main directory with your application name. The script should contain:
LSL stream connection handling to receive device data
User interface components using PyQt5/PyQtGraph
Data processing logic for incoming signals
Tip
Use the existing applications in the repository as reference implementations for: - lsl setup and data acquisition - Advanced UI layouts - Signal processing examples - Performance optimization