Skip to Content
FeaturesServer

Server Features

FeatureDescription
250 Hz streamingWebSocket (ws://<host>:1616), plain JSON, language-agnostic
8 & 16 channelPiEEG-8 / PiEEG-16 shields (SPI) and IronBCI / EAREEG headsets (8 ch, Bluetooth LE)
Bandpass filterButterworth IIR (SOS), per-channel state, adjustable live via WebSocket
CSV recordingStart/stop from dashboard or CLI; auto-timestamped; optional duration limit
Session annotationsText notes on any frame; sidecar .annotations.json
Terminal monitorRich TUI with per-channel sparklines and µV readout; works over SSH
Mock modeRealistic synthetic EEG (alpha rhythm, drift, noise, blink artifacts)
AuthenticationOptional 6-digit code, rate limiting, HMAC timing-safe verify, HttpOnly cookies
VRChat OSCBand powers via UDP OSC; chatbox + avatar parameters; rolling normalization
LSLPush raw samples to LSL network; discoverable by OpenViBE, MNE, LabRecorder
WebhooksHTTP callbacks on EEG events; IFTTT & Zapier presets; per-rule cooldown
Self-diagnosticspieeg-server doctor checks Pi model, SPI/GPIO, ports, deps, systemd
Self-updateDetects pip/git install; checks PyPI or remote; one-click upgrade from dashboard
Systemd serviceAuto-starts on boot; standard systemctl management
Zero-dep GPIODirect Linux chardev v1 ioctl; stable ABI since Linux 4.8
Spike rejectionAuto-resets after sustained electrode contact changes
Cloud-readyDockerfile + Fly.io config for mock-mode demo hosting

Architecture

hardware.py → SPI/GPIO init, ADS1299 config (PiEEG) ironbci.py → BLE scan, GATT notifications, ADS1299 parsing (IronBCI) acquisition.py → 250 Hz read loop (background thread) ↓ pub/sub ├── server.py → WebSocket broadcast ├── recorder.py → CSV writer ├── monitor.py → Terminal sparklines ├── osc_vrchat.py → VRChat OSC bridge └── lsl.py → Lab Streaming Layer outlet webhooks.py → event rules + HTTP relay dashboard.py → HTTP server (React UI) auth.py → session + WS token management filters.py → Butterworth bandpass (SOS) updater.py → version check + upgrade doctor.py → system diagnostics

Data Flow

  1. Hardware/Mock/BLEAcquisitionLoop (threaded, 250 Hz)
  2. Each sample: 8 or 16 channels of float values in µV
  3. Subscription-based queue system — each subscriber gets its own asyncio.Queue
  4. Subscribers: WebSocket server, recorder, monitor, OSC, LSL
  5. WebSocket broadcasts plain JSON to all connected clients

Tech Stack

LayerTech
LanguagePython 3.10+ (asyncio)
WebSocketwebsockets library
Filterscipy Butterworth IIR
Terminal UIrich
GPIODirect /dev/gpiochip ioctl (no dependencies)
DashboardReact 19 + Vite 6