I am using the given components, use them together and providing the plants good conditions to live and provide monitoring(pls do not tell in reply that this project is better made ,I know).
Pls tell me is there a mistake in code. suggest a code where using my relay, my arduino would tell the water pump to supply water if soil moisture is low.And the lcd would display temp and humidity(and probably soil too).Using the dht sensor. Also check the description for link of other two modules (lcd and arduino wire)(I dont think wire is imp to anyone.) Also special thanks to people in forum that helped me a lot(link in description)
Links:
Lcd
arduino nano(I neither remember the link,nor found in my order history)
Same for my dht 11
Special thanks to people solving problem of a begginer
My code for showing dht data on Serial monitor.
#include <dht.h>
#define dht_apin A0
dht DHT;
void setup() {
Serial.println("Welcome to Plant Temperature reader");
delay(1000);
}
void loop() {
DHT.read11(dht_apin);
Serial.printlm("Current temperature = ");
Serial.print(DHT.temperature);
Serial.println("Current temperature = ");
Serial.print(DHT.humidity);
}
My code to show dht data on lcd
#include <LiquidCrystal.h>
#include <dht.h>
#define dht_apin A0
dht DHT;
const int rs =12, en = 11, d4 = 5,d5 = 4,d6 = 3,d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
Serial.begin(9600);
delay(1000);
Serial.println("Welcome to Plant Temperature reader");
delay(1000);
lcd.begin(16,2);
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temperature = ");
lcd.setCursor(0,1);
lcd.print("Humidity = ");
}
void loop() {
DHT.read11(dht_apin);
if(Serial.available()>0){
lcd.setCursor(14,0);
lcd.print(DHT.temperature);
delay(1000);
lcd.setCursor(14,1);
lcd.print(DHT.temperature);
delay(1000);
}
Serial.println("Current temperature = ");
Serial.print(DHT.temperature);
Serial.println("Current temperature = ");
Serial.print(DHT.humidity);
delay(1000);
}