Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
333b596
Added Sphero Functionality
VinceIngram07 Jan 28, 2025
084a74c
More Controls
VinceIngram07 Feb 25, 2025
6da0b3e
changed block names to fit project
VinceIngram07 Mar 31, 2025
f96cd4a
Start of Vex Branch
VinceIngram07 May 25, 2025
94021c8
added block functionality
VinceIngram07 Jun 1, 2025
b031569
Add support for Gaglion
chris35469 Jun 15, 2025
cb6eefa
Merge branch 'feature/ganglion' into VEXAIM
VinceIngram07 Jun 15, 2025
46af284
Added muscle energy block
VinceIngram07 Jun 17, 2025
2fe7c87
Merge branch 'VEXAIM' into feature/ganglion
VinceIngram07 Jun 17, 2025
1950b33
Python server starts automatically
VinceIngram07 Jun 23, 2025
ceb24df
[UNSTABLE] Exe python
VinceIngram07 Jun 25, 2025
e44b1e1
Revert "[UNSTABLE] Exe python"
VinceIngram07 Jul 8, 2025
c54884c
Added Vex Files
VinceIngram07 Jul 8, 2025
370adce
fixed startup error
VinceIngram07 Jul 8, 2025
762a32b
added turn left/ right block and Vex Category
VinceIngram07 Jul 9, 2025
42d6f44
added venv setup
VinceIngram07 Jul 9, 2025
dae3186
Update requirements.txt
VinceIngram07 Jul 9, 2025
076764b
Update requirements.txt
VinceIngram07 Jul 9, 2025
b1f1bd2
Update requirements.txt
VinceIngram07 Jul 9, 2025
eea135d
updated vex category
VinceIngram07 Jul 10, 2025
f70d531
added start bash script
VinceIngram07 Jul 10, 2025
4f79cf2
Added NeuroScope Icon
VinceIngram07 Jul 10, 2025
2510906
Update signal.js
chris35469 Jul 10, 2025
11fb9b1
Merge branch 'feature/ganglion' of https://github.com/htil/neuroscope…
chris35469 Jul 10, 2025
4013a5b
Camp Neuroscope EMG V1.0
VinceIngram07 Jul 11, 2025
5f2c31c
Removed command delay
VinceIngram07 Jul 11, 2025
9f3935c
Revert "Add support for Gaglion"
VinceIngram07 Jul 16, 2025
f0e37c6
Fix production build path and add Python server integration for execu…
VinceIngram07 Sep 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ yarn-error.log
.pnp.js
# Yarn Integrity file
.yarn-integrity
*.pyc

build

build
# Ignore virtual environments
venv/
/resources/python/vex/__pycache__
145 changes: 145 additions & 0 deletions BUILD_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# NeuroBlock Build Guide

This guide explains how to build NeuroBlock as a Windows executable with an integrated Python server.

## Build System Overview

NeuroBlock now supports building as a standalone Windows executable that includes:
1. **Electron App**: The main GUI application
2. **Python Server**: A WebSocket server that controls the VEX robot

## Prerequisites

1. **Node.js and Yarn**: For building the Electron application
2. **Python 3.10+**: For building the Python server executable
3. **Git**: For version control

## Quick Start

### 1. Install Dependencies

```bash
# Install Node.js dependencies
yarn install

# Configure Python environment (creates virtual environment)
# This will be done automatically when you run the build scripts
```

### 2. Build Everything

```bash
# Build both Python executable and Electron app
yarn build:all
```

This command will:
1. Create a Python virtual environment
2. Install Python dependencies
3. Build a standalone Python executable (`VEXServer.exe`)
4. Build the Vue.js renderer
5. Package everything into a Windows installer

## Individual Build Commands

### Python Server Only
```bash
yarn build:python
```
Creates: `dist/python/VEXServer.exe`

### Vue.js Renderer Only
```bash
yarn build
```
Creates: `build/renderer/` directory with compiled assets

### Windows Executable Only
```bash
yarn build:win
```
Creates: `dist/NeuroBlock Setup 1.3.0.exe`

## Development Mode

```bash
yarn serve
```

This starts:
- Development server for the renderer on `http://localhost:3000`
- Python WebSocket server on `ws://127.0.0.1:8777`
- Electron main process with hot reload

## Build Output

After running `yarn build:all`, you'll find:

- **`dist/NeuroBlock Setup 1.3.0.exe`**: Windows installer
- **`dist/python/VEXServer.exe`**: Standalone Python server
- **`build/renderer/`**: Compiled web assets

## Production Path Fix

The main issue that was resolved:
- **Before**: Main process tried to load from `../renderer/index.html`
- **After**: Main process loads from `../../build/renderer/index.html`
- **Method**: Changed from `win.loadURL()` to `win.loadFile()` for better path resolution

## Python Server Integration

The Python server is automatically started by the Electron main process:

- **Development**: Uses `python` command with source files
- **Production**: Uses bundled `VEXServer.exe` executable
- **Communication**: WebSocket on port 8777
- **Fallback**: If bundled executable not found, falls back to system Python

## Architecture

```
NeuroBlock.exe (Electron Main Process)
├── Renderer Process (Vue.js UI)
└── Python Server (VEXServer.exe)
└── WebSocket Server (port 8777)
└── VEX Robot Control
```

## Troubleshooting

### White Screen Issue
If you see a white screen, the renderer path is incorrect. This has been fixed by updating the main process to use the correct build directory.

### Python Server Not Starting
1. Check if Python is installed
2. Ensure all Python dependencies are installed
3. Check console for Python error messages
4. Verify port 8777 is not in use

### Build Failures
1. Run `yarn install` to ensure all dependencies are installed
2. Check that Python virtual environment is properly configured
3. Ensure sufficient disk space for build process

## File Structure

```
neuroscope/
├── src/main/index.js # Electron main process (updated)
├── package.json # Build configuration (updated)
├── VEXServer.spec # PyInstaller specification (new)
├── requirements.txt # Python dependencies (updated)
├── dist/ # Build output
│ ├── NeuroBlock Setup 1.3.0.exe
│ └── python/VEXServer.exe
└── build/renderer/ # Compiled web assets
```

## Key Changes Made

1. **Fixed production build path** in `src/main/index.js`
2. **Added Python executable support** with fallback to source files
3. **Updated electron-builder configuration** to include build directory
4. **Created PyInstaller spec file** for better Python build control
5. **Added comprehensive build scripts** for different scenarios
6. **Improved error handling** and process cleanup
Binary file added Neuroscope-EMG.lnk
Binary file not shown.
14 changes: 14 additions & 0 deletions Neuroscope.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off
setlocal

REM This script should be placed inside the neuroscope-emg folder

echo Starting Neuroscope EMG...

REM Activate virtual environment
call venv\Scripts\activate.bat

REM Start the application
yarn serve

pause
114 changes: 111 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,113 @@
# Readme
# Neuroscope

TODO
Neuroscope is an Electron-based application for real-time EEG/BCI signal visualization, feature extraction, and device connectivity using Bluetooth-enabled headsets like **OpenBCI Ganglion**. It features a Blockly-based visual programming interface for custom workflows and supports VEX and Ganglion devices.

Project builds on [this boiler plate](https://github.com/a133xz/electron-vuejs-parcel-boilerplate).
---

## Features

- **EEG Device Support:** Connect to OpenBCI Ganglion headsets via Bluetooth.
- **Real-Time Visualization:** View EEG and telemetry data live.
- **Blockly Programming:** Drag-and-drop blocks for custom signal processing and logic.
- **Extensible:** Easily add new blocks or device integrations.

---

## Getting Started

### Prerequisites

- [Node.js](https://nodejs.org/) (v14+ recommended)
- npm or yarn
- Python 3.x (for some optional features)
- Python package: `websockets` (optional, only if using WebSocket features)
- A supported EEG device (OpenBCI Ganglion)

### Installation

1. **Clone the repository:**
```sh
git clone https://github.com/yourusername/neuroscope.git
cd neuroscope
```

2. **Install Node dependencies:**
```sh
yarn install
# or
npm install
```

3. *(Optional, only if using Python WebSocket features)*
**Install Python dependencies:**
```sh
pip install websockets
```

---

## Running the Application

1. **Start the Electron Application**
```sh
yarn serve
# or
npm run serve
```

This will launch the Electron app. In development mode, it will open with hot-reloading and developer tools enabled.

2. **Connect Your EEG Device**
- Click the **Bluetooth** button in the UI.
- Select your **Ganglion** device from the list.
- Wait for the connection confirmation.

---

## Usage

- **Signal Visualization:**
EEG channels are displayed in real time. You can view raw and filtered signals, as well as extracted features (alpha, beta, etc.).

- **Blockly Programming:**
Use the Blockly interface to create custom workflows. Drag and drop blocks for signal processing and feature extraction.

---

## Troubleshooting

- **Bluetooth Issues:**
Make sure your Ganglion device is powered on and not paired with another app. On Windows, you may need to grant Bluetooth permissions.
- **Missing Dependencies:**
If you see errors about missing modules, re-run `yarn install` or `npm install`.
- **Electron Fails to Start:**
Make sure you are using a compatible Node.js version and have all dependencies installed.

---

## Development

- **Hot Reload:**
The app reloads automatically in development mode.
- **Main Process:**
See `src/main/index.js` for Electron main process logic.
- **Renderer Process:**
See `src/renderer/js/` for UI and signal processing code.
- **Blockly Blocks:**
Custom blocks are defined in `src/renderer/js/customblock.js`.

---

## License

MIT License. See [LICENSE](LICENSE) for details.

---

## Acknowledgements

- [OpenBCI Ganglion](https://shop.openbci.com/products/ganglion-board)
- [Blockly](https://developers.google.com/blockly)
- [Electron](https://www.electronjs.org/)

---
55 changes: 55 additions & 0 deletions VEXServer.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

a = Analysis(
['resources/python/VEXServer.py'],
pathex=['resources/python'],
binaries=[],
datas=[
('resources/python/vex', 'vex'),
],
hiddenimports=[
'websockets',
'asyncio',
'json',
'vex',
'vex.vex_globals',
'vex.vex_types',
'vex.vex_messages',
'vex.aim',
'vex.settings'
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)

pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='VEXServer',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
Binary file added neuroIcon.ico
Binary file not shown.
Loading
Loading