Reinforcement learning · IoT · In progress

Hydroponics AI

A hydroponics controller in which a reinforcement-learning policy decides nutrient dosing from live sensor readings, instead of fixed thresholds.

Year
2026 · in progress
Funding
STEAM research grant, Ministry of Education, Science and Technology, Nepal
Hardware
Sponsored by DFRobot

01 Problem

Hydroponic farms dose nutrients on fixed thresholds, which wastes nutrients and caps yield.

The research goal is closed-loop control: Q-learning and PPO policies that keep pH and EC on target against environmental drift, deciding each dose from what the sensors report.

02 How it works

  1. Sensors
  2. 2× ESP32
  3. MQTT
  4. FastAPI
  5. RL policy
  6. Pumps & dosing
Fig. 01 — The control loop: sensor readings in, dosing decisions out.
  1. Embedded control

    Two ESP32 boards and a Raspberry Pi run six sensing and control workflows, reading pH, EC, temperature and humidity sensors.

  2. Pumps and dosing over MQTT

    Sensor readings and actuator commands travel over MQTT to drive the pumps and nutrient dosing.

  3. RL dosing policy

    A reinforcement-learning policy built with PyTorch and Gymnasium decides the dosing.

  4. Real-time backend

    A FastAPI service with MQTT and WebSocket support handles live monitoring and automation, and backs the computer-vision pipeline.

  5. Live video

    LiveKit streams the plants in real time, so growth can be monitored remotely.

  6. Mobile app

    A Flutter app shows sensor data and live video, and controls the system remotely.

  7. Edge deployment

    The system runs on a local edge server for real-time processing and device communication.

03 DFRobot sponsorship

When the project needed hardware, I asked for it.

I emailed DFRobot directly with the research vision for Hydroponics AI. After reviewing the proposal and the project’s STEAM grant selection, DFRobot came on board as hardware sponsor and provided the components below.

Sensors

  • pH probes
  • CO₂ sensor
  • DHT22 temperature & humidity
  • Spectrometer sensor
  • Waterproof ultrasonic sensor

Compute

  • ESP32-S3 AI camera
  • ESP32-P4

04 Stack

Machine learning

  • PyTorch
  • Gymnasium

Embedded

  • ESP32 (C++)
  • Raspberry Pi
  • MQTT

Backend & app

  • FastAPI
  • WebSockets
  • LiveKit
  • Flutter

05 Next project

KU Krishi

Computer vision · Android · Nepal ICT Award 2024