How abhilashgeorge-gb/hvac-ai works
Project Type & Purpose
• This is a smart, AI-powered HVAC control system that reads sensor data (temperature, humidity, CO₂, and occupancy) in real time, uses machine learning (including YOLOv8 for occupancy detection) to predict optimal temperature settings, and controls HVAC devices through IoT integration.
• It also offers a live dashboard (built with Flask) for monitoring and managing climate control.
Analyzing the File Structure
• Top-Level: The project root (HVAC-AI) contains a README and a src directory.
• ai_model.py: Contains the AI/ML components that likely handle training, prediction, and pattern analysis.
• hvac_control.py: Manages the interfacing with HVAC devices, probably via GPIO/IoT.
• sensors.py: Handles interfacing with various sensors (temperature, humidity, CO₂, occupancy).
• web_app.py: Implements the Flask-based live dashboard for real-time data visualization.
• main.py: Acts as an entry point that probably orchestrates the integration of these components.
• The __init__.py file indicates that the src directory is treated as a Python package.
Key Architectural Components
a. Sensor Subsystem:
• Responsible for collecting real-time data using libraries like Adafruit_DHT and pyserial.
• Module: sensors.py.
b. AI/Prediction Subsystem:
• Processes sensor data to predict the best temperature control strategy.
• Module: ai_model.py, which involves Scikit-Learn and possibly YOLOv8 for occupancy detection.
c. HVAC Control Subsystem:
• Implements control logic to actuate HVAC devices using GPIO-based relays and MQTT protocols.
• Module: hvac_control.py.
d. Web Dashboard & API:
• Provides a real-time interface for monitoring sensor data and HVAC control.
• Module: web_app.py built with Flask.
e. Orchestration:
• The main.py module likely ties all of these components together, managing the flow of data and control across different parts of the system.
Relationships & Interactions
• Sensors continuously capture environmental and occupancy data, forwarding it to the AI model.
• The AI model (ai_model.py) processes historical and current sensor data to make predictive decisions.
• The HVAC control module (hvac_control.py) receives predictions/commands from the AI module to adjust HVAC equipment.
• The Flask web_app (web_app.py) serves as the front-end dashboard, displaying data retrieved possibly from sensors and reflecting the control actions, while also offering endpoints to view historical data and sensor/API information.
• The main entry point (main.py) may coordinate the startup and continuous interactions among these modules.
Architectural Patterns & Design Principles
• Separation of Concerns: Each module (sensors, AI, HVAC control, web dashboard) handles a distinct functionality.
• Modular Design: The system is broken down into self-contained components making future adaptations or extensions (like adding more sensors or advanced ML algorithms) easier.
• Real-Time Processing: Emphasis on live data flow between sensors, AI decision-making, and HVAC actuation.
• IoT Integration: Interaction with external hardware/components via MQTT and potentially GPIO control on Raspberry Pi.