Integrated Environmental Monitoring System: Living Room & Planted Aquarium

Project Overview and Hardware
🎯 1. Introduction and Objective

This project initially started as two independent projects:

  • Room temperature and humidity monitoring.
  • Aquarium monitoring, including water temperature and TDS (Total Dissolved Solids).

As development progressed, it became clear that it made perfect sense to unify both into a single, centralized, coherent, and more efficient system. The final goal then became:

To simultaneously monitor the living room environment and the aquarium's physical-chemical state, locally in real-time and remotely via a database and web interface.

The system is currently online, stable, and fully functional.

🏗️ 2. General System Architecture

The project relies on a simple yet robust distributed architecture:

  • ESP32‑C6 as the central data acquisition node.
  • Physical sensors connected directly to the ESP32.
  • Graphic LCD for local real-time visualization.
  • Raspberry Pi 4 as server:
    • Data reception via HTTP.
    • Database storage.
    • Python Backend (Flask).
    • HTML Frontend with dynamic charts.
[Sensors] → ESP32‑C6 → Wi‑Fi → Raspberry Pi → Database → HTML / Charts
             ↘ Local LCD (real-time)
🧠 3. Microcontroller — ESP32‑C6 (DFRobot FireBeetle 2)

The ESP32‑C6 is the core of the entire system. It was chosen for its high integration, low power consumption, and Wi‑Fi communication capabilities.

Main functions in the project:

  • Continuous sensor reading.
  • Local value processing.
  • LCD and menu management.
  • Implementation of the alert system (traffic light).
  • Periodic data transmission via HTTP.
  • Remote updates via OTA (Over‑The‑Air).
Parameter Value
MCURISC‑V 32‑bit
Wi‑Fi2.4 GHz (802.11 b/g/n)
BluetoothBLE
Operating Voltage3.3 V
ADC12‑bit
GPIOMultiplexed
OTAYes
🌡️ 4. Used Sensors
4.1 Temperature and Humidity Sensor — SHT35

The SHT35 (Sensirion) is an industrial-grade digital sensor, widely used in meteorological, HVAC, and precision instrumentation applications. It was chosen for this project due to its high accuracy, excellent long-term stability, and proven reliability.

According to the official Sensirion datasheet, the SHT35 integrates a highly linear band-gap temperature sensor, a capacitive relative humidity sensor, and an internal high-resolution ADC.

In the context of this project, the SHT35 is responsible for providing reliable environmental data from the room, reducing errors associated with self-heating or electrical noise.

Parameter Value
Supply Voltage2.4 V – 5.5 V
InterfaceI²C
Temperature−40 °C to +125 °C
Temperature Accuracy±0.1 °C (typical)
Humidity0–100 % RH
Humidity Accuracy±1.5 % RH
Response TimeVery fast
4.2 Water Temperature Sensor — DS18B20

The DS18B20, from Maxim Integrated, is a digital temperature sensor widely used in wet and submerged environments. In this project, the sensor is used in a waterproof version, ensuring electrical safety and durability in permanent contact with the aquatic medium.

Parameter Value
Supply Voltage3.0 V – 5.5 V
Interface1‑Wire
Temperature−55 °C to +125 °C
Accuracy±0.5 °C
Resolution9–12 bits
Cable LengthWaterproof
4.3 TDS Sensor — SEN0244

The DFRobot SEN0244 sensor measures TDS (Total Dissolved Solids), an indirect indicator of the concentration of mineral salts, nutrients, and other dissolved compounds in the water.

The TDS value is obtained through a mathematical conversion based on the measured voltage, with automatic temperature compensation. In this project, TDS is not monitored in continuous real-time, but rather at controlled intervals to reduce wear.

Parameter Value
Supply Voltage3.3 V – 5 V
OutputAnalog
Measurement Range0 – 1000+ ppm
Thermal CompensationYes
ApplicationAquariums, potable water
📟 5. Graphic LCD — ST7920 128×64

The ST7920 128×64 is a robust monochrome graphic LCD. In this project, it is used in software SPI mode, allowing pins to be freed up and ensuring full compatibility with the U8g2 library. Navigation between the two menus (Aquarium and Room) is done through a single physical button.

Parameter Value
Resolution128 × 64 pixels
InterfaceSPI (software)
BacklightControlled by GPIO
LibrariesU8g2
Software, Operating Logic, and Analysis
💾 6. ESP32 Software

The firmware was developed in Arduino C++, with a clear architecture:

  • Reading loop every 1 second.
  • Data transmission to the server every 5 minutes.
  • Power management: The LCD turns off automatically after 2 minutes without interaction, turning back on when the button is pressed.
🔄 7. Difference between LCD and Database

Room:

  • LCD: continuous measurements (real-time).
  • Database: transmission only every 5 minutes (avoids redundancy).

Aquarium:

  • Water temperature: Continuous LCD / Database every 5 min.
  • TDS: Physical measurement only every 30 minutes (repeated values sent in the interval).

Technical justification: The TDS sensor works on an electrolytic principle. Constant readings would cause premature electrode wear and unnecessary electrolysis.

🚦 8. Traffic Light System (Alerts)

The system uses three LEDs for quick visual indication:

LED Status
Green Normal values
Yellow Warning (outside ideal)
Red (flashing) Critical state

Defined limits: Normal aquarium temperature: 21–27 °C | Normal TDS: 100–250 ppm. Values outside these limits trigger alerts.

🗄️ 9. Backend, Database, and Web

The infrastructure on the Raspberry Pi 4 consists of:

  • Python + Flask for data reception.
  • Dedicated SQLite database (tables for Room and Aquarium).
  • HTML + Chart.js for visualization (Time charts, averages, maximums, and minimums).
📉 10. Analysis of Aquarium Values

Continuous monitoring allows verifying the stability of the heating system in the ideal range (24–26 °C). Regarding TDS (80–250 ppm), changes tend to be slow, associated with water changes (TPAs), fertilization, or evaporation.

It is necessary to accumulate several weeks of data to identify real trends and correlate events with observed variations.