ROS2-based EEG data acquisition, preprocessing, and real-time visualization using Docker
- Docker & Docker Compose
- ROS2 Jazzy
- Python 3.10+
Create the InfluxDB credential file:
nano env_credentials/.env.influxdbRequired credentials:
INFLUXDB_ADMIN_USERNAME=admin
INFLUXDB_ADMIN_PASSWORD=YourSecurePassword123!
INFLUXDB_ORG=healthcare
INFLUXDB_BUCKET=eeg_data
INFLUXDB_ADMIN_TOKEN=your-secure-token-2026!
INFLUXDB_RETENTION_MINUTES=5python3 nodes/visualization/dashboard/generate_dashboard.pydocker-compose up -dServices started:
- InfluxDB on port 8086 (time-series database)
- Nginx on port 8080 (web dashboard)
Open: http://localhost:8080
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ROS2 Native Layer โ
โ โ
โ EEG Simulator (150 Hz) โ
โ โ โ
โ Preprocessing (0.5-45 Hz bandpass, CAR) โ
โ โ โ
โ InfluxDB Bridge (writes per-sample points) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Docker Container Layer โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โInfluxDB 2.8 โ โโโโ โ Nginx (Alpine) โ โ
โ โPort 8086 โ โ Port 8080 โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ Web Dashboard (poll 50ms) โ
โ http://localhost:8080 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- EEG Simulator generates 4-channel data at 150 Hz
- Preprocessor filters and applies CAR (Common Average Reference)
- InfluxDB Bridge writes per-sample values to InfluxDB
- Web Dashboard queries InfluxDB and visualizes in real-time
| Node | Topic | Description |
|---|---|---|
| eeg_simulator | /eeg/raw |
150 Hz 4-channel EEG generation |
| eeg_preprocessing | /eeg/processed |
0.5-45 Hz bandpass + CAR |
| eeg_influxdb_bridge | - | Writes to InfluxDB for web viz Auto-cleanup: Keeps only last 5 minutes |
| Service | Port | Purpose |
|---|---|---|
| influxdb | 8086 | Time-series database |
| nginx | 8080, 8443 | Web server for dashboard |
# Start Docker containers + simulator + preprocessing + InfluxDB bridge
USE_INFLUXDB=1 ./launch/start.shOpen browser: http://localhost:8080
Features:
- Real-time 4-channel EEG visualization
- Raw and preprocessed overlays
- Polling 50ms (best-effort rendering)
# Stop Docker containers
docker-compose down
# Stop ROS2 nodes with Ctrl+C in each terminalEdit env_credentials/.env.influxdb:
# InfluxDB Configuration
INFLUXDB_ADMIN_USERNAME=admin
INFLUXDB_ADMIN_PASSWORD=YourPassword
INFLUXDB_ORG=healthcare
INFLUXDB_BUCKET=eeg_data
INFLUXDB_ADMIN_TOKEN=your-token
# Data Retention (Production - prevents database from filling up)
INFLUXDB_RETENTION_MINUTES=5 # Auto-delete data older than 5 minutes
# InfluxDB Connection (for bridge)
INFLUXDB_URL=http://localhost:8086Edit docker-compose.yml to change ports:
nginx:
ports:
- "8080:80" # HTTP: Change left side
- "8443:443" # HTTPS: Change left side.
โโโ docker-compose.yml # Docker services configuration
โโโ env_credentials/ # Credential files (git-ignored)
โ โโโ .env.influxdb # InfluxDB credentials
โโโ nodes/
โ โโโ data_acquisition/
โ โ โโโ eeg_simulator.py # 150 Hz EEG simulator
โ โโโ preprocessing/
โ โ โโโ eeg_preprocessing.py # Signal processing
โ โโโ saver/
โ โ โโโ eeg_influxdb_bridge.py # InfluxDB writer
โ โโโ visualization/
โ โโโ generate_dashboard.py # Dashboard generator
โ โโโ influxdb_realtime_dashboard.template.html
โ โโโ influxdb_realtime_dashboard.html
โโโ nginx/ # Nginx configuration
โโโ logs/ # Node logs
โโโ eeg_data/ # Recorded data (optional)
After changing credentials:
python3 nodes/visualization/dashboard/generate_dashboard.py
docker restart healthcare-nginx# Docker logs
docker logs influxdb -f
docker logs healthcare-nginx -f
# ROS2 node logs
tail -f logs/eeg_simulator.log
tail -f logs/eeg_preprocessing.log
tail -f logs/eeg_influxdb_bridge.logdocker ps
docker-compose ps- Change default credentials in
env_credentials/.env.influxdb - Use strong passwords (min 12 characters, special chars)
- Don't commit
env_credentials/.env.influxdbto git (already in .gitignore) - Use HTTPS in production (configure nginx/ssl/)
For production, the dashboard automatically adapts to your server:
// Dashboard detects server IP automatically
const INFLUXDB_URL = window.location.protocol + '//' + window.location.host;Access: http://your-server-ip:8080
InfluxDB connection: http://your-server-ip:8086
- Sampling Rate: 150 Hz (realistic clinical EEG)
- Dashboard Polling: 50ms (best-effort rendering)
- Data Window: 2 seconds (300 samples)
- Channels: 4 (FP1, FP2, F3, F4)
- Latency: < 10ms typical
# Check if InfluxDB is running
curl http://localhost:8086/health
# Check bridge logs
tail -f logs/eeg_influxdb_bridge.log
# Restart bridge
pkill -f eeg_influxdb_bridge
python3 nodes/saver/eeg_influxdb_bridge.py# Check logs
docker logs influxdb
docker logs healthcare-nginx
# Restart containers
docker-compose restart
# Rebuild if needed
docker-compose down
docker-compose up -d# Check what's using port 8086 or 8080
sudo netstat -tulpn | grep -E '8080|8086'
# Stop conflicting service or change port in docker-compose.ymlThis project is part of the healthcare_ros system developed by SCAI-Lab.
This is a pure Docker application for EEG data visualization:
- Docker Compose manages InfluxDB + Nginx
- ROS2 nodes run natively and write to InfluxDB
- Web dashboard served by Nginx at http://localhost:8080
- No manual installation of InfluxDB or Nginx required
Just configure env_credentials/.env.influxdb, run USE_INFLUXDB=1 ./launch/start.sh, and open the dashboard!