Project Guidance for a website controlled Arduino greenhouse

Hi

Would really appreciate project guidance on a project I am doing.

My objective is to make an automatic “system (software and hardware)” to control a plant or greenhouse.
The greenhouse has a GUI. The arduino should communicate with the web (website) and should be controllable there too. Also the arduino should be able to send pictures and upload basic, preferably realtime information from the sensors.My question is, what is the best way to go. While aiming to create a thorough, sound, highly universal, basic, easy to program, enduring website. And in the future a mobile version and an application.

What options are there? And what is the best suitable for this setting. Where do I start? What software should I use? What other projects are there out there (that can be helpfull to this project)?

Allot of questions, hopefully there are some people that can, prioritize and make a project planning. for me to start with.

Would really appreciate thoughts, and help, on this project.
Many thanks in advance! :slight_smile:

Also the arduino should be able to send pictures

From where? Sending image data will be ssslllooowww.

Mocking up what the web site should look like is the first thing you need to do. Determine how the Arduino as server is to get the data that is to be displayed in each field. Determine what buttons/fields should send data to the Arduino.

Only then can you start having the Arduino serve up the page and respond to submit buttons on the form(s).

Some previous greenhouse discussions.

https://www.google.com/search?hl=en&as_q=greenhouse&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=

Some previous greenhouse discussions.

I have been using this thread already for my own good, look at page 2 and 3 ;).. My competence is I think to be able to monitor and control this setting from the computer with the website, app, or software program on the computer. And to translate it into userfriendly but, kind of "lab like" features to modify.

From where? Sending image data will be ssslllooowww.

I think I will upload it from the arduino to my personal wifi network onto a server. daily basis at most one picture.

Mocking up what the web site should look like is the first thing you need to do. Determine how the Arduino as server is to get the data that is to be displayed in each field. Determine what buttons/fields should send data to the Arduino.

I am working on a site briefing and scheme. will post it here .... in a matter of time>

I have been using this thread already for my own good, look at page 2 and 3 smiley-wink.. My competence is I think to be able to monitor and control this setting from the computer with the website, app, or software program on the computer. And to translate it into userfriendly but, kind of "lab like" features to modify.

You should search for aquarium and hyponics for similar comtrol setups previously discussed. Also in the forum home automation section and Exhibition / Gallery sections you might find extensive control setups.

Thanks for the response!
Just made a sketch overview and an overview from the GUI on location
What I want to develop is monitor and control from distance. It should do the same as the GUI from pic 2. To be able to m/control from the couch / car / wherever. with an adition to view a pic. The device should be easy controlable by a non-programmer.

So, what do I need to take into account to tackle this objective?

I now have an:

ardiuno uno

sensors (hum, temp soil hum)
water control (solenoid)
Light control
Fan control

Tft touch screen

I am about getting the parts to start the wireless communication going. What should I have. (The greenhouse is in reach of a wifi network)
Many thanks in advance!

You might want to add an Ethernet shield to your devices so you can try web based control setups.

http://www.ebay.com/itm/New-Ethernet-Shield-W5100-For-Arduino-2009-UNO-Mega-1280-2560-/360652787632?pt=LH_DefaultDomain_0&hash=item53f894cfb0

Insert Quote You might want to add an Ethernet shield to your devices so you can try web based control setups.

I prefer a wireless version of the shield so I do not need a cable set up. Is it recommendable to buy a wireless wifi shield? (regardless of the price) for instance this one: http://store.arduino.cc/eu/index.php?main_page=product_info&cPath=11_5&products_id=237

You might want to add an Ethernet shield to your devices so you can try web based control setups

What specifically do you mean with web based control set-ups? which do you recommend in this case?

Mocking up what the web site should look like is the first thing you need to do. Determine how the Arduino as server is to get the data that is to be displayed in each field. Determine what buttons/fields should send data to the Arduino.

Only then can you start having the Arduino serve up the page and respond to submit buttons on the form(s).

I know what the website should do, its the same as the interface I posted in picture 2. It should also overule the interface of the tft on the greenhouse. Now what is all that needed to be developed? (appart fromt the arduino code)

Thanks in advance.

I know what the website should do, its the same as the interface I posted in picture 2.

I was thinking more in terms of writing some html to have a browser render a screen image, with forms and actions methods, etc. that you could actually test on a server and browser before involving the Arduino to serve up the page.

Some html and some Arduino code to serve up the page, and react to the various GET requests is all that you now need to develop. You should be done this week.

I was thinking more in terms of writing some html to have a browser render a screen image, with forms and actions methods, etc. that you could actually test on a server and browser before involving the Arduino to serve up the page.

Some html and some Arduino code to serve up the page, and react to the various GET requests is all that you now need to develop. You should be done this week.

Thanks. This makes sense to me. Although: the :

... writing some html to have a browser render a screen image, with forms and actions methods, etc

sounds still challenging. I am a beginnner when it comes to html. However, I got descend software to program it, have drupal experience, so must be able to get it in a right direction.

It would be extremely helpfull if someone can add sample html code (used for a similiar project). Which I can use and modify for this case.

Much thanks in advance!

Okee, I have been programming something really simple with an lcd screen just to get started with the basics, becuase I have some problems with obaining the touch screen. This is a basic sketch without the server and all, just functioning on an arduino uno and with an lcd screen to adjust minhum and max temp level before watering / ventilating.

Sketch is below.

Problem: I cant get the DHT 11 working when I compile it gives an error. Can someone help? thanks

#include <Wire.h>
#include <LiquidCrystal.h> // include the library code:
#define dht_dpin A1               //pin for DHT11
#define DHTTYPE DHT11

byte dht_dat[4]; //Array to hold the bytes sent from sensor.
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// named constant for the pin the sensor is connected to
const int waterPin = 2;       // Pin for relay to solenoid valve
const int fanPin = 4;         // Pin for relay to Fan / Ventialation
const int potTempPin =A2;     // Pin for potmeter max Temp
const int potHumPin =A3;      // Pin for potmeter min soilHum
const int soilLEDPin = 7;     // choose the pin for the LED (turns on when the soil is dry
const int soilSensorPin = A5;  // Pin for soil humidity Sensor
int potTempVal;               // value from potentiometer for temp (turn knob Max temp)
int potHumVal;                // value from potentiometer for soil Humidity (turn knob min hum)
int maxTemp = 40;             // Maximal temperature is 40 degrees (" ")
int minSoilHum = 0;           // Minimal soil humidity level before turning "watering" on.
int maxTempSet;                  // Max temperature setting        
int minHumSet;                  // Min Soil humitdity setting
int pirState = LOW;             // we start, assuming no motion detected                    // variable for reading the pin status 
int SoilSensorValue;            // variable Soil Sensor
int var1;                      // variable while loop
int var2;                      // variable while loop

  
void setup(){
    
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD to see the power is connected.
  lcd.print("Power is on");

  // fan pinmode set begins low
  pinMode(fanPin, OUTPUT); 
  digitalWrite(fanPin, LOW);
  
  // irrigation pinmode set begins low
  pinMode(waterPin, OUTPUT); 
  digitalWrite(waterPin, LOW);
  
  //soil level pinmode set begins low
  pinMode(soilLEDPin, OUTPUT);      // declare LED as output 
  pinMode(soilSensorPin, INPUT);     // declare soil humidity sensor as input 
  
  // potmeters adjustment and modification
  maxTempSet = map(potTempVal, 0, 1023, 0, 45); // formule voor maken 0 tot 45 graden
  minHumSet = map(potHumVal, 0, 1023, 0, 100);  // formule voor maken 0 tot 100 % vochtigheid
   
 InitDHT();                    //Initializing for reading DHT
   
   delay (3000);
   lcd.clear();

}

void loop(){

lcd.print("Set max Temp");
delay(3000);
  
// ten seconds to adjust Max temperature
  
   var1 = 0;
 while(var1< 100){// loops for ten seconds
  potTempVal = analogRead(potTempPin); // read the value of the potentiometer
  lcd.clear();
  lcd.print("Max Temp:");
  lcd.print(maxTempSet, DEC);
  delay (100);
  var1++;
}  

lcd.print("Set min Hum");
delay(3000);
  


// ten seconds to adjust Min soil Humidity

  var2 = 0;
while(var2 < 100){ // loops for ten seconds
  potHumVal = analogRead(potHumPin); // read the value of the potentiometer
  lcd.clear();
  lcd.print("Min Hum:");
  lcd.print(minHumSet, DEC);
  delay (100);
  var2++;
}

 
  
  // DHT PIN
  ReadDHT();      //Read from DHT chip
  temp = dht_dat[0]; // giving variable a name
  airHum = dht_dat[2]; // giving variable a name
  
  // Soil Hum Pin
  
  soilSensorValue = analogRead(analogPin); // reads sensor soil hummidity pin and makes value
 
  
 // Turn on the display, and show the three sensor values in degrees or in percentage than leave it on for three seconds
  
  lcd.display();  

  lcd.print("AirHum is:");
  lcd.print(airHum, DEC);
  lcd.println("% ");
  
  delay (3000); 
  lcd.clear();
  delay (500);
  
  lcd.print("Temp is: ");
  lcd.print(temp, DEC);
  lcd.println(" *C ");
  
  delay (3000); 
  lcd.clear();
  delay (500);
  
  
  lcd.print("SoilHum is: ");
  lcd.print(soilSensorValue, DEC);
  lcd.println(" % ");

  delay (3000); 
  lcd.clear();
  
  delay (500);
  
  // controlling the WaterPump by reading the soil humidity
  
    if (soilSensorValue < minSoilHum) {            // check if the soil has low humidity

    // vochtigheid laag
    digitalWrite(ledPin, HIGH);  // turn LED ON 
    lcd.print("Soil dry"); //
    lcd.println ("Now Watering"); 
    digitalWrite(waterPin, High); // turning solenoid valve open to start watering
    delay (1000*60);               // watering continuesly for 1 minute
    lcd.clear();
  }
    else 
    { 
    // vochtigheid hoog
    digitalWrite(ledPin, LOW); // turn LED OFF 
    digitalWrite(waterPin, LOW); // turns or leaves solenoid water valve closed
  }
 
// Controlling Fan / Window opening closing
  
  if(temp > maxTemp){
    digitalWrite(fanPin, HIGH);
    lcd.print("Max Temp!");
    lcd.println("Fan is on");
    delay(3000);
    lcd.clear(); 
  } 
  else {
    digitalWrite(fanPin, LOW);
  }

}

michiel1984: I cant get the DHT 11 working when I compile it gives an error.

But you're not going to tell us what that error is?

this is the error it gives: 'InitDHT' was not declared in this scope

michiel1984: this is the error it gives: 'InitDHT' was not declared in this scope

You call the function in your code, but you don't define what its supposed to do, nor do you include a library that defines what it is supposed to do.

Got my code and hardware running. Thanks for the help. Eventually I used the DHT11 library.

#include <DHT11.h>
#include <Wire.h>
#include <LiquidCrystal.h> // include the library code:

int dHTPin = A4;
DHT11 dht11(dHTPin);
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// named constant for the pin the sensor is connected to


const int waterPin = 2;       // Pin for relay to solenoid valve
const int fanPin = 4;         // Pin for relay to Fan / Ventialation
const int potTempPin =A2;     // Pin for potmeter max Temp
const int potHumPin =A3;      // Pin for potmeter min soilHum
const int soilLEDPin = 7;     // choose the pin for the LED (turns on when the soil is dry
const int soilSensorPin = A5;  // Pin for soil humidity Sensor
int potTempVal;               // value from potentiometer for temp (turn knob Max temp)
int potHumVal;                // value from potentiometer for soil Humidity (turn knob min hum)
int minSoilHum = 0;           // Minimal soil humidity level before turning "watering" on.
int maxTempSet;                  // Max temperature setting        
int minHumSet;                  // Min Soil humitdity setting
int pirState = LOW;             // we start, assuming no motion detected                    // variable for reading the pin status 
int SoilSensorValue;            // variable Soil Sensor
int var1;                      // variable while loop
int var2;                      // variable while loop

  
void setup(){
    
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD to see the power is connected.
  lcd.print("Power is on");

  // fan pinmode set begins low
  pinMode(fanPin, OUTPUT); 
  digitalWrite(fanPin, LOW);
  
  // irrigation pinmode set begins low
  pinMode(waterPin, OUTPUT); 
  digitalWrite(waterPin, LOW);
  
  //soil level pinmode set begins low
  pinMode(soilLEDPin, OUTPUT);      // declare LED as output 
  pinMode(soilSensorPin, INPUT);     // declare soil humidity sensor as input 
  
 
  
  

   delay (3000);
   lcd.clear();

}

void loop(){


// ten seconds to adjust Max temperature
  
   var1 = 0;
 while(var1< 50){// loops for ten seconds
  potTempVal = analogRead(potTempPin); // read the value of the potentiometer
  maxTempSet = map(potTempVal, 0, 1023, 0, 45); // formule voor maken 0 tot 45 graden
  lcd.clear();
  lcd.print("Set max temp now:");
  lcd.setCursor(0,1);
  lcd.print(maxTempSet, DEC);
  lcd.print(" celcius");
  delay (100);
  var1++;
}  
lcd.clear();
delay(500);
  


// ten seconds to adjust Min soil Humidity

  var2 = 0;
while(var2 < 50){ // loops for ten seconds
  potHumVal = analogRead(potHumPin); // read the value of the potentiometer
  minHumSet = map(potHumVal, 0, 1023, 0, 100);  // formule voor maken 0 tot 100 % vochtigheid
  lcd.clear();
  lcd.print("Set min soil");
  lcd.setCursor(0,1);
  lcd.print("humidity:");
  lcd.print(minHumSet, DEC);
  lcd.print("%");
  delay (100);
  var2++;
}

 
  
  // DHT PIN
 
  int err;
  float temp, humi;
  
  if((err=dht11.read(humi, temp))==0)
  {
 

  
 // Turn on the display, and show the three sensor values in degrees or in percentage than leave it on for three seconds
  
  lcd.clear(); 
  lcd.print("AirHum is:");
  lcd.print(humi, DEC);
  lcd.println("% ");
  
  delay (2000); 
  lcd.clear();
  delay (500);
  
  lcd.print("Temp is: ");
  lcd.print(temp, DEC);
  lcd.println(" *C ");
  
  delay (2000); 
  lcd.clear();
  delay (500);
  
    }
  else
  {
    lcd.print("Error No :");
    lcd.print(err);
    
   }
  delay(DHT11_RETRY_DELAY); //delay for reread
  
  
  
  // Soil Hum Pin
  int soilSensorValue = analogRead(soilSensorPin); // reads sensor soil hummidity pin and makes value
  int soilHumid = map(soilSensorValue, 0, 1023, 0, 100);
  soilHumid = 100 - soilHumid;
  lcd.print("SoilHum is: ");
  lcd.print(soilHumid, DEC);
  lcd.print(" % ");

  delay (2000); 
  lcd.clear();
  
  delay (500);
  
  // controlling the WaterPump by reading the soil humidity
  
    if (soilHumid < minSoilHum) {            // check if the soil has low humidity

    // vochtigheid laag
    digitalWrite(soilLEDPin, HIGH);  // turn LED ON 
    lcd.print("Soil too dry"); //
    lcd.setCursor(0,1); 
    lcd.print("now watering"); //
    digitalWrite(waterPin, HIGH); // turning solenoid valve open to start watering
    delay (1000*60);               // watering continuesly for 1 minute
    lcd.clear();
  }
    else 
    { 
    // vochtigheid hoog
    digitalWrite(soilLEDPin, LOW); // turn LED OFF 
    digitalWrite(waterPin, LOW); // turns or leaves solenoid water valve closed
  }
 
// Controlling Fan / Window opening closing
  
  if(temp > maxTempSet){
    digitalWrite(fanPin, HIGH);
    lcd.print("Max Temp reached");
    lcd.setCursor(0,1);
    lcd.print("ventilation on");
    delay(2000);
    lcd.clear(); 
  } 
  else {
    digitalWrite(fanPin, LOW);
  }
  delay(500);
}

There is something wrong with my if statement for the waterpump (See " // controlling the WaterPump by reading the soil humidity" . It does not display: “now watering” it only changes the direction of the servo but does not go back to initial value after a minute. Also I want my lcd screen to display the text while watering. what am I doing wrong? (The code gave no errors compiling) Thanks in advance!

#include <DHT11.h>
#include <Wire.h>
#include <LiquidCrystal.h> // include the library code:
#include <Servo.h>
Servo waterServo;
int dHTPin = A4;
DHT11 dht11(dHTPin);
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// named constant for the pin the sensor is connected to


const int waterPin = 9;       // Pin for relay to solenoid valve
const int fanPin = 4;         // Pin for relay to Fan / Ventialation
const int potTempPin =A2;     // Pin for potmeter max Temp
const int potHumPin =A3;      // Pin for potmeter min soilHum
const int soilLEDPin = 7;     // choose the pin for the LED (turns on when the soil is dry
const int soilSensorPin = A5;  // Pin for soil humidity Sensor
int potTempVal;               // value from potentiometer for temp (turn knob Max temp)
int potHumVal;                // value from potentiometer for soil Humidity (turn knob min hum)
int minSoilHum = 0;           // Minimal soil humidity level before turning "watering" on.
int maxTempSet;                  // Max temperature setting        
int minHumSet;                  // Min Soil humitdity setting
int SoilSensorValue;            // variable Soil Sensor
int var1;                      // variable while loop
int var2;                      // variable while loop

  
void setup(){
    
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD to see the power is connected.
  lcd.print("Power is on");

  // fan pinmode set begins low
  pinMode(fanPin, OUTPUT); 
  digitalWrite(fanPin, LOW);
  
  // irrigation pinmode set begins low
  pinMode(waterPin, OUTPUT); 
  digitalWrite(waterPin, LOW);
  
  //soil level pinmode set begins low
  pinMode(soilLEDPin, OUTPUT);      // declare LED as output 
  pinMode(soilSensorPin, INPUT);     // declare soil humidity sensor as input 
  
 waterServo.attach(9);
 waterServo.write(0);
  
  

   delay (3000);
   lcd.clear();

}

void loop(){


// ten seconds to adjust Max temperature
  
   var1 = 0;
 while(var1< 50){// loops for ten seconds
  potTempVal = analogRead(potTempPin); // read the value of the potentiometer
  maxTempSet = map(potTempVal, 0, 1023, 0, 45); // formule voor maken 0 tot 45 graden
  lcd.clear();
  lcd.print("Set max temp now:");
  lcd.setCursor(0,1);
  lcd.print(maxTempSet, DEC);
  lcd.print(" celcius");
  delay (100);
  var1++;
}  
lcd.clear();
delay(500);
  


// ten seconds to adjust Min soil Humidity

  var2 = 0;
while(var2 < 50){ // loops for ten seconds
  potHumVal = analogRead(potHumPin); // read the value of the potentiometer
  minHumSet = map(potHumVal, 0, 1023, 0, 100);  // formule voor maken 0 tot 100 % vochtigheid
  lcd.clear();
  lcd.print("Set min soil");
  lcd.setCursor(0,1);
  lcd.print("humidity:");
  lcd.print(minHumSet, DEC);
  lcd.print("%");
  delay (100);
  var2++;
}

 
  
  // DHT PIN
 
  int err;
  float temp, humi;
  
  if((err=dht11.read(humi, temp))==0)
  {
 

  
 // Turn on the display, and show the three sensor values in degrees or in percentage than leave it on for three seconds
  
  lcd.clear(); 
  lcd.print("AirHum is:");
  lcd.print(humi, DEC);
  lcd.println("% ");
  
  delay (2000); 
  lcd.clear();
  delay (500);
  
  lcd.print("Temp is: ");
  lcd.print(temp, DEC);
  lcd.println(" *C ");
  
  delay (2000); 
  lcd.clear();
  delay (500);
  
    }
  else
  {
    lcd.print("Error No :");
    lcd.print(err);
    
   }
  delay(DHT11_RETRY_DELAY); //delay for reread
  
  
  
  // Soil Hum Pin
  int soilSensorValue = analogRead(soilSensorPin); // reads sensor soil hummidity pin and makes value
  int soilHumid = map(soilSensorValue, 0, 1023, 0, 100);
  soilHumid = 100 - soilHumid;
  lcd.print("SoilHum is: ");
  lcd.print(soilHumid, DEC);
  lcd.print(" % ");

  delay (2000); 
  lcd.clear();
  
  delay (500);
  
  // controlling the WaterPump by reading the soil humidity
  
    if (soilHumid < minSoilHum) {            // check if the soil has low humidity

    // low soil humidity
    digitalWrite(soilLEDPin, HIGH);  // turn LED ON 
    waterServo.write(1023); 
    lcd.print("Soil too dry"); //
    lcd.setCursor(0,1); 
    lcd.print("now watering"); //
    // turning solenoid valve open to start watering
    delay (1000*60);               // watering continuesly for 1 minute
    lcd.clear();
    waterServo.write(0); 
  }
    else 
    { 
    // vochtigheid hoog
    digitalWrite(soilLEDPin, LOW); // turn LED OFF 
    waterServo.write(0); // turns or leaves solenoid water valve closed
  }
 
// Controlling Fan / Window opening closing
  
  if(temp > maxTempSet){
    digitalWrite(fanPin, HIGH);
    lcd.print("Max Temp reached");
    lcd.setCursor(0,1);
    lcd.print("ventilation on");
    delay(2000);
    lcd.clear(); 
  } 
  else {
    digitalWrite(fanPin, LOW);
  }
  delay(500);
}

This is a possible problem:

    delay (1000*60);               // watering continuesly for 1 minute

Those constants are treated by the compiler as 16 bit signed integers. The result of the calculation will overflow. Try this instead:

    delay (1000UL*60UL);               // watering continuesly for 1 minute

Generally, servo.Write takes a value in degrees. 1023 seems unusually high.