Skip to content

infraredblob/BME_CP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Environmental Sensor Test Suite

Real-time monitoring platform for multi-sensor environmental data collection with focus on gas detection and air quality metrics.

Status: Active Development | v0.2.1

Test Case Data Collection

Current Sensor Configuration

Running parallel data streams from two primary sensor modules:

BME690 Environmental Suite

  • Core atmospheric readings: temperature, humidity, barometric pressure
  • VOC detection via integrated MOX sensor
  • 3.3V I2C interface, 0x76/0x77 addressing
  • Sample rate: 1Hz continuous monitoring

BMV080 Particulate Detection

  • Size-segregated particle counting (PM1.0, PM2.5, PM10)
  • Laser scattering measurement principle
  • Detection range: 0-999 μg/m³
  • Response time: <1s for rapid changes

Data Stream Format

Sensor payloads arrive via MQTT in nested JSON structure:

{
  "timestamp": "2025-08-28T14:32:15.234Z",
  "device_id": "polverine_001",
  "data": {
    "T": 23.45,       // Temperature celsius
    "H": 42.3,        // Relative humidity percent
    "P": 1013.25,     // Pressure hectopascals
    "VOC": 187,       // VOC index (0-500 scale)
    "PM1": 8,         // Fine particles μg/m³
    "PM2.5": 12,      // Respirable particles μg/m³
    "PM10": 18        // Coarse particles μg/m³
  },
  "metadata": {
    "battery": 4.12,  // Supply voltage
    "rssi": -65,      // WiFi signal strength
    "uptime": 3847    // Seconds since boot
  }
}

Test Scenarios Captured

Current dataset includes baseline readings from various environments:

  • Indoor ambient: Office/residential baseline (VOC 100-150)
  • Kitchen events: Cooking emissions spike detection
  • Outdoor samples: Traffic proximity measurements
  • Controlled exposures: Alcohol/solvent vapor response curves
  • Smoke detection: Combustion product signatures

Raw CSV logs stored in /logs/ directory with 24-hour rotation policy.

Dashboard Architecture

Core Visualization Stack

Live monitoring interface built on threaded architecture:

MQTT Broker (1883) → Python Client → Thread Pool → Matplotlib Backend
                           ↓
                    CSV Logger → SQLite Archive

Performance Metrics

  • Update frequency: 10 FPS chart refresh
  • Buffer depth: 100-point rolling window per metric
  • Memory footprint: ~150MB with full GUI
  • Latency: <50ms broker to display

Dashboard Features

Primary display shows 7-panel grid layout:

  • Temperature trend with 24hr min/max bands
  • Humidity with comfort zone overlay (40-60% highlighted)
  • Pressure chart with weather change indicators
  • VOC index with air quality thresholds
  • PM2.5 with WHO guideline markers
  • Combined particle size distribution
  • System health indicators (connection, data rate, errors)

Control panel includes:

  • Recording start/stop toggle
  • Threshold alert configuration
  • Export options (CSV, JSON, SQLite)
  • Time window selection (1min to 24hr)

Alert System

Configurable triggers for anomaly detection:

  • VOC spike >300: Potential combustion event
  • PM2.5 >35 μg/m³: Air quality warning
  • Rapid temperature change: >2°C/min slope
  • Sensor dropout: No data >10 seconds

Notifications via system tray and optional webhook integration.

Next Steps: Gas-Specific Model Training

Phase 1: Data Augmentation

Building comprehensive training dataset requires controlled exposures:

Target Gas Library

  • CO: 0-100ppm range, vehicle exhaust sampling
  • Methane: Natural gas leak simulation
  • Ethanol: Breath analyzer correlation
  • Ammonia: Cleaning product detection
  • Smoke: Wood/plastic combustion differentiation

Collection Protocol

  1. Baseline stabilization (30 min ambient)
  2. Controlled exposure introduction
  3. Concentration ramp (10-50-100% of range)
  4. Recovery period monitoring
  5. Multi-gas mixture challenges

Phase 2: Feature Engineering

Raw MOX resistance values need transformation:

features = {
    'resistance_ratio': R_gas / R_baseline,
    'temp_compensated': R * exp(-B * (1/T - 1/T_ref)),
    'derivative': dR/dt over 10s window,
    'fft_components': frequency domain peaks,
    'sensor_array': [MOX1, MOX2, MOX3] ratios
}

Phase 3: Model Architecture

Proposed ML pipeline for gas classification:

Random Forest Baseline

  • 100 estimators, max depth 10
  • Feature importance ranking
  • Cross-validation on time-series splits

LSTM Network

  • Sequence length: 30 samples (30 seconds)
  • Hidden layers: 64-32-16 neurons
  • Output: Gas type + concentration estimate

Ensemble Approach

  • Combine RF instant classification with LSTM temporal patterns
  • Kalman filter for concentration smoothing
  • Confidence scoring based on model agreement

Phase 4: Edge Deployment

Models must run on ESP32 constraints:

  • Quantize to INT8 for 4x size reduction
  • TensorFlow Lite Micro integration
  • <50KB model size target
  • <100ms inference time

Training Infrastructure Requirements

  • GPU workstation for neural network training
  • Gas mixing chamber with mass flow controllers
  • Reference analyzers for ground truth
  • 100+ hours of labeled exposure data
  • Temperature/humidity sweep validation

Expected Outcomes

Target performance metrics:

  • Gas type classification: >95% accuracy on 5 gas types
  • Concentration estimate: ±20% of reference
  • Response time: <10s to 90% of final value
  • False positive rate: <1% in normal air
  • Power consumption: <50mW average

Repository Structure

BME_CP/
├── data/               # SQLite databases
├── logs/               # CSV sensor recordings  
├── models/             # Trained classifiers (future)
├── dashboard_*.py      # Various UI implementations
├── polverine_*.py      # Sensor interface code
├── requirements.txt    # Python dependencies
└── test_sequences/     # Calibration datasets (future)

Hardware Requirements

  • ESP32 with Polverine firmware
  • BME690 + BMV080 sensor modules
  • Stable 3.3V power supply
  • WiFi network for MQTT
  • Mac/Linux host for dashboard

Contact & Collaboration

Research partnership opportunities for gas-specific training welcome. Access to reference gas mixtures and analytical equipment would accelerate model development timeline.

About

First Responder Initiative - Environmental sensor wrapper for gas/smell ML classification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published