Skip to main content

Chords - Python

Chords- Python is an open-source bag of tools designed to interface with Micro-controller development boards running Chords Arduino Firmware. Use Upside Down Labs bio-potential amplifiers to read data, visualize it, record data in CSV Files, and stream it via Lab Streaming Layer.

Features

  • Multiple Protocols: Supports Wi-Fi, Bluetooth, and Serial communication.
  • LSL Data Streaming: Once the LSL stream starts, any PC on the same Wi-Fi network can access the data using tools like BrainVision LSL Viewer.
  • CSV Logging: Save raw data with Counter
  • GUI: Live plotting for all channels.
  • Applications: EEG/ECG/EMG/EOG-based games and utilities (e.g., Tug of War, Keystroke Emulator).

Installation

  • Make sure you have the latest version of Python installed.

  • Open command prompt and run:

python -m venv .venv
.venv\Scripts\activate         # For Windows
source .venv/bin/activate      # For MacOS/Linux

[!IMPORTANT] You may get an execution policy error if scripts are restricted. To fix it, run:

Set-ExecutionPolicy Unrestricted -Scope Process
pip install chordspy

Usage

Run the command and access the web interface:

chordspy  

Web Interface Preview:
Web Interface Screenshot

Web Interface Screenshot

[!Optional]

If you want to run the individual scripts, then follow these steps:

  • Open command prompt and run:
python -m venv .venv
.venv\Scripts\activate         # For Windows
source .venv/bin/activate      # For MacOS/Linux

[!IMPORTANT] You may get an execution policy error if scripts are restricted. To fix it, run:

Set-ExecutionPolicy Unrestricted -Scope Process
pip install -r requirements.txt

Usage

Run the command and access the web interface:

python -m chordspy.app  

Run the command to start the LSL Stream only:

python -m chordspy.connection --protocol ble    # For BLE
python -m chordspy.connection --protocol wifi   # For WiFi
python -m chordspy.connection --protocol usb    # For USB

Then, in a new terminal, run any application you need:

python -m chordspy.gui       # For GUI
python -m chordspy.ffteeg    # For EEG with FFT

Key Options:

  • LSL Streaming: Choose a protocol (Wi-Fi, Bluetooth, Serial).
  • CSV Logging: Data saved as ChordsPy_{timestamp}.csv.
  • Applications: Multiple Applications can be Launch from the Interface simultaneously(e.g., EEG Tug of War).

Connection Guide

WIFI Connection

  1. Upload the NPG-Lite WIFI Code to your device.
  2. Connect to the device's WIFI network.
  3. Click the WIFI button in the interface, then select CONNECT.
  4. Once connected, the button will change to Disconnect, and a pop-up will confirm: "Connected via Wifi!"

Bluetooth Connection

  1. Ensure Bluetooth is turned ON on your system.
  2. Upload the Bluetooth code to your device.
  3. Click the Bluetooth button to scan for available devices.
  4. Select your device from the list and click Connect.
  5. Once connected, the button will change to Disconnect, and a pop-up will confirm: "Connected via Bluetooth!"

Serial Connection

  1. Ensure Bluetooth is OFF and the device is connected via USB.
  2. Upload the required code to your hardware.
  3. Click the Serial button, then select Connect.
  4. Once connected, the button will change to Disconnect, and a pop-up will confirm: "Connected via Serial!"

CSV Logging

To save sensor data for future analysis, follow these steps:

  1. Start Data Streaming – Begin streaming data via WiFi, Bluetooth, or Serial.
  2. Start Recording – Click the Start Recording button (it will change to Stop Recording).
  3. File Saved Automatically – The data is saved as ChordsPy_{timestamp}.csv in your default folder.

Visualizing CSV Data - You can plot the recorded data using the CSV Plotter tool.

Applications

Application Description
ECG with Heart Rate Real-time ECG with BPM calculation.
EMG with Envelope Real-time EMG Visualization with Envelope.
EOG with Blinks Real-time EOG Signal visualization with Blinks marked as Red Dot.
EEG with FFT Real-time EEG Signal visualization with FFT and Brainpower bands.
EEG Tug of War Game 2 Player EEG Based Game
EEG Beetle game Real-time EEG focus-based game.
EOG Keystroke Emulator Blink detection triggers spacebar.
GUI Visualize raw data in real-time
CSV Plotter Tool to plot the recorded CSV Files
Morse Decoder Convert Blinks and eye movements into morse code using EOG signals.

Troubleshooting

  • Arduino Not Detected: Ensure the Arduino is properly connected and powered. Check the serial port and baud rate settings.
  • CSV File Not Created: Ensure you have write permissions in the directory where the script is run.
  • LSL Stream Issues: Ensure that the pylsl library is properly installed and configured. Additionally, confirm that Bluetooth is turned off.

How to Contribute

You can add your project to this repo:

  • Add a button in apps.yaml to link your application.
  • Include your script as a .py file with LSL Data Reception code. (Pull requests welcome!)

Contributors

We are thankful to our awesome contributors, the list below is alphabetically sorted.

The audio file used in game.py is sourced from Pixabay

Metadata

Release files for chordspy 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chordspy 0.2.1
File Size Uploaded
chordspy-0.2.1.tar.gz 11.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for chordspy 0.2.1
File Interpreter ABI Platform
chordspy-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.2 MB

Release files / chordspy-0.2.1.tar.gz

Download URL chordspy-0.2.1.tar.gz
Size 11.6 MB
Tags Source
SHA-256 checksum
How to use checksums
e904ceea6b61609307eca67e342dc700ce50d629041d51a13253a112a1ac112c
BLAKE2b-256 checksum
How to use checksums
86afa73abebb0c354a96231885e3a0642aac481760a8effea40e2c3e0c5ba540
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / chordspy-0.2.1-py3-none-any.whl

Download URL chordspy-0.2.1-py3-none-any.whl
Size 11.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
47273d70ea07c70cf92b0fa94487e93b6a3e623412f746be78c60725869ced14
BLAKE2b-256 checksum
How to use checksums
2e1ce7a174a78f287b7bb51f1e3c8abf47b547877d7208275db236ba9df6dd09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.2

2 release files

This release

0.2.1 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page