Plant Care Assistant

by NazarMikhin in Living > Gardening

32 Views, 0 Favorites, 0 Comments

Plant Care Assistant

photo_2025-06-16_02-24-25.jpg
photo_2025-06-16_02-24-24.jpg
photo_2025-06-16_02-10-38.jpg
photo_2025-06-19_15-32-32.jpg

This DIY guide walks you through building a plant health monitoring system using a Raspberry Pi, a camera, and a custom-trained YOLOv8 model. The system detects if a Snake Plant (Dracaena trifasciata) or Peace Lily (Spathiphyllum wallisii) is healthy or unhealthy based on its leaf condition.

The project is aimed at:

  1. Urban dwellers with limited plant care knowledge
  2. Home gardeners
  3. Horticulture students

Supplies

photo_2025-06-17_14-04-55.jpg
photo_2025-06-17_14-04-53.jpg
photo_2025-06-19_15-33-02.jpg
photo_2025-06-19_15-33-00.jpg
photo_2025-06-19_15-32-58.jpg

Hardware

  1. Raspberry Pi 5
  2. MicroSD card (16 GB+)
  3. Raspberry Pi power supply
  4. USB Camera
  5. Raspberry Pi-compatible LCD display (e.g., 3.5" GPIO touch screen)
  6. RGB LED
  7. Jumper wires and breadboard
  8. Wooden/plastic enclosure with slots (laser-cut or handmade)


Software

  1. Raspberry Pi OS (64-bit)
  2. Python 3.10+
  3. OpenCV
  4. Ultralytics (for YOLOv8)
  5. Numpy
  6. gpiozero
  7. Your YOLO model (best.pt)
  8. Python script
  9. Optional HTML dashboard files

Software Setup

🔹 1.1 Install Raspberry Pi OS

  1. Flash Raspberry Pi OS (64-bit) using Raspberry Pi Imager.
  2. Boot and complete first-time setup (Wi-Fi, password, etc.).

🔹 1.2 Install Python Dependencies

  1. sudo apt update
  2. sudo apt install python3-pip python3-venv
  3. python3 -m venv plantenv
  4. source plantenv/bin/activate
  5. pip install opencv-python ultralytics gpiozero numpy

🔹 1.3 Prepare Project Directory

  1. mkdir ~/plant_monitor
  2. cd ~/plant_monitor
  3. # Transfer: main.py, best.pt, and any dashboard HTML files


AI Model

🔹 2.1 Classes Detected

  1. Healthy Snake Plant
  2. Unhealthy Snake Plant
  3. Healthy Peace Lily
  4. Unhealthy Peace Lily

🔹 2.2 Data Sources

Used public datasets and self-collected images:

  1. Roboflow: snake plant datasets
  2. Pinterest plant leaf images

Hardware Assembly

🔹 3.1 Camera

  1. Connect your USB camera to Raspberry Pi USB port.

🔹 3.2 LED Wiring

  1. Green LED
  2. Red LED

🔹 3.3 Display

  1. Mount your LCD display to GPIO headers.
  2. Follow display documentation to enable touchscreen.

🔹 3.4 Enclosure

  1. Mount components in a wooden or plastic box.
  2. Ensure openings for LCD, camera, and airflow.

Running the Detection Script

download.png
681c9330-5340-4447-90f5-2e8772958e6b.png

🔹 4.1 Start the Python Script

bash
cd ~/plant_monitor
source plantenv/bin/activate
python main.py

🔹 4.2 What Happens

  1. The camera captures the plant.
  2. The YOLOv8 model detects class.
  3. A bounding box (red or green) is displayed.
  4. The corresponding LED lights up.
  5. Results optionally shown on HTML dashboard.


Troubleshooting

Camera not detected

Check with lsusb, reboot Pi

LEDs not lighting

Check GPIO pin numbers and wiring

Bounding box not showing

Check if YOLO model loads correctly

No display on LCD

Ensure drivers are installed and display is connected properly