How vohoangdinhkha/weather_station works
Main Components
• Hardware Modules:
• ESP32 Microcontroller: Serves as the central unit running the firmware.
• ILI9225 TFT Display: Communicates over SPI to render interfaces and graphics.
• Sensors and Modules: DHT22 sensor for temperature/humidity, DS1307 RTC for time keeping.
• Input and Output: A physical button (to switch between display interfaces) and a buzzer (for the alarm).
• Communication: Wi-Fi module integrated in ESP32 for network connectivity; this is used to retrieve time-update from an NTP server and weather data via the OpenWeather API.
• External Platforms: The E-RA platform that displays results on the Web/Mobile.
• Software/Firmware Components:
• Main Application: “Mini_Project.ino” drives the overall logic including switching between interfaces.
• FreeRTOS Tasks: The project uses FreeRTOS to handle concurrent tasks like LED light control and data uploads.
Relationships and Interactions
• The central ESP32 communicates with peripheral hardware (sensors, RTC, display, button, buzzer) and external services.
• Data flows:
• Sensor Data Flow: DHT22 sensor readings → ESP32.
• Time Data Flow: DS1307 (and NTP updates when available) → ESP32.
• API Communication: ESP32 connects over Wi-Fi to retrieve weather data from the OpenWeather API.
• Data Presentation: Processed sensor, time, moon phase, and weather data flow from the ESP32 through the SPI protocol → ILI9225 TFT Display.
• User Interaction: Button press events are captured by the ESP32 to toggle between two interfaces.
• FreeRTOS tasks schedule concurrent operations (LEDs and data upload to the E-RA platform).
Architectural Patterns and Design Principles
• Modular Design: Even though there are only a few files, the project logically separates concerns (display management, sensor handling, communication).
• Real-Time Processing: With time-sensitive updates from the RTC, sensors, and API calls.
• Concurrency: Use of FreeRTOS ensures tasks are handled concurrently.
• DHT22 sensor and DS1307 RTC module directly to the ESP32.
• Button as a physical input to the ESP32.
• Buzzer linked for the alarm function.
• External connections:
• Link Wi-Fi from the ESP32 to the NTP server and OpenWeather API.
• ESP32 to an “E-RA Platform” block to represent data uploads for mobile/web display.
• Inside the ESP32 block (or as a separate software layer), show the major tasks scheduled by FreeRTOS and the logical separation of display updates, sensor reading, and network communications.