Vous êtes sur la page 1sur 10

Garduino

The gArduino is a Automated Garden Facility (AGF) and it's build on the Arduino platform. It is used to automate your garden. Our primary goal is to "water" the garden and monitor the garden environment. Currently we have build the gArduino to measure the water status of a plant. The information is collected by an NSLU2 mini linux server. The information will be published soon on cacti graphs.

Contents
[hide]

1 Why 2 What 3 Statistics 4 Actions 5 Details

o o

5.1 Overview 5.2 Moist sensor

o o

5.2.1 HOW to build: 5.2.2 Overview 5.2.3 Nice to have:

5.3 Solar sensor 5.4 Code

Why
Why the Garduino? Well, we are very lazy and we want to be sure our garden is doing fine in the hot summer days

What
We have several sensors. Currently we have build these ones: Moist sensor Solar sensor Water level sensor (same as moist)

Some sensors which can be attached in the future:

Rain sensor (will be adjusted moist sensor) Wind sensor Temperature sensor (ordered and installed soon)

Statistics
Our graph page: [1] We build our graphs in cacti.

Actions
start the pump water circuit selector Call for help: Out of water Ground is not getting wet

Monitor How much water is needed and how often Weather/water conditions Graphs in cacti etc.

Details
Overview
This is a small overview, and technical overview will be posted soon. The relais and pump or missing in the code for now.

File:GArduino picture.jpg

Moist sensor
The current 0.2 moist sensor is build of: film canister (one with a flat cap!) two INOX screws (about >8 cm) Wire (we used CAT5)

Epoxy

HOW to build:
Open the film canister and screw the screws thru the cap Drill a hole in the bottom of the canister and put the wire thru Strip the wire and connect two of them to the screws in the cap Mix the epoxy and will the canister (Be sure to ventilate!) Add the cap to the canister and put it upside-down so the epoxy will protect the connections of the screws Connect the other end of the wires to you gArduino configuration

Overview

Nice to have:
Build the circuit into the moist sensor, this will increase the quality of the measurements Stacking option of multi sensors

Solar sensor

The solar sensor is just a solar panel, we need to adjust it a bit because it's working to well. For this we will use a filter. File:GArduino solarsensor.jpg

Code
My programming skill's aren't the best.... but it's functioning :-) As you can see, I added an ethernet shield to monitor the data. You can do this monitoring also by using the USB serial connection. We are working on live cacti graphs... soon they will be available. Some of the code is re-used code from several example's of the Arduino toolkit. You will probably recognize some. Current dev version of the gArduino is v0.5 alpha /* * AnalogInput * by DojoDave <http://www.0j0.org> * * Turns on and off a light emitting diode(LED) connected to digital * pin 13. The amount of time the LED will be on and off depends on * the value obtained by analogRead(). In the easiest case we connect * a potentiometer to analog pin 2. * * http://www.arduino.cc/en/Tutorial/AnalogInput */ int potPin = 0; // select the input pin for the moist sensor int solarPin = 5; // select the input pin for the solar sensor int tempPin = 4; // select the input pin for the temp sensor int ledprobe = 9; // select the input pin for the sensor int ledPin1 = 8; // select the pin for the LED int val = 0; // variable to store the value coming from the sensor int valtot = 0; // variable to store the total probe details int valprobe = 0; // variable to store the probe details int valcnt = 0; // variable to store the probe counter int valtmp = 0; // variable to temperary store the total probe details int interval = 32; // the total ammount of probes before advertising the average, caution!!! the max count is 32 if measurring a max 1024 vallue!!! WILL BE CORRECTED WITH long int soon int probedelay = 100; // the delay between the probes in milliseconds int wet = 350; // the probevalue to decide what wet is int dry = 200; // the probevalue to decide what too dry is #include "Ethernet.h"

#include "WebServer.h" // network configuration. gateway and subnet are optional. byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 192, 168, 1, 177 }; byte gateway[] = { 192, 168, 1, 1 }; byte subnet[] = { 255, 255, 255, 0 }; /* This creates an instance of the webserver. By specifying a prefix * of "/", all pages will be at the root of the server. */ #define PREFIX "/garduino" WebServer webserver(PREFIX, 80); /* commands are functions that get called by the webserver framework * they can read any posted data from client, and they output to the * server to send data back to the web browser. */ void helloCmd(WebServer &server, WebServer::ConnectionType type) { /* this line sends the standard "we're all OK" headers back to the browser */ server.httpSuccess(); /* if we're handling a GET or POST, we can output our data here. For a HEAD request, we just stop after outputting headers. */ if (type != WebServer::HEAD) { /* this defines some HTML text in read-only memory aka PROGMEM. * This is needed to avoid having the string copied to our limited * amount of RAM. */ P(helloMsg) = "<h1>Hello, World!</h1>"; /* this is a special form of print that outputs from PROGMEM */ server.printP(helloMsg); } } void moistCmd(WebServer &server, WebServer::ConnectionType type) { /* this line sends the standard "we're all OK" headers back to the browser */ server.httpSuccess(); /* if we're handling a GET or POST, we can output our data here. For a HEAD request, we just stop after outputting headers. */ if (type != WebServer::HEAD) { //Print Moist val on http server.print(val);

} } void solarCmd(WebServer &server, WebServer::ConnectionType type) { /* this line sends the standard "we're all OK" headers back to the browser */ server.httpSuccess(); /* if we're handling a GET or POST, we can output our data here. For a HEAD request, we just stop after outputting headers. */ if (type != WebServer::HEAD) { //Print Solar on http int valsolar = analogRead(solarPin); server.print(valsolar); } } void tempCmd(WebServer &server, WebServer::ConnectionType type) { /* this line sends the standard "we're all OK" headers back to the browser */ server.httpSuccess(); /* if we're handling a GET or POST, we can output our data here. For a HEAD request, we just stop after outputting headers. */ if (type != WebServer::HEAD) { //Print Solar on http int valtemp = analogRead(tempPin); server.print(valtemp); } }

void setup() { pinMode(ledPin1, OUTPUT); // declare the ledPin as an OUTPUT pinMode(ledprobe, OUTPUT); // declare the ledPin as an OUTPUT Serial.begin(9600); // initialize the ethernet device Ethernet.begin(mac, ip, gateway, subnet); /* setup our default command that will be run when the user accesses * the root page on the server */ webserver.setDefaultCommand(&helloCmd);

/* run the same command if you try to load /index.html, a common * default page name */ webserver.addCommand("index.html", &helloCmd); webserver.addCommand("moist", &moistCmd); webserver.addCommand("solar", &solarCmd); webserver.addCommand("temp", &tempCmd); /* start the webserver */ webserver.begin(); } void loop() { do { digitalWrite(ledprobe, HIGH); // turn the ledprobe on valprobe = analogRead(potPin); // read the value from the sensor delay(50); digitalWrite(ledprobe, LOW); // turn the ledprobe off valtmp = valtot; valtot = valtmp + valprobe; valcnt = valcnt + 1; delay(probedelay - 50); } while (valcnt != interval);

val = (valtot / valcnt); if (val < 300) //TODOPARAMETER { digitalWrite(ledPin1, HIGH); // turn the ledPin on } else { digitalWrite(ledPin1, LOW); // turn the ledPin off } Serial.println(val); /* process incoming connections one at a time forever */ webserver.processConnection(); valcnt = 0; valtot = 0; }

este sensor toma como imput la humedad de la tierra, por medio de dos clavos galvanizados. Si hay humedad, la resistencia entre ambos lados disminuir, mientras que si hay poca humedad, la resistencia aumenta. La ventana de Arduino documenta segundo a segundo la humedad. Para construir este sensor necesitamos: - Arduino. - 2 clavos galvanizados. - 1 resistencia de 10K. - Cables. Instrucciones: - Cortar 2 cables de 15cm aprox y enrollar uno de los extremos de cada uno en la parte superior de los clavos. Estos sern los sensores de humedad. - Conectar uno de los sensores a la lnea positiva de la protoboard, y de ah sacar una conexin a 5V en el Arduino. - Conecta el otro sensor a una lnea nueva en la protoboard. - Conecta una resistencia de 10K a la misma lnea del sensor, y a una lnea nueva. - Conecta un cable desde Analog 0 en el Arduino, hasta la lnea donde se encuentra el sensor de humedad y la resistencia. - Conecta la otra pata de la resistencia a tierra. Conecta Arduino a tu PC y escribe el siguiente cdigo. Este te permitir conocer la humedad presente en cada segundo. int moistureSensor = 0; int moisture_val; void setup() { Serial.begin(9600); //open serial port } void loop() { moisture_val = analogRead(moistureSensor); // read the value from the moisture-sensing probes Serial.print("moisture sensor reads "); Serial.println( moisture_val ); delay(500); }

Vous aimerez peut-être aussi