Crop water stress from leaf temperature
Build it step by step
0 of 7 doneWire the three I2C devices
Run an I2C scanner and check the three addresses.
Check the thermometer
Point it at your hand and a cup of warm water.
Check the air sensor
Shade it and compare with a known thermometer.
Aim at leaves
Hold the sensor 30 cm from a healthy plant at midday.
Record the difference
Write down the leaf minus air value.
Compare two pots
Water one and not the other for three days.
Watch the trend
The unwatered plant should warm relative to the air.
How do you build a crop water stress from leaf temperature?
An infrared thermometer measures canopy temperature and compares it with air temperature, because thirsty plants get warmer than air when they stop sweating. You need Arduino Nano, MLX90614 infrared thermometer, SHT31 temperature and humidity sensor and SSD1306 OLED Display. It takes 7 steps and about 120 minutes.
- Level
- Advanced
- Time
- About 120 min
- Parts
- 4
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- SensorsBuy
- DisplaysBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| MLX90614 VCC | Nano 5V | Power, use the 5 V version of the module |
| MLX90614 GND | Nano GND | Ground |
| MLX90614 SDA | Nano A4 | I2C data, address 0x5A |
| MLX90614 SCL | Nano A5 | I2C clock |
| SHT31 VCC and GND | Nano 5V and GND | Power |
| SHT31 SDA and SCL | Nano A4 and A5 | I2C, address 0x44 |
| OLED VCC and GND | Nano 5V and GND | Power |
| OLED SDA and SCL | Nano A4 and A5 | I2C, address 0x3C |
Code
Healthy leaves cool themselves by sweating, so the leaf is usually at or below air temperature in sun. When a plant is short of water it closes its pores, stops sweating and warms up, so a canopy that is warmer than the air at midday is a sign of water stress. Measure at midday in full sun, aim the sensor at a patch of leaves from about 30 cm so that it sees only leaves and no soil or sky (its view is a cone), and keep the air sensor in shade. The result also depends on humidity and wind, so compare the same plant over several days or compare a watered pot with an unwatered one rather than using one number as a rule. Treat this as a trend tool and not a precise stress index. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Libraries: Adafruit MLX90614, Adafruit SHT31, Adafruit SSD1306 and GFX.
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include <Adafruit_SHT31.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_MLX90614 ir;
Adafruit_SHT31 sht;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
void setup() {
Serial.begin(9600);
ir.begin();
sht.begin(0x44);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.setTextColor(WHITE);
}
void loop() {
float leaf = 0;
for (byte i = 0; i < 10; i++) { leaf += ir.readObjectTempC(); delay(50); }
leaf /= 10; // average to reduce noise
float air = sht.readTemperature();
float rh = sht.readHumidity();
float diff = leaf - air; // canopy minus air
oled.clearDisplay();
oled.setTextSize(1);
oled.setCursor(0, 0); oled.print("Leaf "); oled.print(leaf, 1); oled.print(" C");
oled.setCursor(0, 12); oled.print("Air "); oled.print(air, 1); oled.print(" C RH "); oled.print(rh, 0);
oled.setTextSize(2);
oled.setCursor(0, 30); oled.print(diff > 0 ? "+" : ""); oled.print(diff, 1); oled.print(" C");
oled.setTextSize(1);
oled.setCursor(0, 54);
oled.print(diff > 2 ? "Possible stress" : (diff > 0 ? "Watch it" : "Cool, ok"));
oled.display();
Serial.print(leaf); Serial.print(","); Serial.print(air); Serial.print(","); Serial.println(diff);
delay(2000);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
0.00,0.00,0.00
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Hand at 30 cm | About 30 to 34 degrees |
| Healthy watered plant at midday | Leaf at or below air temperature |
| Unwatered plant after days | Leaf noticeably warmer than air |
| Sensor aimed at soil | Misleading, so avoid it |
If it does not work
Reading looks wrong
Check the sensor sees only leaves and is not in shade.
Values jump
Wind and passing clouds change it; average more readings.
Device not found
Check I2C addresses and the 5 V module version.
OLED blank
Check its address 0x3C.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the crop water stress from leaf temperature?
Arduino Nano, MLX90614 infrared thermometer, SHT31 temperature and humidity sensor and SSD1306 OLED Display.
How long does the crop water stress from leaf temperature take to build?
About 120 minutes for a advanced maker, in 7 steps.
How do I know the crop water stress from leaf temperature works?
Hand at 30 cm: About 30 to 34 degrees. Healthy watered plant at midday: Leaf at or below air temperature. Unwatered plant after days: Leaf noticeably warmer than air.
Reading looks wrong: what should I check?
Check the sensor sees only leaves and is not in shade.
Values jump: what should I check?
Wind and passing clouds change it; average more readings.
Device not found: what should I check?
Check I2C addresses and the 5 V module version.
OLED blank: what should I check?
Check its address 0x3C.
