mirror of
https://github.com/TheusHen/EEGFrontier.git
synced 2026-04-12 23:05:49 +00:00
- Implemented mne_tools.py for converting sample records to MNE Raw format. - Created models.py to define data structures for sample, event, and error packets. - Developed pyqt_focus.py for a PyQt-based focus monitoring GUI with real-time EEG data visualization. - Added eflex_bridge.py to manage the EEG engine instance. - Introduced simulator.py to simulate EEG data packets for testing purposes. - Established a web dashboard in pendulum_web.py for live EEG data display and diagnostics. - Configured project dependencies in pyproject.toml and equirements.txt. - Added batch and PowerShell scripts for running and stopping the Reflex application. - Created xconfig.py for Reflex application configuration.
1.9 KiB
1.9 KiB
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.