# Chords - Python
Chords- Python is an open-source bag of tools designed to interface with Micro-controller development boards running [Chords Arduino Firmware](https://github.com/upsidedownlabs/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.
> [!NOTE]
> **Firmware Required for Arduino:** [Chords Arduino Firmware](https://github.com/upsidedownlabs/Chords-Arduino-Firmware)
## 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:
```bash
python -m venv venv
```
```bash
venv\Scripts\activate # For Windows
source venv/bin/activate # For MacOS/Linux
```
```bash
pip install chordspy
```
## Usage
Run the command and access the web interface:
```bash
chordspy
```
**Web Interface Preview**:


### 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 |
## 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.
- [Aman Maheshwari](https://github.com/Amanmahe)
- [Payal Lakra](https://github.com/payallakra)
The audio file used in `game.py` is sourced from [Pixabay](https://pixabay.com/sound-effects/brass-fanfare-with-timpani-and-windchimes-reverberated-146260/)
Raw data
{
"_id": null,
"home_page": null,
"name": "chordspy",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Upside Down Labs",
"author_email": "chords@upsidedownlabs.tech",
"download_url": "https://files.pythonhosted.org/packages/c9/e7/d9c256d9d90ab2aef851452bacac88a9fb2e32e2afe92ac2c3730ca0105b/chordspy-0.2.0.tar.gz",
"platform": null,
"description": "# Chords - Python\n\nChords- Python is an open-source bag of tools designed to interface with Micro-controller development boards running [Chords Arduino Firmware](https://github.com/upsidedownlabs/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. \n\n> [!NOTE] \n> **Firmware Required for Arduino:** [Chords Arduino Firmware](https://github.com/upsidedownlabs/Chords-Arduino-Firmware)\n\n## Features \n- **Multiple Protocols**: Supports `Wi-Fi`, `Bluetooth`, and `Serial` communication. \n- **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. \n- **CSV Logging**: Save raw data with Counter \n- **GUI**: Live plotting for all channels. \n- **Applications**: EEG/ECG/EMG/EOG-based games and utilities (e.g., Tug of War, Keystroke Emulator). \n\n\n## Installation\n\n- Make sure you have the latest version of Python installed.\n\n- Open command prompt and run:\n```bash\npython -m venv venv\n```\n\n```bash\nvenv\\Scripts\\activate # For Windows\nsource venv/bin/activate # For MacOS/Linux\n``` \n\n```bash\npip install chordspy\n```\n\n## Usage \nRun the command and access the web interface: \n```bash\nchordspy \n``` \n\n**Web Interface Preview**: \n\n\n\n\n### Key Options:\n\n- **LSL Streaming**: Choose a protocol (`Wi-Fi`, `Bluetooth`, `Serial`). \n- **CSV Logging**: Data saved as `ChordsPy_{timestamp}.csv`. \n- **Applications**: Multiple Applications can be Launch from the Interface simultaneously(e.g., `EEG Tug of War`). \n\n## Connection Guide \n\n#### WIFI Connection \n 1. Upload the NPG-Lite WIFI Code to your device. \n 2. Connect to the device's WIFI network. \n 3. Click the **WIFI** button in the interface, then select **CONNECT**. \n 4. Once connected, the button will change to **Disconnect**, and a pop-up will confirm: *\"Connected via Wifi!\"* \n\n#### Bluetooth Connection \n 1. Ensure Bluetooth is turned ON on your system. \n 2. Upload the Bluetooth code to your device. \n 3. Click the **Bluetooth** button to scan for available devices. \n 4. Select your device from the list and click **Connect**.\n 5. Once connected, the button will change to **Disconnect**, and a pop-up will confirm: *\"Connected via Bluetooth!\"* \n\n#### Serial Connection \n 1. Ensure Bluetooth is OFF and the device is connected via USB. \n 2. Upload the required code to your hardware. \n 3. Click the **Serial** button, then select **Connect**.\n 4. Once connected, the button will change to **Disconnect**, and a pop-up will confirm: *\"Connected via Serial!\"* \n\n## CSV Logging \nTo save sensor data for future analysis, follow these steps: \n1. **Start Data Streaming** \u2013 Begin streaming data via **WiFi, Bluetooth, or Serial**. \n2. **Start Recording** \u2013 Click the **Start Recording** button (it will change to **Stop Recording**). \n3. **File Saved Automatically** \u2013 The data is saved as `ChordsPy_{timestamp}.csv` in your default folder. \n\nVisualizing CSV Data - You can plot the recorded data using the **CSV Plotter** tool. \n\n## Applications \n| Application | Description | \n|----------------------------|------------------------------------------------------------------| \n| **ECG with Heart Rate** | Real-time ECG with BPM calculation. | \n| **EMG with Envelope** | Real-time EMG Visualization with Envelope. |\n| **EOG with Blinks** | Real-time EOG Signal visualization with Blinks marked as Red Dot.|\n| **EEG with FFT** | Real-time EEG Signal visualization with FFT and Brainpower bands.|\n| **EEG Tug of War Game** | 2 Player EEG Based Game |\n| **EEG Beetle game** | Real-time EEG focus based game. |\n| **EOG Keystroke Emulator** | Blink detection triggers spacebar. | \n| **GUI** | Visualize raw data in real-time |\n| **CSV Plotter** | Tool to plot the recorded CSV Files |\n\n## Troubleshooting\n\n- **Arduino Not Detected:** Ensure the Arduino is properly connected and powered. Check the serial port and baud rate settings.\n- **CSV File Not Created:** Ensure you have write permissions in the directory where the script is run.\n- **LSL Stream Issues:** Ensure that the `pylsl` library is properly installed and configured. Additionally, confirm that Bluetooth is turned off.\n\n## How to Contribute\n\nYou can add your project to this repo:\n\n- Add a button in apps.yaml to link your application.\n- Include your script as a .py file with LSL Data Reception code.\n(Pull requests welcome!)\n\n## Contributors\n\nWe are thankful to our awesome contributors, the list below is alphabetically sorted.\n\n- [Aman Maheshwari](https://github.com/Amanmahe)\n- [Payal Lakra](https://github.com/payallakra)\n\nThe audio file used in `game.py` is sourced from [Pixabay](https://pixabay.com/sound-effects/brass-fanfare-with-timpani-and-windchimes-reverberated-146260/)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An open source bag of tools for recording and visualizing Bio-potential signals like EEG, ECG, EMG, or EOG.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/upsidedownlabs/Chords-Python"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fea7387e91407b0a11cdf0a2a414450179cdbddebb8c7b4db0211aedcf57346a",
"md5": "970cde0610d3b6544d31251aa6d6fbf7",
"sha256": "38c20c64fc7732deb38bc8f523be6821376f0361b9c7938bb29d15cbee817b3c"
},
"downloads": -1,
"filename": "chordspy-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "970cde0610d3b6544d31251aa6d6fbf7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.10",
"size": 11599725,
"upload_time": "2025-07-18T11:42:32",
"upload_time_iso_8601": "2025-07-18T11:42:32.566610Z",
"url": "https://files.pythonhosted.org/packages/fe/a7/387e91407b0a11cdf0a2a414450179cdbddebb8c7b4db0211aedcf57346a/chordspy-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c9e7d9c256d9d90ab2aef851452bacac88a9fb2e32e2afe92ac2c3730ca0105b",
"md5": "70f4b6c7da1185ccf0946f058383f460",
"sha256": "a4d69cb0b8102e6818f234668c043f478022118fd91645a25b43730b68ced662"
},
"downloads": -1,
"filename": "chordspy-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "70f4b6c7da1185ccf0946f058383f460",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.10",
"size": 11549784,
"upload_time": "2025-07-18T11:42:35",
"upload_time_iso_8601": "2025-07-18T11:42:35.711790Z",
"url": "https://files.pythonhosted.org/packages/c9/e7/d9c256d9d90ab2aef851452bacac88a9fb2e32e2afe92ac2c3730ca0105b/chordspy-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-18 11:42:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "upsidedownlabs",
"github_project": "Chords-Python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
"==",
"2.1.3"
]
]
},
{
"name": "pylsl",
"specs": [
[
"==",
"1.16.2"
]
]
},
{
"name": "pyserial",
"specs": [
[
"==",
"3.5"
]
]
},
{
"name": "bleak",
"specs": [
[
"==",
"0.22.3"
]
]
},
{
"name": "pyqtgraph",
"specs": [
[
"==",
"0.13.7"
]
]
},
{
"name": "PyQt5",
"specs": [
[
"==",
"5.15.11"
]
]
},
{
"name": "keyboard",
"specs": [
[
"==",
"0.13.5"
]
]
},
{
"name": "scipy",
"specs": [
[
"==",
"1.14.1"
]
]
},
{
"name": "pygame",
"specs": [
[
"==",
"2.6.1"
]
]
},
{
"name": "neurokit2",
"specs": [
[
"==",
"0.2.10"
]
]
},
{
"name": "plotly",
"specs": [
[
"==",
"5.24.1"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"2.2.3"
]
]
},
{
"name": "tk",
"specs": [
[
"==",
"0.1.0"
]
]
},
{
"name": "PyAutoGUI",
"specs": [
[
"==",
"0.9.54"
]
]
},
{
"name": "Flask",
"specs": [
[
"==",
"3.1.1"
]
]
},
{
"name": "psutil",
"specs": [
[
"==",
"6.1.1"
]
]
},
{
"name": "websocket-client",
"specs": [
[
"==",
"1.8.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0.2"
]
]
}
],
"lcname": "chordspy"
}