Select your language

© Borgmann Aquaponik & Hydroponik
Alle Rechte Vorbehalten
https://borgmann-aquaponik-hydroponik.ch

Viel Erfolg wünschen wir Ihnen!

Environmental Monitoring and Control:
    Temperature, Humidity, and CO2

In addition to water and light, environmental parameters such as temperature, humidity, and CO2 concentration significantly influence plant growth and the health of aquaponics fish. Precise monitoring and intelligent control of these factors optimize conditions in the smart greenhouse and increase productivity. This article highlights the integration of relevant sensors and actuators to create an ideal microclimate.

4.1 Importance of Environmental Parameters

Each environmental parameter plays a specific role in the ecosystem of the smart garden:

  • Air Temperature: Affects the rate of photosynthesis, respiration, and transpiration of plants. A stable water temperature is also crucial for the well-being and metabolism of fish in aquaponics systems (often closely linked to air temperature).
  • Air Humidity: Influences the transpiration rate of plants. Too high humidity can promote fungal growth, while too low humidity can lead to stress and wilting. Vapor Pressure Deficit (VPD) is a more advanced parameter that combines temperature and humidity.
  • CO2 Concentration: Carbon dioxide is an essential raw material for photosynthesis. In closed systems, it can quickly become a limiting factor, slowing growth. Enrichment can increase yield.

4.2 Sensors for Environmental Monitoring

Various sensor types are available for measuring these parameters:

4.2.1 Temperature and Humidity Sensors

Combined sensors are cost-effective and space-saving.

Sensor Types:
  • DHT11/DHT22 (approx. 5–15 €): Widely used for hobby projects. DHT11 is cheaper but less precise (±2°C, ±5% RH) and slower. DHT22 (or AM2302) is more accurate (±0.5°C, ±2% RH) and sufficient for most applications. Both use a proprietary digital protocol and require a special library.
  • BME280/BMP280 (approx. 10–25 €): Digital sensors from Bosch that communicate via I²C or SPI. The BME280 measures temperature, humidity, and air pressure. The BMP280 only measures temperature and pressure. They are more precise (±0.5°C, ±3% RH for humidity) and faster than DHT sensors. Ideal for more professional applications.

4.2.2 CO2 Sensors

CO2 is typically measured with NDIR (Non-Dispersive Infrared) sensors.

Sensor Types:
  • MH-Z19B / MH-Z19C (approx. 30–60 €): Cost-effective NDIR CO2 sensors that communicate via UART or PWM. They offer an accuracy of ±50 ppm + 5% of the reading and are well suited for closed greenhouses. Often feature an auto-calibration function (ABC logic) that requires regular fresh air cycles.
  • SCD30 (approx. 60–90 €): A more precise and often more compact CO2, temperature, and humidity sensor from Sensirion that communicates via I²C. Offers higher accuracy (±30 ppm + 3% of the reading) and is also optimized for indoor use.

4.3 Control of Environmental Parameters

Based on sensor data, actuators can be used to maintain optimal conditions.

4.3.1 Automatic Ventilation and Heating/Cooling

Stable air temperature and humidity are crucial to minimize plant stress and prevent diseases.

Technical Implementation:
  1. Sensors: BME280 or DHT22 provide temperature and humidity data.
  2. Microcontroller: Processes sensor data and implements control algorithms (e.g., hysteresis control).
  3. Actuators:
    • Exhaust Fan: Controlled via a relay module to remove excess heat or exchange humid air.
    • Inlet Damper/Fan: Can also be controlled via a relay to supply fresh air.
    • Heating Mat/Fan Heater: Also switched via relay to increase temperature if necessary.
    • Activated Carbon Filter: Optional in the exhaust air to neutralize odors.
Practical Idea: Temperature and Humidity Controller

The ESP32 continuously reads data from the BME280. If the temperature rises above a threshold (e.g., 28°C), the exhaust fan is activated. If it falls below a lower threshold (e.g., 20°C), a heating mat can be switched on. Similarly, humidity can be regulated: if humidity is too high (e.g., >70% RH), the fan is activated to remove humid air. Hysteresis (e.g., switching on at 28°C, switching off at 26°C) is important to avoid constant on/off switching.


// Vereinfachtes Arduino/ESP32 Code-Beispiel für Temperatur/Feuchtigkeitsregler mit BME280 #include <wire.h> #include <adafruit_sensor.h> #include <adafruit_bme280.h> // Bibliothek für BME280 Sensor #define SEALEVELPRESSURE_HPA (1013.25) // Standard Atmosphärendruck Adafruit_BME280 bme; // I2C const int exhaustFanRelayPin = 18; // Abluftventilator const int heaterRelayPin = 19; // Heizmatte const float tempHighThreshold = 28.0; // °C, Ventilator AN const float tempLowThreshold = 26.0; // °C, Ventilator AUS const float tempMinThreshold = 20.0; // °C, Heizmatte AN const float tempMaxThreshold = 22.0; // °C, Heizmatte AUS const float humidityHighThreshold = 75.0; // %RH, Ventilator AN const float humidityLowThreshold = 70.0; // %RH, Ventilator AUS void setup() { Serial.begin(115200); Serial.println("Starte Umgebungskontrolle."); if (!bme.begin(0x76)) { // I2C-Adresse des BME280 Serial.println("Konnte BME280 nicht finden, überprüfe Verkabelung oder Adresse!"); while (1); } pinMode(exhaustFanRelayPin, OUTPUT); pinMode(heaterRelayPin, OUTPUT); digitalWrite(exhaustFanRelayPin, HIGH); // Ventilator AUS (Relais oft inverted) digitalWrite(heaterRelayPin, HIGH); // Heizung AUS delay(100); } void loop() { float temperature = bme.readTemperature(); float humidity = bme.readHumidity(); Serial.printf("Temp: %.2f °C, Hum: %.2f %%\n", temperature, humidity); // Temperaturregelung if (temperature > tempHighThreshold) { if (digitalRead(exhaustFanRelayPin) == HIGH) { Serial.println("Temp zu hoch, Ventilator AN."); digitalWrite(exhaustFanRelayPin, LOW); // Ventilator AN } if (digitalRead(heaterRelayPin) == LOW) { // Heizung AUS, wenn Ventilator an ist Serial.println("Temp zu hoch, Heizung AUS."); digitalWrite(heaterRelayPin, HIGH); // Heizung AUS } } else if (temperature < tempLowThreshold && temperature > tempMinThreshold) { if (digitalRead(exhaustFanRelayPin) == LOW) { Serial.println("Temp OK, Ventilator AUS."); digitalWrite(exhaustFanRelayPin, HIGH); // Ventilator AUS } } if (temperature < tempMinThreshold) { if (digitalRead(heaterRelayPin) == HIGH) { Serial.println("Temp zu niedrig, Heizung AN."); digitalWrite(heaterRelayPin, LOW); // Heizung AN } if (digitalRead(exhaustFanRelayPin) == LOW) { // Ventilator AUS, wenn Heizung an ist Serial.println("Temp zu niedrig, Ventilator AUS."); digitalWrite(exhaustFanRelayPin, HIGH); // Ventilator AUS } } else if (temperature > tempMaxThreshold && temperature < tempHighThreshold) { if (digitalRead(heaterRelayPin) == LOW) { Serial.println("Temp OK, Heizung AUS."); digitalWrite(heaterRelayPin, HIGH); // Heizung AUS } } // Luftfeuchtigkeitsregelung (kann mit Temperaturregelung interagieren, hier vereinfacht) if (humidity > humidityHighThreshold) { if (digitalRead(exhaustFanRelayPin) == HIGH) { Serial.println("Feuchte zu hoch, Ventilator AN."); digitalWrite(exhaustFanRelayPin, LOW); // Ventilator AN } } else if (humidity < humidityLowThreshold) { // Hier könnte ein Luftbefeuchter gesteuert werden, wenn nötig. // Oder sicherstellen, dass der Ventilator AUS ist, wenn Feuchte OK. if (digitalRead(exhaustFanRelayPin) == LOW && temperature < tempHighThreshold) { // Nur ausschalten, wenn Temp es erlaubt Serial.println("Feuchte OK, Ventilator AUS (falls nicht wegen Temp an)."); digitalWrite(exhaustFanRelayPin, HIGH); } } delay(5000); // Alle 5 Sekunden messen }

4.3.2 CO2 Enrichment

In closed cultivation systems, CO2 concentration can quickly drop below atmospheric levels (approx. 400 ppm), limiting photosynthetic performance. Controlled CO2 enrichment to 800-1500 ppm can significantly increase yield.

We strongly recommend! not to add CO2 to the greenhouse air circulation but to simply open the window, if possible. However, since there are also real professionals in the hobby sector, we have nevertheless published this article here for hobbyists after multiple requests. But please consider: this is even more dangerous than a gas installation. CO2 naturally does not explode (inert gas properties) but it is insidious because, unlike gas, you cannot smell it and you simply suffocate - not from CO2 but from lack of oxygen!

CO₂ Concentration and its Health Effects

CO₂ Concentration Effect
400 – 1,000 ppm Normal background concentration in fresh air or well-ventilated rooms.
1,000 – 2,000 ppm Slight fatigue, concentration problems, possibly headaches.
2,000 – 5,000 ppm Significant impairments: headaches, dizziness, drowsiness, increased pulse.
> 5,000 ppm Toxic Range: Nausea, unconsciousness with prolonged exposure.
> 40,000 ppm (4%) Life-threatening: Severe shortness of breath, unconsciousness, acute health hazard.
> 100,000 ppm (10%) Dangerous: Rapid death due to respiratory arrest and acidosis.
Important: CO₂ is not toxic in the classical sense, but it displaces oxygen and leads to suffocation symptoms.
Warning: In work environments, limits apply: 5,000 ppm (0.5 vol.-%) as the maximum allowable workplace concentration (MAK value).

 

Technical Implementation:
  1. CO2 Sensor: An MH-Z19B or SCD30 provides the current CO2 values.
  2. Microcontroller: Compares the measured CO2 value with the target value.
  3. Actuator – Solenoid Valve for CO2 Cylinder: A special solenoid valve for CO2 pressure cylinders (often 12V or 24V) is controlled via a relay module. Alternatively, a CO2 generator (e.g., with dry ice or enzymatic processes) can be used.
Practical Idea: Simple CO2 Control

The ESP32 reads the CO2 value from the sensor. If the value falls below a defined threshold (e.g., 800 ppm), the microcontroller opens the solenoid valve of the CO2 cylinder for a short, defined period (e.g., 10-30 seconds). After that, a waiting period (e.g., 5-10 minutes) is observed to allow the CO2 to distribute and the sensor to detect the new value before re-dosing. Important: CO2 enrichment should only occur during the lighting phase, as plants do not consume CO2 in the dark.

Safety Note: High concentrations of CO2 are dangerous to humans. Adequate ventilation of the room when people are present is essential. The system should never release CO2 when people are in the room.


// Vereinfachtes Arduino/ESP32 Code-Beispiel für CO2-Regelung mit MH-Z19B (UART) // Benötigt SoftwareSerial für Arduino oder die Hardware-UART des ESP32 // Beispiel für ESP32 HardwareSerial: #define MHZ19B_RX_PIN 16 // GPIO, der an TX des MH-Z19B geht #define MHZ19B_TX_PIN 17 // GPIO, der an RX des MH-Z19B geht HardwareSerial SerialMHZ(1); // Verwende Serial1 auf ESP32 const int co2ValveRelayPin = 21; // Relais für CO2-Magnetventil const int targetCO2 = 1000; // Ziel-CO2 in ppm const int co2DoseThreshold = 100; // ppm unter Ziel, bevor dosiert wird const int doseDuration = 10000; // 10 Sekunden CO2 dosieren (ms) const long dosePause = 5 * 60 * 1000; // 5 Minuten Pause nach Dosierung (ms) unsigned long lastDoseTime = 0; bool isDaytime = true; // Annahme: Hier RTC oder Lichtsensor einbinden! void setup() { Serial.begin(115200); SerialMHZ.begin(9600, SERIAL_8N1, MHZ19B_RX_PIN, MHZ19B_TX_PIN); // MH-Z19B Baudrate 9600 pinMode(co2ValveRelayPin, OUTPUT); digitalWrite(co2ValveRelayPin, HIGH); // CO2-Ventil AUS starten Serial.println("Starte CO2-Kontrolle."); delay(100); } void loop() { // Lese CO2-Wert (MH-Z19B benötigt spezielle Anfrage) int co2ppm = readMHZ19B(); // Funktion zum Lesen des CO2-Werts implementieren Serial.printf("CO2: %d ppm\n", co2ppm); // CO2-Regelung nur bei Tag und wenn ausreichend Zeit seit letzter Dosierung if (isDaytime && (millis() - lastDoseTime > dosePause)) { if (co2ppm < (targetCO2 - co2DoseThreshold)) { Serial.println("CO2 zu niedrig, Ventil AN."); digitalWrite(co2ValveRelayPin, LOW); // Ventil AN lastDoseTime = millis(); delay(doseDuration); // Dosierdauer digitalWrite(co2ValveRelayPin, HIGH); // Ventil AUS Serial.println("CO2 Dosierung beendet."); delay(2000); // Kurze Pause für Sensor } } else if (!isDaytime) { // Sicherstellen, dass Ventil bei Nacht AUS ist if (digitalRead(co2ValveRelayPin) == LOW) { digitalWrite(co2ValveRelayPin, HIGH); Serial.println("Nacht, CO2-Ventil AUS."); } } delay(5000); // Wartezeit zwischen Messungen // --- MH-Z19B Lese-Funktion (vereinfacht, benötigt Fehlerbehandlung) --- // https://github.com/WifWaf/MH-Z19/blob/master/MHZ19.h // Dies ist ein Platzhalter, eine vollständige Implementierung ist komplexer. int readMHZ19B() { byte cmd[9] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79}; // Request CO2 SerialMHZ.write(cmd, 9); delay(100); // Warte auf Antwort if (SerialMHZ.available() >= 9) { byte response[9]; SerialMHZ.readBytes(response, 9); if (response[0] == 0xFF && response[1] == 0x86) { return (response[2] << 8) | response[3]; } } return -1; // Fehler } }

4.4 Integration into a Holistic System

The control of temperature, humidity, and CO2 should not be considered in isolation, as these parameters influence each other:

  • Ventilation and CO2: High ventilation to reduce temperature or humidity can lower the CO2 concentration. The control logic must take this into account, e.g., CO2 enrichment only when ventilation flaps are closed.
  • Light and Heat: Lighting generates heat. Increased light intensity can lead to higher ventilation requirements.
  • Transpiration and Humidity: Plants transpire water, which increases air humidity. The irrigation strategy and ambient humidity are closely linked.

An advanced system would consider these dependencies in a central control algorithm to achieve optimal and energy-efficient states.

4.5 Conclusion

Monitoring and intelligent control of temperature, humidity, and CO2 are essential for maximizing yield and creating a healthy growing environment. By using suitable sensors and actuators, coupled with well-thought-out control logic, operators of aquaponics and hydroponics systems can precisely adapt the microclimate to the needs of their plants. The next and final episode of this series will cover alarming, remote monitoring, and data analysis to perfect the system and keep it in view at all times.

Kontext: