Introduction: Autonomous Greenhouse Factory

About: Im a high school student in video design classes, I like to hang out with my friends, build websites and make movies. life is short so make it fun

(Please keep in mind: This is my first instructable, and my first essay-like thing I ever post online, and my first time coding with arduino)
This is my impulsive side when I let go of its leash. I normally go and do something crazy such as this. I got an idea while browsing through instructables. Why not build a greenhouse? I remembered a movie about an autonomous house, so why not do something like that? 
I looked up instructables on greenhouses and I saw an instructables on automatic plant watering with an Arduino. That's great, I finally have a permanent use for my arduino. After brainstorming a little more I thought of using some kind of tank to hold the water, kind of like the ones they use in our city but smaller (way smaller). This would let me use gravity as my source of energy for water movement and leave no need for a water pump. 

This instructable is custom for anyone, there is no exact dimensions since this is more of a "factory" of arduino workers which interoperate and keep the greenhouse in order.

I'll stop with the background/rambling and start with the steps

I forgot to mention this instructable is for the robots contest, and im 16

Step 1: Step One, Materials, Materials, Materials

For this watering (I will add more things, such as ventilation when i finish) system you will need:

-PVC pipes
    -Depends on your design, you mainly need one tube with an end sealed with holes through the tubes to let water to the sprinkler.
-Sprinklers, such as these, or you can buy small clear plastic tubes and cut little holes to make this project more DIY-er (http://www.homedepot.com/h_d1/N-5yc1v/R-100128340/h_d2/ProductDisplay?langId=-1&storeId=10051&catalogId=10053 )

-Arduinos
   -One per Tray to control watering and reporting humidity
   -One 'Main' Arduino that other arduinos report to
   -One Arduino to control how much water is in the water container and to refill it

In total you need about 10 arduinos, or if you are able to simplify the code and make it usable in less Arduinos please do. I know this might get a little expensive but It leaves you with limitless posibilities in expansion.

-Cables (20mts or more) Or get some of that phone wire it works great in these projects.
-4 pressure sensors
-Servos (one per tray)
-Hot glue & hot glue gun
-Nails (2 per tray)
-LEDs (red, green, yellow)
-A valve for each tray to water (http://www.homedepot.com/h_d1/N-5yc1v/R-100183126/h_d2/ProductDisplay?langId=-1&storeId=10051&catalogId=10053 ) this picture is just for reference, you could probably find something.
-Pipe glue (or whatever its really called) It will help you make this stronger
-Wood or an structure to hold the water container


I think this is it, I will probably revise this to include all the other materials, Lets get on the building

Step 2: Setting Up the Pipes

I think that the diagram and pictures say everything, but to clear any doubt you can do this in any way:

It can be just a straight line or any shape you want, the main thing is that it has to be a closed system with no water leaks.

You should add an emergency valve next to the jug just in case something breaks and there's water falling everywhere

Step 3: Cabling

To water the plants  you use the servo with the valve and and to check the soil moisture you use 2 nails (which I got the idea from https://www.instructables.com/id/Garduino-Gardening-Arduino/ )

*Circuit diagram here* & diagram of the thing

To check the water container's weight I followed ideas from (http://www.sparkfun.com/tutorials/144 ) this tutorial at sparkfun, they use a keg but here we will just use it for water. (This leaves it open for a tweeting greenhouse too)

*Circuit*

Step 4: Watering


Coding, im still cleaning it up but here is a brainstorm for the watering bots.

The code used is for improvising, instead of a servo you can use a small toy DC motor that has a gear and blocks the tube (ill post up pictures tomorrow, its kinda really late right now) and whenever the motor moves water is able to seep in. I will probably improve this idea tomorrow when I get the chance to work with the motor, but I think this shows a point.

//define analog inputs
int moistureSensor = 0;
int tempSensor = 2;

//define valve output
int waterValve = 7;

void setup() {
Serial.begin(9600);
pinMode (waterValve, OUTPUT);
digitalWrite (waterValve, LOW);
}
void loop() {
moisture_val = analogRead(moistureSensor);
Serial.print("moisture sensor reads ");
Serial.println( moisture_val );
delay(1000);

//turn water on when soil is dry
if (moisture_val < 850)
{
digitalWrite(waterValve, HIGH);
}

while (moisture_val < 850)
{
delay(10000);
moisture_val = analogRead(moistureSensor);
}

digitalWrite(waterPump, LOW);

}

Step 5: Water Container Code

(im still working, but I wanted to add it already to show something and not miss this step)
Little I know about coding Arduinos, so if anyone wants to pitch in and help, please do


const int cintEmptyForce = 1200;
const int cintFullForce = 1347;



const int cintHandleSensorPin = 19;
const int cintForcePin1 = 0;
const int cintForcePin2 = 1;
const int cintForcePin3 = 2;
const int cintForcePin4 = 3;


void loop()
{

  boolean boolPlantsWatered = [do the bottom thing]

  //Read force sensors
  int intForce1 = analogRead(cintForcePin1);
  int intForce2 = analogRead(cintForcePin2);
int intForce3 = analogRead(cintForcePin3);
int intForce4 = analogRead(cintForcePin4);

//Add up the forces
int intForceSum = intForce1 + intForce2 + intForce3 + intForce4;

//Calculate the percentage full
int intPercentFull = int(float(100.0 * (intForceSum - cintEmptyForce) / ( cintFullForce - cintEmptyForce )));

delay(20000);

Step 6: Future Expansions

-Tweeting greenhouse?
-Refilling the container when water is low?
-Temperature sensors & ventilation?
-Solar panels to power everything
-Kit?




National Robotics Week Robot Contest

Second Prize in the
National Robotics Week Robot Contest

3rd Epilog Challenge

Participated in the
3rd Epilog Challenge