Go Down

Topic: Growduino smart garden (Read 28185 times) previous topic - next topic

salsaman

I've been toying with so many ideas of things to automate, but with the long days and an approaching 2-week trip and two young plants at home, I started working in earnest on a garden control project last night.  "Growduino" seemed like the obvious name... ;D

This is the simplest possible version-- just an automated watering system, with the nutrient solution pumped up from a reservoir in the tub with a submersible pump.

Here's a shot on Flickr:
http://www.flickr.com/photos/salsaviz/2551777410/



from the description:

Quote
The "growduino" smart garden project will, um, grow to include more sensors and controls, but watering on a schedule seems like a good starting point since I'll be leaving the rig alone for 17 days starting Friday.

The program's main parameters are pump period (time between pumps) and pump duration.

Still need to transplant the subjects (heirloom tomato and Artemisia pontica) and add medium, mount the pump, rewire the pump power with ground and a fuse (ahem), install drip lines, mount the electronic bits, and figure out nutriuent and timing parameters for tasty, healthy results.

Sensing plans: soil/medium moisture, interior and exterior temperature and humidity, nutrient level, nutrient pH, sunlight intensity, sunlight direction, solar panel output, battery charge, CO2 level, what else?

Control plans: shade raising & lowering, vent fan, camera, data logging to web site, battery charging, garden and/or reflector and/or solar panel aiming (sun-dependent), CO2 scrubbing (greenhouse gases for greenhouses!), what else?


Note: the "plans" are in (roughly) increasing level of complexity/desirability-- not sure about aiming or CO2 scrubbing (?!), but moisture, temperature, humidity, and light sensing are definites, as are controlling a vent and logging data to a web page.
My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

walterr

I'm also working on a simple interval timer to control a sprinkler valve. It had not occurred to me that the same device could also turn on a small pump! We like to grow our own garden starts in the spring but end up killing half of them due to lack of watering! Can't wait to use this next spring.

I figured I had the code nailed down, but it randomly goes into a bad state where it is turning the valve on and off as rapidly as it can. This is not good! I have to get in there and find that bug!

I'm still deciding how to switch the 24V A/C on and off. It's only 24V and fairly low current so there are several options. Relay or triac. Have you decided how you are going to switch your pump on and off?

salsaman

Yep, I used a relay and it's all set-- finished it last night (er, early this morning...;) and uploaded a few pics:
http://www.flickr.com/photos/salsaviz/2553297121/



The circuit is pretty much what I found here, with obligatory blinkenlights:
http://www.glacialwanderer.com/hobbyrobotics/?p=9

Here's the code it's running-- I'll probably change the timing values before taking off tonight:
Quote
/*
*  Trigger a relay
*/

int gPin = 3;            // green LED
int bPin = 4;            // blue LED or red LED?  red looks better        
int pumpPin = 2;         // relay

unsigned long time;
unsigned long lastPumpTime;

int pumpPeriodHours = 6;      // hours between pumps
int pumpPeriodSec;            // seconds between pumps

int pumpDurationSec = 10;     // seconds the pump is running

int statusPeriod = 5000;      // ms time between status blinks-- to let you know it's alive
int statusBlink = 200;        // ms duration of status blink

void setup()
{
 pinMode(pumpPin, OUTPUT);
 digitalWrite(pumpPin, LOW);
 pinMode(gPin, OUTPUT);
 digitalWrite(gPin, LOW);
 pinMode(bPin, OUTPUT);
 digitalWrite(bPin, LOW);
 pumpPeriodSec = pumpPeriodHours * 60 * 60;         // seconds between pump starts
 //pumpPeriodSec = 30;    // for setting short periods when testing
}

void loop(){

 lastPumpTime = millis();
 
 // Activate the pump and status LED
 digitalWrite(pumpPin, HIGH);
 digitalWrite(bPin, HIGH);
 delay((pumpDurationSec*1000));
 digitalWrite(pumpPin, LOW);
 digitalWrite(bPin, LOW);

 // Wait for the delay period, blinking periodically    
 time = millis();
 while ( ((time-lastPumpTime)/1000) < pumpPeriodSec ) {
   delay(statusPeriod-statusBlink);
   digitalWrite(gPin, HIGH);
   delay(statusBlink);
   digitalWrite(gPin, LOW);
   time = millis();
 }
}

My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

walterr

Thanks for sharing the details. Your code is _much_ simpler than mine. I'm a programmer by trade and obviously I've over complicated my version (ha ha). I tried to do it without any delay() calls so I could add other things for it to do later without messing up the timing of the water. I'll post my code once I get it behaving.

So it looks like you are driving a 5V DC relay switching 110V AC? Is that a transistor I see on the breadboard or are you driving the relay directly from an output?

I liked your solution of a drip loop around the plants instead of directing the entire flow of the pump into the plants. I guess it would have been fine either way, since overflow from the plants will return to the reservoir anyway.

salsaman

Yes, that's a 2N2222 (overkill)-- I just followed the schematic in that link-- works great.
My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

salsaman

Forgot to post that I added an LCD before taking off 10 days ago-- here counting down the initial delay:




I inadvertently made a "step switch" by mounting it in two plastic shoebox lids (held together with gaffer's tape, of course...:).

Also discovered that twist ties can make nice jumper wires...:o
My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

dcb

#6
Jun 17, 2008, 01:22 pm Last Edit: Jun 17, 2008, 01:29 pm by dcb Reason: 1
Step switch, LOL!  FYI, have you factored in the 9 hour millis rollover?

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1200662708

If you are getting a new lastPumpTime @ 6 hours, you should never get a time = 12 hours;

salsaman

#7
Jun 17, 2008, 04:50 pm Last Edit: Jun 17, 2008, 04:51 pm by salsaman Reason: 1
D'oh!!!

Thanks for pointing that out!

...so, did you notice I'm a newbie?!

At least I won't come crying to the forum when I get home next Monday and find the plants dead!
My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

kreneskyp

have you considered using a web front end so it can be controlled remotely?

this guy has done some of the proof of concept work for web->arduino connection.
http://blog.datasingularity.com/?p=50

I'd be interested in helping out with that.  I currently have a commercial timer for my sprinkler system but i'd like something with more robust scheduling and more importantly i'd like to be able to control it remotely.  I recently went on a vacation and while i was gone for 2 weeks the weather shifted from 60deg cloudy/rainy days to 75 and sunny.  I had the waterign schedule set for the former and nearly every seedling i planted was cooked.  


amml2000

Hey there, I am also starting a very similar project, only got my arduino =) It includes automatic watering, growlights, temperature and humidity regulation. I was wondering, do you know of a way how to measure the ph of the soil?

Plus please keep us updated with ur project, Im so glad If i dont have to write it all by myself =)

Adrian

mycoleptodiscus

Part of your timing problems could be caused by the millis rollover at 9 hrs 32 min?  After this time, the internal timer goes back to zero.  Consider possibly two sensor inputs, temp via a thermistor and humidity via a humidity sensor.  Construct a grid with various humidity and temperature combinations and watering durations.  You will have to run some experiments with a scale/balance and estimate how much water the pots lose at certain temp/humidity combinations.  The Arduino consults this grid and then chooses the correct interval of time to run the pump.  Another option is to measure soil moisture.  This would make your life easier
http://emesystems.com/pdfs/SMX.pdf

http://www.hobby-boards.com/catalog/product_info.php?language=en&products_id=1547

salsaman

Well, first off, the pontica died when I was away since the rig didn't water itself, but it's watering on a four hour interval now-- the original tomato plant and its new sibling are doing fine (spotty leaves aside...:).

Moisture sensing is a red herring, I think, because I'm growing in hydroponic medium.  pH is much more interesting-- still trying to figure out the best sensor, but it seems like it should be straightforward.

Priorities now are aerating and agitating the nutrient reservoir to get the food distributed before the pump goes into action.
My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

rodolpheg

#12
Aug 29, 2008, 07:57 pm Last Edit: Aug 29, 2008, 08:15 pm by rodolpheg Reason: 1
This is such a great project... I found it as I was gathering info on who i would go for a project like this. The only difference being that it would be grown in dirt as opposed of being hydro, and that -if it happens to be possible- the pump would pull water/nutriments from my balcony to the roof of the building (a few meters up) for rooftop gardening...

Also, in my case, moisture measuring would be good (http://www.botanicalls.com/twitter/)

What kind of submersible pump are you using? I'm thinking of using something like the WT660 on this page : http://www.fountainpumpandsupply.com/fountain_pro.htm

Cheers. Keep up the excellent work! I can't to see how you'll handle the different sensors !

freeduino.de

i'm thinking about the same project. but i plan to use a light sensor to do the timing.
i think that is the easiest way to go. you can have two watering intervals (or just one or more) when a light intensity rate gets crossed.
i think the sunlight is still reliable. even when the sun does not shine you get high enough light intensities to start watering.
so just use the sun as your external timer :)

salsaman

Very cool!  I'm working on a growduino layout right now in EAGLE...:)  Details to come...
My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

Go Up