Tutorial 4 — AI Plant Health Monitor with NVIDIA Jetson

Build a fully automated grow room controller. The Jetson watches your plants with a camera, classifies their health, and automatically controls lights, water, temperature, and CO₂ — all without internet.

What you will learn

  • How to classify plant health states using a custom CNN
  • How to read sensors (temperature, humidity, CO₂, pH) via I²C and UART
  • How to control relays from Jetson GPIO pins
  • How to build a closed-loop control system
  • How to log data to InfluxDB and view it in Grafana

Step 1 — Run the plant health demo

cd ~/tutorials/04-plant-health-monitor
python3 plant_monitor.py --camera 0 --show

The camera scans your plants and classifies each leaf region as: Healthy, Nutrient Deficiency, Disease, or Overwatered. Results overlay on the live feed.

Step 2 — Connect an I²C sensor (SHT40)

import board, busio, adafruit_sht4x

i2c = busio.I2C(board.SCL, board.SDA)
sht = adafruit_sht4x.SHT4x(i2c)

temp_c, humidity = sht.measurements
print(f"Temperature: {temp_c:.1f}°C  |  Humidity: {humidity:.1f}%")

Step 3 — Control a relay from GPIO

import Jetson.GPIO as GPIO, time

RELAY_PIN = 18   # connect relay IN to GPIO pin 18
GPIO.setmode(GPIO.BOARD)
GPIO.setup(RELAY_PIN, GPIO.OUT, initial=GPIO.LOW)

def turn_on_pump(duration_secs):
    GPIO.output(RELAY_PIN, GPIO.HIGH)   # activate pump
    time.sleep(duration_secs)
    GPIO.output(RELAY_PIN, GPIO.LOW)    # stop pump

turn_on_pump(3)   # water for 3 seconds

Step 4 — Full auto-control loop

while True:
    frame              = camera.capture()
    health_class       = plant_model.classify(frame)
    temp, humidity     = sht.measurements

    if temp > 28:         turn_on_fan()
    if humidity < 55:     turn_on_humidifier()
    if health_class == "Nutrient Deficiency":
        turn_on_pump(5)   # dose nutrients

    time.sleep(60)        # check every minute

Next: Tutorial 5 — Sports AI Live Streaming | Back to Jetson Kit

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
0

Subtotal