How the System Works?
The weather station operates in three stages:
- Acquiring environmental measurements.
- Processing sensor data.
- Updating the graphical interface.
Sensor measurements are continuously collected and processed by the ESP32-S3. The results are then displayed on the TFT screen.
Environmental Sensing
BME280 Sensor
A BME280 sensor is used to measure:
- Temperature
- Relative humidity
- Atmospheric pressure
Atmospheric pressure measurements are also used to estimate altitude.
The sensor communicates with the ESP32-S3 using the I2C bus, allowing multiple parameters to be obtained through a single device.
Rain Detection
Rainfall monitoring is achieved using an analog rain sensor.
Water droplets alter the conductivity between the tracks on the sensing surface, producing a varying analog voltage. By observing this voltage, the ESP32-S3 determines whether the sensor is dry or exposed to rain.
Ambient Light Monitoring
An LDR module is used to determine surrounding light conditions.
Changes in illumination cause the resistance of the photoresistor to vary, producing corresponding changes in voltage. These measurements allow the system to classify environmental conditions as day or night.
Processing Sensor Data
The ESP32-S3 serves as the central processing unit.
Its tasks include:
- Reading BME280 measurements.
- Acquiring analog values from the rain sensor.
- Measuring ambient light intensity.
- Estimating altitude from atmospheric pressure.
- Detecting rainfall conditions.
- Determining day and night status.
- Updating the display.
Continuous acquisition and processing ensure that the information shown on the dashboard remains current.
Graphical User Interface
The dashboard is implemented using LVGL (Light and Versatile Graphics Library).
Instead of displaying raw values on a serial monitor, LVGL allows information to be organized into cards, labels, and icons. The interface displays:
- Temperature
- Humidity
- Pressure
- Altitude
- Rain status
- Day/night indication
The result is a weather station that feels much closer to a finished product than a prototype.
Hardware
The project uses:
- ESP32-S3 Smart Display
- BME280 Sensor
- Rain Sensor
- LDR Module
- Breadboard
- Jumper Wires
Since the display module already contains the controller and screen, the external hardware remains minimal.
Circuit Connections
The BME280 communicates through the I2C interface.
Connections:
- VCC → 3.3 V
- GND → GND
- SDA → GPIO9
- SCL → GPIO10
The rain sensor uses its analog output connected to GPIO7.
Connections:
- VCC → 3.3 V
- GND → GND
- AO → GPIO7
The LDR module is connected to GPIO6.
Connections:
- VCC → 3.3 V
- GND → GND
- AO → GPIO6
All sensors operate from the same 3.3 V supply and share a common ground.
Software Architecture
The firmware is based on ESP-IDF and follows a modular structure.
main.cpp
This file acts as the application entry point and is responsible for:
- Initializing the display.
- Configuring LVGL.
- Creating dashboard elements.
- Updating the screen with the latest measurements.
sensors.c
This module handles sensor-related operations.
Functions include:
- Reading BME280 measurements.
- Pressure-based altitude estimation.
- Rain sensor acquisition.
- Light intensity measurements.
- Environmental condition classification.
Keeping sensor handling separate from the user interface improves maintainability and makes future modifications easier.
Possible Extensions
The same architecture could easily be expanded with:
- Data logging
- Wi-Fi connectivity
- MQTT communication
- Cloud dashboards
- Weather forecasting
- Home automation integration
Project Resources
The complete implementation, including source code, ESP-IDF setup, firmware flashing instructions, and detailed circuit explanations, is documented on Play with Circuit.
The full article also contains project structure explanations and code walkthroughs for anyone interested in extending the design.
Akshay Jain
mircemk
mikesoniat
electronicsworkshops
Botorabi