mirror of
https://github.com/TheusHen/EEGFrontier.git
synced 2026-04-12 23:05:49 +00:00
Pendulum EEG Suite
This directory/software won't be nessesary a review from HackClub Reviewer
Note for reviwer.
This directory includes software for EEG reading from USB port, not an firmware part.
Pendulum is the host software for EEGFrontier hardware. It follows the firmware
protocol from firmware/ and provides:
- A local Reflex web dashboard (raw data, diagnostics, export tools).
- A desktop pyqtgraph app focused on real-time focus analysis.
- A simulation mode for development without hardware connected.
Stack
- Python 3.11+
- Reflex
- pyserial
- numpy
- scipy
- pyqtgraph + PyQt6
- mne
Setup
cd Pendulum
python -m venv .venv
.venv\Scripts\activate
pip install -U pip
pip install -e .
Run
1) Web dashboard (Reflex)
cd Pendulum
reflex run
Open the localhost URL shown by Reflex.
If you hit frontend bootstrap issues on Windows (bun/npm path), use:
.\run_reflex.ps1
or:
run_reflex.bat
If you need to stop all running Reflex instances:
.\stop_reflex.ps1
2) Desktop focus monitor (pyqtgraph)
With hardware:
python -m pendulum_eeg.pyqt_focus --port COM5
Simulation:
python -m pendulum_eeg.pyqt_focus --simulate
Firmware Protocol (BIN mode)
Packet format:
packet = COBS(raw_packet) + 0x00raw_packet = [type][ver][payload...][crc16_le]
Packet types:
0x01: sample0x02: event0x7F: error
Sample payload:
sample_indexu32t_usu32status24u32ch1..ch4i32flagsu32missed_drdy_frameu32recoveries_totalu32
Export formats
exports/*.csvexports/*.npzexports/*.jsonexports/*.fif(MNE)
Notes
- Default serial baud:
921600 - Default firmware sample rate:
250 SPS - Focus score is a real-time heuristic from EEG bands and should be calibrated per user/protocol for serious studies.