Growduino smart garden

Yep, I used a relay and it's all set-- finished it last night (er, early this morning...:wink: and uploaded a few pics:
Imgur

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:

/*

  • 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();
}
}

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.

Yes, that's a 2N2222 (overkill)-- I just followed the schematic in that link-- works great.

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

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;

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!

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.

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

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://www.hobby-boards.com/catalog/product_info.php?language=en&products_id=1547

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.

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 (Botanicalls Kits)

What kind of submersible pump are you using? I'm thinking of using something like the WT660 on this page : Fountain Pro Submersible Fountain and Pond Pumps

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

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 :slight_smile:

Very cool! I'm working on a growduino layout right now in EAGLE...:slight_smile: Details to come...

here is a nice offer:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&Item=360122594222&Category=75673&_trksid=p3907.m29&_trkparms=algo%3DLVI%26its%3DI%26otn%3D2

i wrote something about solenoids in this thread as wel:

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

Great deal for those valves!

I'm planning on using a 12V system (solar ftw!) and cheap (possibly windshield wiper washer) pumps. I won't have any water source access on a balcony, instead having a reservoir under the plants for water and nutrient-- should be fine to drain into itself (details complicated, more later).

These valves would be useful with a raised reservoir, if the runoff isn't being reused, esp. with a rainwater catchment system.

SO HAPPY to see many people working on different concepts of a "smart garden"!

I too am an avid gardener, who also happen to be an Electronic Technologist who likes to automate and control.

You may wish to consider using my recently introduced MRMP using either Controller or Bridge shell.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1232140631

Using MRMP you can easily add your code, debug and even network them over the serial port or simple Wire network.

As an example I have a Bridge and three Controllers... House Alarm, Garage Alarm and Koi Pond feed and monitor. All are accessible from anywhere in the World. The MRMP Controller code is rock solid, runing for six months without any intervention.

Hope MRMP helps.

Whats the progress of this project?

I plan to invest my entire winter working on a hydroponic version, It will control PH/TDS/nutrent levels, water temps, monitor humidity in the green house, have web monitoring and a software GUI to control and set the many parameters of hydroponic gardening.

Id like to get this get this going with as many of you as possible!

if your interested in participating, shoot me a PM, Ill donate enough $ to each member of the team that provides code for the project to buy a new arduino :slight_smile:

Nice to see that I'm not the only lazy creature on this planet. I have made a thing like that about 6 months ago and have been testing it for all summer, the plants were satisfied, tomatos were delicious :slight_smile: I didn't include an actual arduino board as I made my own to reduce the size of the black box.

What it does:

  • temperature measurement: if it's too hot, it opens the window to let fresh air in. (can be set to auto/manual, if I want to let it closed/opened no matter what)
  • watering: two modes, auto-timer ->twice a day (as we don't water during the day, right) for a set period of time) and auto-humidity (the value shown on lcd) -> measures humidity and if the soil is too dry, triggers the valve (also only twice a day), this is, as on a cold day you don't need so much wattering.

I guess that's all you need :slight_smile:




That looks like a nice set up Odisej. I'm curious as to how you have the window set up.

Pretty cool! I've wanted to do something like this, but I just have a deadly fear of water anywhere near electronics. Maybe this will motivate me (if I'm careful enough haha :P)!