Chapter 11 — Plant Monitoring with VPD: The Full Build
This is the project where everything in the previous chapters came together: DHT22 for air conditions, MLX90614 for leaf temperature, ESP32 for the node, MQTT for transport, Node-RED for decisions, and a metric called VPD that most people have never heard of.
What VPD Is and Why It Matters
Vapour Pressure Deficit (VPD) is a measurement of the “drying power” of the air — how much more water vapour the air can hold at its current temperature before reaching saturation. Plants regulate water loss through their stomata based on VPD. Too low (humid, cool air) and stomata close, limiting CO2 uptake and slowing growth. Too high (hot, dry air) and plants lose water faster than roots can supply it, causing stress.
For indoor cultivation (tomatoes, herbs, seedlings under grow lights), maintaining a VPD of 0.8–1.2 kPa is the target range for vegetative growth.
The formula:
VPD = SVP_air - AVP_leaf
SVP_air = 0.6108 × exp(17.27 × T_air / (T_air + 237.3)) [kPa]
AVP_leaf = 0.6108 × exp(17.27 × T_leaf / (T_leaf + 237.3)) × (RH / 100)
Where T_air is air temperature (°C), T_leaf is leaf surface temperature (°C), and RH is relative humidity (%).
In Python:
import math
def vpd(t_air, t_leaf, rh):
svp_air = 0.6108 * math.exp(17.27 * t_air / (t_air + 237.3))
avp_leaf = 0.6108 * math.exp(17.27 * t_leaf / (t_leaf + 237.3)) * (rh / 100)
return svp_air - avp_leaf
The Hardware Build
The sensor node for plant monitoring:
- ESP32 as the controller
- DHT22 connected to GPIO 15 — reads air temperature and humidity
- MLX90614 connected to SDA/SCL (I2C) — reads leaf surface temperature
- TP4056 + 18650 + 5W solar panel for power
- ESPHome for firmware (YAML-configured, no C++ or MicroPython required)
ESPHome is worth highlighting: it’s a framework that lets you configure an ESP32 in YAML and generates the firmware automatically. The DHT22 + MLX90614 + MQTT configuration:
sensor:
- platform: dht
pin: GPIO15
model: DHT22
temperature:
name: "Air Temperature"
humidity:
name: "Air Humidity"
update_interval: 60s
- platform: mlx90614
ambient:
name: "MLX Ambient Temperature"
object:
name: "Leaf Temperature"
update_interval: 60s
Deploy with esphome run plant-monitor.yaml. Done. No firmware code written.
graph LR
subgraph Sensors["Sensors"]
DHT22[🌡️ DHT22\nAir Temp + RH]
MLX[🌿 MLX90614\nLeaf Surface Temp]
end
subgraph Node["ESP32 Node — ESPHome"]
VPD[VPD Calculation\n0.8–1.2 kPa optimal]
end
subgraph Actions["Actions"]
Fan[🌀 Fan\nreduce VPD]
Humidifier[💧 Humidifier\nraise RH]
Notify[📱 Notification]
end
DHT22 -->|GPIO 15| VPD
MLX -->|I2C| VPD
VPD -->|MQTT publish| Broker[MQTT Broker]
Broker --> NodeRED[Node-RED\nthreshold logic]
NodeRED -->|VPD > 1.4 kPa| Fan
NodeRED -->|VPD < 0.5 kPa| Humidifier
NodeRED --> HA[Home Assistant]
HA --> Notify
style VPD fill:#e8f5e9,stroke:#388e3c
style Broker fill:#fff3e0,stroke:#e65100


The A/B Experiment
With two sensor nodes in different areas of the same grow space, you can run proper experiments. One area with increased airflow (a small fan), one without. Log VPD for both for two weeks. Compare plant growth rate, leaf size, and stem thickness.
This is the part where IoT becomes genuinely scientific: instrumented environments, controlled variables, measurable outcomes. The tomatoes don’t lie.
Takeaway: VPD is the right metric for plant monitoring, not just temperature and humidity. ESPHome generates firmware from YAML — no low-level code required. Two sensor nodes enable A/B experiments.