How aysinemu/weather-prediction-using-machine-learning-based-on-bmp180-sensor-data works
Project Type and Purpose
– This is a full-stack IoT + Machine Learning application with four main parts:
• A Linux kernel driver for the BMP180 temperature/pressure sensor on a Raspberry Pi
• A Python-based data-processing and ML pipeline (data ingestion, feature extraction, model inference)
• A Flask-based web server for visualizing live sensor readings and weather predictions
• A cross-platform Flutter app (Android, iOS, macOS, Windows, Linux) that mirrors the web UI on mobile/desktop
File-Structure Analysis
– Top-level “App/BMP180-Driver” holds:
• Kernel code: bmp180_driver.c, eeprom.c, process.c plus Makefile, Module.symvers
• Python AI folder: ai/ (data.py, model.py, run.py, plus pre-trained .pkl files)
• Web UI: web.py, templates/, static/
• Flutter app under Android/android (multi-platform runner projects for Android, iOS, macOS, Linux, Windows)
• Test app: test_bmp.c
• Env/requirements.txt
– Readme explains: I2C hardware binding, ioctl interface, Python ML steps, web hosting, ngrok tunnel, Flutter build & deploy for Android
Key Architecture Insights from README
– Sensor ↔ Driver via I2C and character device (/dev/bmp180, ioctl commands)
– Python scripts fetch raw data (process.c or direct char-device), run ML models, produce predictions & CSV outputs
– Flask server (web.py) serves templates, static chart.js/CSS, communicates with Python ML modules
– External weather API for scaler or enrichment (worldweatheronline.com)
– ngrok for remote access, Flutter mobile app consumes the same HTTP endpoints
Main Components and Interactions
A. Hardware Layer
• BMP180 sensor on I2C bus
• Raspberry Pi 3B+ board
B. Kernel Layer
• bmp180_driver module registers as a char-device
• Exposes ioctl for READ_TEMP, READ_PRESS
C. User-Space Data Layer
• eeprom utility reads calibration constants
• process.c (optional CLI) or Python run.py reads raw data via /dev/bmp180
D. ML/Analytics Layer
• Python packages: numpy, pandas, scikit-learn, joblib
• Pre-trained models (.pkl) loaded by model.py
E. Web/API Layer
• Flask (web.py)
• Jinja2 templates under templates/
• Static assets (chart.js, CSS) under static/
• Exposes HTTP endpoints for real-time sensor and prediction data
• Optionally secured by simple user/pass
• ngrok tunneling for external access
F. Mobile/Desktop Presentation Layer
• Flutter app in Android/android folder
• Native runners for Android (APK), iOS, MacOS, Linux, Windows
• Fetches JSON via HTTP from Flask server, renders UI similarly to web
Architectural Patterns & Design Principles
– Layered architecture: hardware → kernel → data/ML → web/API → client UI
– Separation of concerns: C code for driver, Python for ML, Flask for HTTP, Flutter for UI
– Plug-in points: ML models can be swapped under ai/model; new sensor drivers can follow same ioctl pattern
– Device-tree binding for kernel module configuration
– Cross-platform UI via Flutter