Skip to content

miruns/mock1299

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Early Work In Progress This project is currently in active early development and may change frequently. Parts of this project were developed with assistance from an AI coding assistant

Mock1299 — BLE EEG Device Simulator

image

Mock1299 can turn a compatible Bluetooth adapter into a virtual EAREEG device. It advertises over real BLE, accepts connections from miruns-connect, and streams 8-channel EEG data using the exact ADS1299 binary protocol.

On Windows, this requires a Bluetooth adapter that supports BLE peripheral role (GATT server advertising). Many built-in laptop adapters do not support this, so some users will need a compatible BLE USB dongle. If peripheral role is unavailable, Mock1299 can still run in demo mode without BLE advertising.

Quick Start

# Install
pip install -e ".[dev]"

# Launch GUI (default EAREEG profile, eyes-closed mode)
mock1299 start

# Headless mode for scripting
mock1299 start --headless --mode calibration

# Custom profile and edge cases
mock1299 start --profile eareeg --device-name "EAREEG-TEST" --packet-loss 5 --jitter-ms 10

Signal Modes

Mode Description
resting-eyes-open Awake, relaxed, eyes open
resting-eyes-closed Strong posterior alpha rhythm
focused Suppressed alpha, enhanced beta/gamma
drowsy Enhanced theta, declining alpha
meditation Enhanced theta + alpha
flat All channels zero
calibration 10 Hz, 50 µV sine on all channels

Artifacts

Inject artifacts via GUI buttons or headless commands:

  • Eye blink — 100-300 µV bilateral frontal spike
  • Electrode pop — Rail-to-rail spike (±187,500 µV) on single channel
  • 50/60 Hz line noise — Continuous sinusoidal interference

Headless Commands

mock1299 start --headless --mode resting-eyes-closed <<EOF
sleep 5
mode focused
inject blink
artifact-loop blink 4.0 1.5
sleep 30
disconnect
EOF

CLI Reference

mock1299 start [OPTIONS]
  --profile TEXT          Device profile name or TOML path (default: eareeg)
  --mode TEXT             Signal preset (default: resting-eyes-closed)
  --headless              No GUI, stdin commands
  --log-file TEXT         Write JSON logs to file
  --log-level TEXT        debug|info|warn|error
  --device-name TEXT      Override advertised name
  --packet-loss FLOAT     Drop rate percentage
  --jitter-ms FLOAT       Notification timing jitter
  --disconnect-after FLOAT  Auto-disconnect seconds

mock1299 profiles list
mock1299 profiles show <name>

BLE Protocol

Parameter Value
Device name EAREEG
Service UUID 0000fe42-8e22-4541-9d4c-21edae82ed19
Characteristic UUID 0000fe43-8e22-4541-9d4c-21edae82ed19
Payload 120 bytes (5 samples x 8 channels x 3 bytes)
Encoding 24-bit big-endian two's complement
Notification rate 50/sec (250 SPS)
Channels Fp1, Fp2, C3, C4, P3, P4, O1, O2

Development

pip install -e ".[dev]"
pytest
ruff check .
ruff format .

Project Structure

mock1299/
├── core/
│   ├── signal_engine.py    # Multi-channel EEG generation
│   ├── signal_modes.py     # Preset band amplitudes
│   ├── artifacts.py        # Blink, line noise, electrode pop
│   ├── encoder.py          # µV ↔ 24-bit binary encoding
│   ├── noise.py            # 1/f pink noise, channel correlation
│   └── profile.py          # TOML profile loader
├── ble/
│   ├── peripheral.py       # bless GATT server
│   └── notifier.py         # 50 Hz notification scheduler
├── gui/
│   ├── app.py              # DearPyGui main window
│   ├── signal_plot.py      # 8-channel oscilloscope
│   ├── controls.py         # Mode, artifact, edge case controls
│   └── log_panel.py        # Scrolling log viewer
├── cli.py                  # Typer CLI
├── headless.py             # Stdin command interface
└── log.py                  # structlog configuration

About

BLE mock peripheral for EEG app development, streaming ADS1299-style frames

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages