The Garduino Garden Controller
Read this article in MAKE:
18: ReMake America, Page 90.
To get MAKE, subscribe or purchase single volumes.
Geeked-out gardening: use a microcontroller and simple sensors to give plants exactly the water and light they need.
By Luke Iseman
Photos by Michael T. Carter, Luke Iseman, Ed Troxell
Illustrations by Gerry Arrington, Timmy Kucynda
Most Recent Run-Time Code (updated May 2, 2009)
//include the datetime library, so our garduino can keep track of how long the lights are on #include//define analog inputs to which we have connected our sensors int moistureSensor = 0; int lightSensor = 1; int tempSensor = 2; //define digital outputs to which we have connecte our relays (water and light) and LED (temperature) int waterPump = 7; int lightSwitch = 8; int tempLed = 2; //define variables to store moisture, light, and temperature values int moisture_val; int light_val; int temp_val; //decide how many hours of light your plants should get daily float hours_light_daily_desired = 14; //calculate desired hours of light total and supplemental daily based on above values float proportion_to_light = hours_light_daily_desired / 24; float seconds_light = 0; float proportion_lit; //setup a variable to store seconds since arduino switched on float start_time; float seconds_elapsed; float seconds_elapsed_total; float seconds_for_this_cycle; void setup() { //open serial port Serial.begin(9600); //set the water, light, and temperature pins as outputs that are turned off pinMode (waterPump, OUTPUT); pinMode (lightSwitch, OUTPUT); pinMode (tempLed, OUTPUT); digitalWrite (waterPump, LOW); digitalWrite (lightSwitch, LOW); digitalWrite (tempLed, LOW); //establish start time start_time = DateTime.now(); seconds_elapsed_total = 0; } void loop() { // read the value from the moisture-sensing probes, print it to screen, and wait a second moisture_val = analogRead(moistureSensor); Serial.print("moisture sensor reads "); Serial.println( moisture_val ); delay(1000); // read the value from the photosensor, print it to screen, and wait a second light_val = analogRead(lightSensor); Serial.print("light sensor reads "); Serial.println( light_val ); delay(1000); // read the value from the temperature sensor, print it to screen, and wait a second temp_val = analogRead(tempSensor); Serial.print("temp sensor reads "); Serial.println( temp_val ); delay(1000); Serial.print("seconds total = "); Serial.println( seconds_elapsed_total ); delay(1000); Serial.print("seconds lit = "); Serial.println( seconds_light); delay(1000); Serial.print("proportion desired = "); Serial.println( proportion_to_light); delay(1000); Serial.print("proportion achieved = "); Serial.println( proportion_lit); delay(1000); //turn water on when soil is dry, and delay until soil is wet if (moisture_val < 850) { digitalWrite(waterPump, HIGH); } while (moisture_val < 850) { delay(10000); } digitalWrite(waterPump, LOW); //update time, and increment seconds_light if the lights are on seconds_for_this_cycle = DateTime.now() - seconds_elapsed_total; seconds_elapsed_total = DateTime.now() - start_time; if (light_val > 900) { seconds_light = seconds_light + seconds_for_this_cycle; } //cloudy days that get sunny again: turn lights back off if light_val exceeds 900. this works b/c the supplemental lights aren't as bright as the sun:) if (light_val > 900) { digitalWrite (lightSwitch, LOW); } //turn off lights if proportion_lit>proportion_to_light, and then wait 5 minutes if (proportion_lit > proportion_to_light) { digitalWrite (lightSwitch, LOW); delay (300000); } //figure out what proportion of time lights have been on proportion_lit = seconds_light/seconds_elapsed_total; //turn lights on if light_val is less than 900 and plants have light for less than desired proportion of time, then wait 10 seconds if (light_val < 900 and proportion_lit < proportion_to_light) { digitalWrite(lightSwitch, HIGH); delay(10000); } //turn on temp alarm light if temp_val is less than 850 (approximately 50 degrees Fahrenheit) if (temp_val < 850) { digitalWrite(tempLed, HIGH); } }
Links
- Arduino Duemilanove
- ProtoShield (Circuit Board for Arduino)
- Omron Relays
- 1N4004 Diode
- 220 resistor (sold in bags of 100, or just buy a few at RadioShack)
- LED (or try RadioShack)
- Photocell
- 10k thermistor
- 22-gauge solid-core wire (100' roll, or buy assorted colors at RadioShack)
- 10k resistors (sold in bags of 100, or just buy a few at RadioShack)
- Parts list
- Mikey Sklars version of a grow light made from red and blue LEDs
- Arduino development application
- Arduino Tutorial
- Harbor Freight
- Jameco
- Maker Shed
Make: Noise — Discuss this article
You must be logged in to post a talkback.[ Display full threads] [ Oldest First]
Showing messages 1 through 9 of 9.
- my flourecent light won't turn on!!
You must be logged in to reply.
i am trying this system as a component for a science fair project (testing if a plant would grow better in a human controlled garden vs. an arduino powered one) I am using an array of springs as my circuit board, i wired every thing correctly, but when i test my control over my florescent light, it doesn't turn on! i need to start working soon and am running out of ideas.Posted by circuit dude on November 08, 2009 at 15:01:55 Pacific Time
- Aquaponics
You must be logged in to reply.
Hi,
Anyone tried to use the garduino as part of a hydroponics system. I am contemplating doing this and would appreciate any advice.
ThanksPosted by RonanOD on October 24, 2009 at 16:25:40 Pacific Time
- "First green"!
You must be logged in to reply.
Here is a link to my "build diary" on YT:
http://www.youtube.com/watch?v=PjwHKSD9ww8
This is the more interesting second entry. I've got basil shoots!Posted by morrildl on July 30, 2009 at 20:15:10 Pacific Time
- Earthbox?
You must be logged in to reply.
Anyone tried this with an Earthbox? It seems like it might be just as easy to keep the Earthbox full, as the feeder bucket. And then you can make do with only the photodiode and grow-light relay...Posted by morrildl on June 29, 2009 at 21:44:09 Pacific Time
- Nails
You must be logged in to reply.
how far apart are people putting their nails to get the correct resistance?Posted by esqueleto on June 20, 2009 at 11:37:10 Pacific Time
- I think the wiring diagrams are wrong
You must be logged in to reply.
Step 3 (Page 95) has the two left-most columns on the breadboard connected to 5V and GND. Steps 5 and later have them connected to GND and VIN.
I haven't actually tried the circuit yet, but I the the setup in Step 3 is the correct one; looks like the later ones are an error, since they differ from Step 3 and also seem to differ from what the text is telling you to connect.Posted by morrildl on June 14, 2009 at 14:42:55 Pacific Time
- Light problem
You must be logged in to reply.
Any idea why my lights would turn on during a digitalwWrite(light, LOW);??And then turn off with a HIGH? I have changed the Relay pins, and not sure what is going on. Ideas? Thanks.Posted by mtnbiker on June 11, 2009 at 21:16:09 Pacific Time
- DateTime Library
You must be logged in to reply.
You need to download the DateTime library and extract the contents of the zip file into the hardware\libraries folder, then use
#include <DateTime.h>Posted by mtnbiker on June 11, 2009 at 21:01:27 Pacific Time
- relay pins
You must be logged in to reply.
page 99 the relay pins are mixed upPosted by xboogerx on May 26, 2009 at 19:00:51 Pacific Time
|
Showing messages 1 through 9 of 9. |
Join the conversation -- every MAKE article has an online page that includes a place for discussion. We've made these RSS and Atom feeds to help you watch the discussions: subscribe.
Explore More in Make Magazine
Search the pages of MAKE
Raves for MAKE!
“Now we've got geek DIY (do it yourself) porn. Just as would-be Emerils pore over lushly illustrated cookbooks with recipes involving hard-to-find morels and complicated instructions for roux, Tom Swift wanna-bes are devouring MAKE.”
— Steven Levy, Newsweek
“...O'Reilly Media recently launched what has already become the bible of this new movement, a magazine called MAKE.”
— Daniel Roth, FORTUNE
“If you're the type who views the warnings not to pry open your computer as more a challenge than admonition, MAKE is for you.”
— Rolling Stone
“One of the most innovative magazines I've seen in a long time.”
— Steve Riggio, CEO Barnes & Noble
“The kind of magazine that would impress MacGyver”
— Marcus Chan, San Francisco Chronicle





