Garduino: Difference between revisions
change code format |
Changed format of pictures |
||
Line 35: | Line 35: | ||
= Details = | = Details = | ||
== Overview == | == Overview == | ||
This is a small overview, and technical overview will be posted soon. The relais and pump or missing in the code for now. | This is a small overview, and technical overview will be posted soon. The relais and pump or missing in the code for now.<br> | ||
[[File:gArduino_overview.jpg]] | [[File:gArduino_overview.jpg]]<br> | ||
[[File:gArduino_picture.jpg]] | [[File:gArduino_picture.jpg]]<br> | ||
== Moist sensor == | == Moist sensor == | ||
[[File:gArduino_moistsensor.jpg]] | [[File:gArduino_moistsensor.jpg]] | ||
== Solar sensor == | == Solar sensor == | ||
The solar sensor is just an solar panel, we need to adjust it a bit because it's working to well. For this we will use a filter. | The solar sensor is just an solar panel, we need to adjust it a bit because it's working to well. For this we will use a filter.<br> | ||
[[File:gArduino_moistsensor.jpg]] | [[File:gArduino_moistsensor.jpg]] | ||
Revision as of 13:56, 7 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.
Why
Why the Garduino? Well, we are very lazy and we want to be sure our garden is really 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)
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
Solar sensor
The solar sensor is just an solar panel, we need to adjust it a bit because it's working to well. For this we will use a filter.
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.
This code is also re-used code from several example's of the Arduino toolkit. You will probably recognize some.
Current dev version of the gArduino is v0.3 alpha
/* * int potPin = 0; // select the input pin for the sensor int solarPin = 1; // select the input pin for the 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 = 300; // 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> // 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 }; // telnet defaults to port 23 Server server(23); 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); // start listening for clients server.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); // if (valcnt = interval) { val = (valtot / valcnt); if (val < 300) { digitalWrite(ledPin1, HIGH); // turn the ledPin on } else { digitalWrite(ledPin1, LOW); // turn the ledPin off } // Print monitoring details on serial port Serial.print(valtot); Serial.print(" delen door "); Serial.print(valcnt); Serial.print(" is "); Serial.print(val); Serial.print(" "); // Print monitoring details on ethernet Client client = server.available(); if (client) { server.print("Moist:"); server.println(val); server.print("Solar"); server.println(analogRead(solarPin)); server.println(""); } valcnt = 0; valtot = 0; // } }