* 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 ===

[[File:gArduino_moistsensor.jpg]]

[[File:gArduino_moistsensor.jpg]]

+

+

=== 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 ==

== 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.<br>

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.<br>

Revision as of 12:41, 23 June 2009

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.

Actions

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;
}