Smart Hydroponic System

by UoP_SmartAgri in Workshop > Hydroponics

97 Views, 2 Favorites, 0 Comments

Smart Hydroponic System

4.png

Hydroponics is a modern method of cultivating plants without the use of soil, where nutrients are delivered directly to the plant roots through a water-based solution. Instead of relying on traditional soil, plants grow in an inert medium such as perlite, coco coir, clay pellets, or rockwool, while the nutrient-rich water provides all the essential minerals required for growth.

This system is highly efficient because it allows precise control of water, nutrients, and environmental conditions, resulting in faster plant growth, higher yields, and reduced resource usage compared to conventional farming. Hydroponics also minimizes the risk of soil-borne diseases and enables farming in areas with poor or no arable land, including urban environments and indoor spaces.

As the global demand for sustainable food production increases, hydroponic systems are becoming an innovative solution to address challenges such as limited land availability, water scarcity, and the need for year-round cultivation. Whether for small-scale home gardening or large commercial farms, hydroponics represents a key step toward the future of agriculture.

Types of Hydroponic Systems


  1. Deep Water Culture (DWC)
  2. Plants float on a nutrient-rich water solution, and their roots are submerged directly in the water. An air pump provides oxygen to the roots.
  3. Nutrient Film Technique (NFT)
  4. A thin film of nutrient solution constantly flows over the plant roots inside a sloped channel or tube. This gives roots access to water, nutrients, and air at the same time.
  5. Ebb and Flow (Flood and Drain)
  6. The grow tray is periodically flooded with nutrient solution and then drained back into a reservoir. This cycle provides both nutrients and oxygen to the roots.
  7. Drip System
  8. Nutrient solution is dripped slowly onto the base of each plant using tubes, ensuring precise feeding and minimal waste.
  9. Wicking System
  10. The simplest type: a wick (like rope or cloth) pulls nutrient solution up from the reservoir to the plant roots through capillary action. No pumps required.
  11. Aeroponics
  12. Plant roots hang in the air and are misted with nutrient solution. This gives maximum oxygen and rapid growth, but requires careful control.

Here we are propsing a NFT System.

In this project, we are going to show you how to build a smart water pump system using a Wemos D1 mini (ESP8266), an ultrasonic distance sensor, and Home Assistant.

The system automatically turns Pump ON when the water level (distance measured by the ultrasonic sensor) is in according to your measures , and turns it OFF otherwise.

This project is perfect for hydroponics, aquaponics, gardening, or smart farming.

Supplies

Screenshot 2025-09-12 173659.png
Screenshot 2025-09-12 172731.png
Screenshot 2025-09-12 173308.png
Screenshot 2025-09-12 173434.png
Screenshot 2025-09-12 172859.png
Screenshot 2025-09-12 173546.png
2.png
2 (2).png
  1. Wemos D1 Mini (ESP8266 board)
  2. Ultrasonic Sensor (HC-SR04 or JSN-SR04T for waterproof)
  3. 5V Water Pump
  4. Relay Module or MOSFET driver (to switch the pump safely)
  5. Jumper wires
  6. Breadboard or PCB
  7. 5V Power Supply (USB adapter or power bank)
  8. Home Assistant (running on Raspberry Pi or server)
  9. ESPHome add-on installed in Home Assistant

Copilot_20250921_173201.png

There are few units in this innovation.They are plant growing section,water supply section, fertilizer section,mixing section,pesticiding section


Lets focus on Plant Growing section first

You should build a stucture in order to grow your plants according to your preference. The diameter of the holes in the structure can be determined according to the types of the plant that you are going to grow. And the length and size of the plant growing basement can be decided by you but then you should consider the water storage capacity,the valves sizes and the power of motors


Now lets see about the water supply section

You should select water storing method according to the plants you are going to cultivate in here.Beacuse the amount of water needed here is different by the type of the plant.Then you need to install a motor and the valves in there to get the water out and to provide them into the plant growing section.Here we are proposing a water circulation method the water we have provided can be used for the plant growing section again .


Its time to focus on the fertilizer section

In here we have developed this project for 3 types of fertilizers. But you are free to get any type of fertilizers as you like(but they should be in almost liquid type else if you going to use solid type you have to convert them into liquid form) but if you are going to use many fertilizers you have to pay attention to the power of the motor you are going to use in the mixing section.

<Extra Acknowledgement>

Hydroponic fertilizers are liquid or water-soluble nutrients specially made for plants grown without soil. Since hydroponic systems use water instead of soil, these fertilizers provide all the nutrition the plants would normally absorb from the ground. They are mixed directly into the water that circulates around the roots, making nutrient uptake faster and more efficient.

Unlike traditional fertilizers, hydroponic fertilizers are designed to stay stable and balanced in water, preventing blockages or nutrient imbalances. They help ensure steady plant growth, higher yields, and healthier crops in controlled environments like greenhouses, indoor farms, and hydroponic gardens.


Now the mixing section

All the fertilzer carrying valves are connected here for the mixing purpose , there we have used 12V motor for that purpose , then the mixed fertilizers are carried out by the valves for the plant growing section.


Now you can connect the valves accoding the refference image we have provided. You should remember the valve type can be determined by your preference but you should consider the denisity of the liquids that you are going to use, the power the motors you use in each section and you should install them in a way to avoid any blockage .






We have provided a reference image how the system works

(Stucture of the system image)







Wiring


Connect Ultrasonic Sensor:

  1. VCC → 5V
  2. GND → GND
  3. TRIG → D1
  4. ECHO → D2

Connect Relay Module (Pump control):

  1. Relay IN → D5
  2. Relay VCC → 5V
  3. Relay GND → GND
  4. Relay COM & NO → in series with pump’s +5V line

Connect Pump:

  1. Pump + → Relay NO → Relay COM → +5V
  2. Pump – → GND

Setting up ESPHome for Home Assistant - ESP32 SMART Home Made EASY!


ESPHome Firmware


Setting up ESPHome


Here is a referrence source : https://youtu.be/7PoUWszwaFk?si=9_E8mE6hyvVIt9Ad

#Disclaimer: Learn fast make things (Youtube Creator)


Flash this ESPHome YAML to your Wemos D1 mini:

esphome:
name: smart_pump
esp8266:
board: d1_mini
logger:
api:
password: ""
ota:
platform: esphome
password: ""
wifi:
ssid: "YOUR_WIFI_SSID"
password: "YOUR_WIFI_PASSWORD"
ap:
ssid: "Fallback Hotspot"
password: "12345678"
sensor:
- platform: ultrasonic
trigger_pin: D1
echo_pin: D2
name: "Ultrasonic Distance 1"
id: ultrasonic1
update_interval: 2s
switch:
- platform: gpio
pin: D5
id: pump_01
name: "Pump 01"
run via command prompt
esphome run smart_pump.yaml
https://www.home-assistant.io/ here you can get the Home Assistant




Add Device to Home Assistant


  1. In Home Assistant → Settings → Devices & Services → Add Integration → ESPHome.
  2. Enter the IP address of your Wemos D1 mini.
  3. HA will discover:
  4. sensor.ultrasonic_distance_1
  5. switch.pump_01


Home Assistant Automation Intro

Automation in Home Assistant


Now create an automation so the pump runs only when the ultrasonic distance is between the values you are going to provide

Here is the code

alias: Control Pump by Ultrasonic Range
mode: single
trigger:
- platform: state
entity_id: sensor.ultrasonic_distance_1
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.ultrasonic_distance_1
above: 0.10 #your_values
below: 0.17 #your_values
sequence:
- service: switch.turn_on
target:
entity_id: switch.pump_01
default:
- service: switch.turn_off
target:
entity_id: switch.pump_01


5.jpg

Testing


  1. Place the ultrasonic sensor above your water container.
  2. When water level changes so the measured distance is between the values you are going to provide , the pump will turn on
  3. Outside this range, the pump stays off


Future Improvements


  1. Add multiple pumps and sensors.
  2. Add notification when water is low.
  3. Integrate with Google Home or Alexa.
  4. Add manual override button in Home Assistant UI.


Conclusion


With just a few components and ESPHome + Home Assistant, you’ve built a smart pump automation system for your garden, hydroponics, or smart home.