Project in progress
Automatic Indoor Vegetable Garden

Automatic Indoor Vegetable Garden © GPL3+

Never forget to water your plants or turn off your grow lights. Never over or under water plants with water pump control and drip system.

  • 16,684 views
  • 21 comments
  • 92 respects

Components and supplies

About this project

Look at all this basil!

This is the latest upgrade to my indoor garden. There is a water pump controlled by an Arduino that feeds a series of Blumats. Blumats drip small amounts of water over time based on the moisture level of the soil. They suck out water from the main water line when capillary action forces water through the ceramic sensor as it dries. This is a convenient way to control moisture without needing a lot of code or individual pumps and relays. 5 of the 14 plants have moisture sensors. Currently the pump looks at the most trustworthy sensor and decides whether or not to turn the water off to the system. I will expand it further to average out all sensors and eventually give readings for different plants with different water needs. Honestly at this point hand watering has been more effective but I'm hoping to dial in the system to be completely autonomous.

The Arduino controls the light cycle very accurately. The light cycle is 6:00AM to 10:00PM. It uses the DS3231 RTC included with many Arduino kits. This has been working for 3 months and hasn't failed once. Everything is plugged into a UPS designed for servers. This can run the system for about 15 minutes in the event of a power outage.

There is a cardboard packaging tube holding up the plastic table in the middle to keep it real.

Code

Automatic plantsArduino
Its mostly just a timer for the grow lights but can sense soil moisture and run a pump to water a plant.
I have made several revisions to this code, more to come shortly.
#include <dht.h>
#include <LiquidCrystal.h>
#include <DS3231.h>
DS3231  rtc(SDA, SCL);
LiquidCrystal lcd(12, 11, 8, 6, 5 ,4);
int startTime = 6; //Integer hour in 24hr format to start lights
int endTime = 22; //Integer hour in 24hr format to cut the lights
int lights = 7; //light digital output pin
String wateringTime = "15:33"; //time to run the water pump, must be in HH:MM 24 hour format, waters once per day
int soilSensor1 = 0;
int pump1 = 13;
int moistThreshold = 500;
int lcdDelay = 5000;
Time t;
dht DHT;
#define DHT11_PIN 9

void setup() {

Serial.begin(115200); //Init the DS3231 using hardware interface
rtc.begin(); //Init the rtc object
pinMode(lights,OUTPUT);
pinMode(soilSensor1,INPUT);
pinMode(pump1,OUTPUT);
lcd.begin(16, 2);

}


void loop() {
//Declare local loop variables
String(hours);
String rightNow;
int moisture1;
int temp_humi = DHT.read11(DHT11_PIN);
moisture1 = analogRead(soilSensor1);

//Get current time in HH:MM format
rightNow = rtc.getTimeStr(FORMAT_SHORT);

//Grabs hours then converts to integer 
hours = rightNow.substring(0,2);
int hours_int = hours.toInt();

//Checks time and controls lights
if (hours_int > startTime and hours_int < endTime) 
{
  digitalWrite(lights,HIGH);
}
else 
{
  digitalWrite(lights,LOW);
}

if (moisture1 > moistThreshold and wateringTime == rightNow)
{ 
  digitalWrite(pump1,HIGH);
  delay(10000);
  digitalWrite(pump1,LOW);
}

//Serial output time and moisture level
Serial.print("Current Time: ");
Serial.print(hours_int);
Serial.print("\n");
Serial.print("Moisture Sensor1: ");
Serial.print(moisture1);
Serial.print("\n");
Serial.print("Temp: ");
Serial.print(DHT.temperature);

Serial.print("----------\n");


//LCD panel
lcd.setCursor(0, 0);
lcd.print("Moisture: ");
lcd.setCursor(10, 0);
lcd.print(moisture1);
lcd.setCursor(0, 1);
lcd.print("Time: ");
lcd.setCursor(6, 1);
lcd.print(rightNow);
delay(lcdDelay);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temperature: ");
lcd.setCursor(12, 0);
lcd.print(DHT.temperature);
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.setCursor(10, 1);
lcd.print(DHT.humidity);

delay(lcdDelay);
lcd.clear();




}

Schematics

Automatic indoor garden
This is an Arduino based plant life cycle controller
auto_garden_vHrwxKjIGf.fzz
Wiring Diagram
Wiring diagram png file
Schematicimage 1e6x8zoaop

Comments

Similar projects you might like

Smart Garden

Project showcase by patel Dipen

  • 38,338 views
  • 17 comments
  • 85 respects

Arduino Indoor Garden

Project tutorial by MEGA DAS

  • 49,361 views
  • 31 comments
  • 161 respects

Automatic Watering System

Project tutorial by PRosenb

  • 24,243 views
  • 20 comments
  • 73 respects

The hydroMazing Smart Garden System

Project tutorial by Cory Potter

  • 34,375 views
  • 14 comments
  • 141 respects

Arduino Irrigation System

Project tutorial by smana_00

  • 6,852 views
  • 0 comments
  • 24 respects

DHT22 Applied To Automatic Irrigation

Project showcase by CristianColweb

  • 4,155 views
  • 3 comments
  • 16 respects
Add projectSign up / Login