Garduino: Gardening + Arduino

Garduino is a gardening Arduino. So far, Garduino:
-Waters my plants whenever their soil moisture level drops below a predefined value.
-Turns on grow lights, but only when it's dark out and only long enough to make the plants get 15 hours of total light (sunlight + supplemental light) daily.
-Alerts me if the temperature around the plants drops below 50 degrees.

This is the first grow-light and auto-water setup i know of that takes into account natural sunlight received and soil moisture level before turning on water / light.

This and other projects I've built are available as kits / products at my website.

I heavily relied on knowledge / inspiration / encouragement from:
-Mikey Sklarand his many green-tech projects
-Selwyn Pollit's permaculture knowledge
-Mitch Altman, for giving me a long-overdue lesson on how to properly solder

Future expansions might include:
-Teaching my Garduino to brew his own compost tea from greywater.
-Using pulsed, red-and-blue LED grow lights (like Mikey Sklar's setup) to significantly increase efficiency.
-Adding a solar panel and batteries to remove any need for a power grid.
-Testing for soil ph level and air CO2 content.
Remove these adsRemove these ads by Signing Up

Step 1: Obtain Your Materials

Picture of Obtain Your Materials
I built this using recycled / free materials wherever I could think to. It cost significantly less than $100 in total. Here's what I used:

The relays:
Omron G5LE-1 relays]
1N4004 diodes]
1 A.C. extension cord
1 A.c. power cord
1 A. C. outlet

The watering system:
1 Tiny clean-water pump
1 Plastic milk jug
~2 Old road bike tubes
1 Milk crate

The lighting system:
1 4' fluorescent light fixture
1 "plant type" fluorescent bulb (I used the Ott-Lite, but any bulb marketed as for plants should be fine)

The soil moisture sensor:
2 galvanized nails, 1-4" in length

The light sensor:
1 photocell

The temperature sensor / alert:
1 LED (any you'd use with an Arduino will do)
1 10k-ohm thermistor

The plants and holders:
A variety of seeds, preferably that'll grow into things you'd like to eat. Everywhere, I hear people recommend swiss chard as an easy starter plant...

Planting containers:
As many plastic milk jugs as you'd like. I used ~30.
28-gallon clear plastic storage containers. You'll need one for every 6 milk jugs.
~5 red bricks for each storage container, or anything else that will allow the milk jugs to stand at least an inch off the bottom of the container.

Soil mixture:
I used Mel's Mix, the mixture recommended in "The Square Foot Gardener." It consists of 1/3 peat moss, 1/3 coarse vermiculite, and 1/3 mixed compost, with the mixed compost coming from at least 6 different sources. I've heard lots of people bash peat moss and vermiculite's sustainability (not to mention vermiculite's obscenely-high price), so definitely explore your options here. As I understand it, you want something w/:
-lots of plant nutrients (the mixed compost)
-water retention (peat moss / vermiculite)
-'fluffiness:' soil should be light so plants can easily grow their roots through and you can easily remove plants from it (vermiculite / peat moss)

Tools / Miscellaneous
Wire stripper
Electrical tape
3 ~10k-ohm resistors
1 ~210-ohm resistor (for the LED)
several feet 22-gauge wire
1 Arduino (in my case a Duemanilove, but any should work)
1 Protoshield (Ladyada's model)
1 mini circuit board
Hot glue gun, with glue
nblyumberg2 months ago

I was reading your Instructable as I am working on a similar project. Just wanted to let you know there is a very minor logic error when you do your sensor comparisons. For example, if you run through your code with light value of exactly 850 you'll see that scenario does not match any condition. Simple fix to add an = comparison to one of the other scenarios.

manoellemos4 months ago
Hi, I'm writing a blog post about cool Arduino based projects and your's is going to be there. Do you allow me to use one or two of your pictures in the post? I'm linking the references to the project back to this page.

Thanks in advance!

Manoel Lemos
liseman (author)  manoellemos4 months ago
Hi Manoel,

Feel Free to reuse however you'd like!

diy_bloke5 months ago
great. as regarding the reading of yr moisture sensors, what i have done in a similar case is to measure the resistance of the earth via my spikes in my plant bed when it was moist enough and calculated a voltage from that which told me the reading I was going to get from the arduino. used that as an irrigate or not threshold in my program. Worked well.
Keep in mind that two spikes in the earth, also give off a small voltage that can innfluence yr settings :-)
TXTCLA553 years ago

//establish start time
start_time =;
seconds_elapsed_total = 0;

Wont comply as "DateTime" was not declared in this scope.

Even though i added the file to arduino complier.
aldorr TXTCLA556 months ago
For anyone who's trying to do this and has had the same problem. I followed these steps to solve it:
1. Download the Time library:
Put it in your libraries folder. On my setup, Lubuntu, is in home/#username#/sketchbook/libraries. (You may have to create the folder.)
2. Change the "#include " to "#include " (without quotes)
3. Change 3 instances of "" to "now()" (again no quotes)
Should compile now.
Hope this helps.
i am having the exact same issue. any thoughts????
liseman (author)  jmarnocha3 years ago
please double-check that you can run separate, simpler datetime functions to confirm you have the datetime file in the correct folder. if that doesn't work (or does), let me know!
Lisemsan, how do i do that? I haven't really done much work with my arduino since i bought it and i am not to found of programming...
hey liseman,

From what I can tell, excellent tutorial. I am kind of new to arduino but I really want to try this one out, I figure Im a fast learner.

But the 2nd link on your materials list is broken, or at least doesn't link me to a product that still exists. Just wanted to make sure I got the right diodes. If you could point me in the right direction I'd appreciate it. But then again, I dont even see where you used them, unless I missed something. Thanks again.
I am working on replicating a similar project and have spent most of the day getting the water pump figured out. This is where you need the diodes. I am setting up a drip hydroponic system that turns the pump on and off with a set time interval. What I understand is that when the motor turns off it sends a high voltage shock through the system. I have unfortunaly / naively been using only a 50v diode which was not enough to protect the system from the voltage generated by the 120 volt water pump. I am new to electrical systems. Does anyone know what diode I should be using.
cgosh daley0451 year ago
When you put DC on the wire coil in a relay, solenoid, motor, etc., it creates a magnetic field that pulls the armature or plunger, spins the motor, etc. When your control circuit switches the DC off, the magnetic field that's still in the coil collapses into the coil, turns its energy back into electricity and sends a very brief, reverse-biased, high-voltage pulse back down the wire (reverse EMF, or Electro-Magnetic Field).

The diode must be reverse-biased (positive lead on the negative supply wire, negative lead/band on the positive wire) to short this pulse out. If you don't do this, the reverse EMF can blow up the low-voltage semiconductor that's controlling the solenoid or motor. If you connect the diode "the way you'd expect" it simply shorts the control voltage (very bad). The diode should be as close to the coil as possible for maximum effectiveness. 1N4004 (400 Volts @ 1 amp) diodes are cheap and plentiful, motor controllers are not.

If you're ordering a relay, you may find that you can get one with a built-in diode on the coil. If you're powering your motor or other coil with a mechanical switch (like metal relay contacts) instead of a semiconductor device, you don't need the diode.
Never mind. A 1N4004 diode should be good for 400v.
forsey1 year ago
Here's my effort - it only does the watering side of things, but includes code to provide live monitoring via a web based graph.
You should post this on, It's a community of DIY farming and gardening technologies! is a domain for sale at godaddy. would you mean
LeskoIam1 year ago
I was wandering if someone already tried to calibrate moisture sensors like you proposed? Yes, and did someone use similar system for hydroponics?
I'm just starting to build my own system and but I will probably switch to hydroponics. Really cool idea and implementation!

Im bringing garduino back to life, I want to play with the ethernet shield.

However, Im getting an error, saying 'DateTime' was not declared in this scope.

Would you know how to fix this?

ReagenWard4 years ago
How's it working over time?  Almost everyone tries nails first, then moves to gypsum or the like, and if they want accuracy, they end up with a tensiometer.

Also, DC is known to be a problem for moisture sensors over time - have you considered AC or are you just replacing your probes often?
liseman (author)  ReagenWard4 years ago
Hi ReagenWard,

I'd recommend checking all components of the system every ~month, or if you notice anything odd.  Using galvanized nails seems to help things and, if you really want to play it safer, you can modify the code to only set the pin to the moisture sensors high when you're reading the moisture value.

Hope this helps,
sounds like a good idea. Do you have an idea how to modify the code to achieve this? I am not very experience with arduino yet..

thank you so much!
Have a look here on how to write such a code: if you haven't already found out how to do that
Good advice.  Thanks!
As a matter of fact, I tried gypsum first and then went to bare spikes. Gypsum is a bother and the sensors actually fall apart quite soon. Also they are slow in reacting.

With regard to the DC. I have not seen any problems yet with my spikes that have been in the ground for a year., but what you could do is provide the positive feed to yr spikes from an arduino pin and only switch that on right before you measure and then off again ofcourse
deqwer2 years ago
i built the whole thing up but when i run some test and found out that my moisture sensor seem to be receiving an unstable read .the read runs between 707 and 560 i check the connection is ok,and the soil is basically wet
diy_bloke2 years ago
I have used galvanized nails for some time now and they do well. In order to combat oxydation one could feed them with AC (=getting the voltages from two digital pins that you alternately switch from high to low), but I found it easier to just switch off the voltage to the pins and only switch it on when I am doing a reading.

I have these pins in the ground for a year now and they still look fine. Since winter is coming, I took them out, gave them a quick clean with a brillo. They will go back in the soil in the spring.

If they really look bad, I will just replace them
I get these values, Im concerned that the seconds lit is not changing and hence the achieved is not changing either.

The lights are on however.

Is this normal?

moisture sensor reads 614
light sensor reads 107
temp sensor reads 489
seconds elapsed total = 0.00
seconds lit = 0.00
proportion desired = 0.58
proportion achieved = 0.00
moisture sensor reads 627
light sensor reads 118
temp sensor reads 490
seconds elapsed total = 27.00
seconds lit = 0.00
proportion desired = 0.58
proportion achieved = 0.00
liseman (author)  marcuantonio2 years ago
hi marcuantonio,

do you have a light connected, and is it turning on?
Yes, I do have a light connected. I lowered this value and that gave seems to have helped doing the seconds of light desired and achieved.

//update time, and increment seconds_light if the lights are on
seconds_for_this_cycle = - seconds_elapsed_total;
seconds_elapsed_total = - start_time;
if (light_val > 120)
Hi, I got the kit, and have assembled it. I get some info on the serial monitor, but have not got the lights to turn on. Is there anything you might suspect I am doing wrong?


liseman (author)  marcuantonio2 years ago
hi marcuantoio,

try connecting a different light or other electrical device, and see if that works. if so, the problem's your light. if not, check connections and verify with the serial log that the lights are actually being triggered. have you run the test code? if so, what happens when it says 'turning light on?'
Where is the test code?
I found the test code, sorry about that. I think there is a problem with the pcb, it doesnt fit snuggly on top of the ARduino. When I sandwch them together the red LED turns on.
I have one light attached to the light board, and a light to the water board. Neither is doing anything. I tried them on, on an oulet, connectting the two lead that would go into the board, and they worked fine.

At some point, the board for the light was giving me tiny electroschocks

I changed them and now they are fine

thekatr22 years ago
cool project
dotdash2 years ago
Hi Luke,

Thanks for this fantastic instructable, I'm currently using it as the basis for a system as part of an art installation. It's my first foray into using Arduino, and as you say, it's ambitious but I'm getting there, slowly but surely!

You can see my progress here:

if you're interested.

rmullins2 years ago
I've never done anything with Arduino, what would you recommend in getting started?
liseman (author)  rmullins2 years ago
this is my favorite beginner's guide: . good luck!
Just curious, why galvanized? Why not stainless steel? Is there something in the chemistry that makes this work better?

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!