Devices & Components
Arduino Uno Rev3
Hydroplanet T5 4ft 8lamp
DHT11 Temperature & Humidity Sensor (3 pins)
Rotary potentiometer (generic)
Solderless Breadboard Full Size
Blumat Drip System
IoT Relay
DS3231M - ±5ppm, I2C Real-Time Clock
Water pump
Standard LCD - 16x2 White on Blue
Resistor 220 ohm
Soil moisture sensor
Project description
Code
LazyPlants v2
arduino
1. Controls lights on a timer. 2. Tells you when a plant isnt getting enough water from drip system. 3. Records temp and humidity to confirm fruiting temp for peppers more to come wifi monitoring of arduino with raspberry pi & web interface PoE power and data transmission from soil sensors through home ethernet wiring mulyiplexed through 8 twisted pairs of cat5e more lights & hydroponics!
1#include <dht.h> 2#include <LiquidCrystal.h> 3#include <DS3231.h> 4 5//Instantiate 6 library objects 7DS3231 rtc(SDA, SCL); 8LiquidCrystal lcd(8, 10, 7, 6, 5, 9 4); // RS, 10Time t; 11dht DHT; 12#define DHT11_PIN 9 13 14//Light timer constants 15int 16 startTime = 6; //Integer hour in 24hr format to start lights 17int endTime = 22; 18 //Integer hour in 24hr format to cut the lights 19int lights = 11; //light digital 20 output pin 21 22//Soil sensor constants 23int lcdDelay = 3000; //delay time to 24 refresh the lcd screen with new info 25int analogDelay = 150; //delay time to resist 26 EMF interference on analogRead() values 27int sensors[] = {A0, A1, A2, A3, A4, 28 A5}; //array of analog soil sensor pins 29int sensorLen = 6; //integer length of 30 sensors array 31int drySoil = 400; //average sensor output value of known dried 32 soil 33 34 35//Arduino setup function 36void setup() { 37lcd.begin(16, 2); 38 //Start lcd in 16x2 mode 39Serial.begin(115200);//start serial output at 115200 40 baud rate 41rtc.begin(); //init real time clock module 42pinMode(lights,OUTPUT);//set 43 light controller pin to output mode 44 45//set analog pins to INPUT 46for (int 47 i = 0; i < sensorLen; i++) { 48 pinMode(sensors[i],INPUT); 49} 50} 51 52 53//main 54 loop 55void loop() { 56//Declare local loop variables 57String(hours); 58String 59 rightNow; 60int temp_humi = DHT.read11(DHT11_PIN); 61 62//reads in sensor values 63 once per main loop iteration 64int sensorVals[6]; //array to store sensor values 65for 66 (int i; i < sensorLen; i++){ 67 sensorVals[i] = analogRead(sensors[i]); 68 delay(analogDelay); 69} 70 71//Get 72 current time in HH:MM format 73rightNow = rtc.getTimeStr(FORMAT_SHORT); 74 75//Grabs 76 hours then converts to integer for basic hour resolution light timing 77hours 78 = rightNow.substring(0,2); 79int hours_int = hours.toInt(); 80 81//Checks time 82 and controls lights 83if (hours_int > startTime and hours_int < endTime) 84{ 85 86 digitalWrite(lights,HIGH); 87} 88else 89{ 90 digitalWrite(lights,LOW); 91} 92 93//output 94 to serial monitor for debugging 95Serial.println("sensor values: "); 96for (int 97 i=0; i < sensorLen; i++) { 98 Serial.println(sensorVals[i]); 99} 100 101 102//LCD 103 panel 104//loop through sensor values and warn if particular plant needs watering. 105 106for (int i=0; i < sensorLen; i++){ 107if (sensorVals[i] < 400){ 108lcd.setCursor(0, 109 0); 110lcd.print("Moisture"); 111lcd.setCursor(8, 0); 112lcd.print(i); 113lcd.setCursor(9, 114 0); 115lcd.print(": "); 116lcd.setCursor(11,0); 117lcd.print(sensorVals[i]); 118lcd.setCursor(0, 119 1); 120lcd.print("Needs Water!"); 121delay(lcdDelay); 122} 123else { 124lcd.setCursor(0, 125 0); 126lcd.print("Moisture"); 127lcd.setCursor(8, 0); 128lcd.print(i); 129lcd.setCursor(9, 130 0); 131lcd.print(": "); 132lcd.setCursor(11,0); 133lcd.print(sensorVals[i]); 134lcd.setCursor(0, 135 1); 136lcd.print("Time: "); 137lcd.setCursor(6, 1); 138lcd.print(rightNow); 139delay(lcdDelay); 140lcd.clear(); 141 142 } 143} 144//Display temp and humidity after outputting sensor vals 145lcd.setCursor(0, 146 0); 147lcd.print("Temperature: "); 148lcd.setCursor(12, 0); 149lcd.print(DHT.temperature); 150lcd.setCursor(0, 151 1); 152lcd.print("Humidity: "); 153lcd.setCursor(10, 1); 154lcd.print(DHT.humidity); 155delay(lcdDelay); 156lcd.clear(); 157 158}
LazyPlants v2
arduino
1. Controls lights on a timer. 2. Tells you when a plant isnt getting enough water from drip system. 3. Records temp and humidity to confirm fruiting temp for peppers more to come wifi monitoring of arduino with raspberry pi & web interface PoE power and data transmission from soil sensors through home ethernet wiring mulyiplexed through 8 twisted pairs of cat5e more lights & hydroponics!
1#include <dht.h> 2#include <LiquidCrystal.h> 3#include <DS3231.h> 4 5//Instantiate library objects 6DS3231 rtc(SDA, SCL); 7LiquidCrystal lcd(8, 10, 7, 6, 5, 4); // RS, 8Time t; 9dht DHT; 10#define DHT11_PIN 9 11 12//Light timer constants 13int startTime = 6; //Integer hour in 24hr format to start lights 14int endTime = 22; //Integer hour in 24hr format to cut the lights 15int lights = 11; //light digital output pin 16 17//Soil sensor constants 18int lcdDelay = 3000; //delay time to refresh the lcd screen with new info 19int analogDelay = 150; //delay time to resist EMF interference on analogRead() values 20int sensors[] = {A0, A1, A2, A3, A4, A5}; //array of analog soil sensor pins 21int sensorLen = 6; //integer length of sensors array 22int drySoil = 400; //average sensor output value of known dried soil 23 24 25//Arduino setup function 26void setup() { 27lcd.begin(16, 2); //Start lcd in 16x2 mode 28Serial.begin(115200);//start serial output at 115200 baud rate 29rtc.begin(); //init real time clock module 30pinMode(lights,OUTPUT);//set light controller pin to output mode 31 32//set analog pins to INPUT 33for (int i = 0; i < sensorLen; i++) { 34 pinMode(sensors[i],INPUT); 35} 36} 37 38 39//main loop 40void loop() { 41//Declare local loop variables 42String(hours); 43String rightNow; 44int temp_humi = DHT.read11(DHT11_PIN); 45 46//reads in sensor values once per main loop iteration 47int sensorVals[6]; //array to store sensor values 48for (int i; i < sensorLen; i++){ 49 sensorVals[i] = analogRead(sensors[i]); 50 delay(analogDelay); 51} 52 53//Get current time in HH:MM format 54rightNow = rtc.getTimeStr(FORMAT_SHORT); 55 56//Grabs hours then converts to integer for basic hour resolution light timing 57hours = rightNow.substring(0,2); 58int hours_int = hours.toInt(); 59 60//Checks time and controls lights 61if (hours_int > startTime and hours_int < endTime) 62{ 63 digitalWrite(lights,HIGH); 64} 65else 66{ 67 digitalWrite(lights,LOW); 68} 69 70//output to serial monitor for debugging 71Serial.println("sensor values: "); 72for (int i=0; i < sensorLen; i++) { 73 Serial.println(sensorVals[i]); 74} 75 76 77//LCD panel 78//loop through sensor values and warn if particular plant needs watering. 79for (int i=0; i < sensorLen; i++){ 80if (sensorVals[i] < 400){ 81lcd.setCursor(0, 0); 82lcd.print("Moisture"); 83lcd.setCursor(8, 0); 84lcd.print(i); 85lcd.setCursor(9, 0); 86lcd.print(": "); 87lcd.setCursor(11,0); 88lcd.print(sensorVals[i]); 89lcd.setCursor(0, 1); 90lcd.print("Needs Water!"); 91delay(lcdDelay); 92} 93else { 94lcd.setCursor(0, 0); 95lcd.print("Moisture"); 96lcd.setCursor(8, 0); 97lcd.print(i); 98lcd.setCursor(9, 0); 99lcd.print(": "); 100lcd.setCursor(11,0); 101lcd.print(sensorVals[i]); 102lcd.setCursor(0, 1); 103lcd.print("Time: "); 104lcd.setCursor(6, 1); 105lcd.print(rightNow); 106delay(lcdDelay); 107lcd.clear(); 108 } 109} 110//Display temp and humidity after outputting sensor vals 111lcd.setCursor(0, 0); 112lcd.print("Temperature: "); 113lcd.setCursor(12, 0); 114lcd.print(DHT.temperature); 115lcd.setCursor(0, 1); 116lcd.print("Humidity: "); 117lcd.setCursor(10, 1); 118lcd.print(DHT.humidity); 119delay(lcdDelay); 120lcd.clear(); 121 122}
Downloadable files
Wiring Diagram
Wiring diagram png file
Wiring Diagram
Automatic indoor garden
This is an Arduino based plant life cycle controller
Automatic indoor garden
Wiring Diagram
Wiring diagram png file
Wiring Diagram
Comments
Only logged in users can leave comments