londonium2021
Published © GPL3+

Automatic Indoor Vegetable Garden

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.

BeginnerWork in progress14,460
Automatic Indoor Vegetable Garden

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
Or arduino micro
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Resistor 220 ohm
Resistor 220 ohm
×2
IoT Relay
×2
Hydroplanet T5 4ft 8lamp
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Water pump
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
DS3231M - ±5ppm, I2C Real-Time Clock
Maxim Integrated DS3231M - ±5ppm, I2C Real-Time Clock
×1
Soil moisture sensor
×9
Blumat Drip System
×1

Story

Read more

Schematics

Automatic indoor garden

This is an Arduino based plant life cycle controller

Wiring Diagram

Wiring diagram png file

Code

Automatic plants

Arduino
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();




}

Credits

londonium2021

londonium2021

0 projects • 9 followers

Comments