Green-iRaspberry Pi

GardenPi: Garden Care with Raspberry Pi

Like any good “lazy programmer,” I’m always looking for ways to automate. This spring’s project: monitoring Garden Care and watering my garden. I had a wifi-enabled Raspberry Pi laying around and decided to put it to good use. For this project I wanted to do better than just a glorified timer. The goal: An automated watering system that can use the weather forecast, soil, light, and temperature sensors to keep my garden looking great all summer.

Garden Care with Raspberry Pi 1

Phase 1: Timer and Forecast-Based Watering

I’ve written a simple script that wakes up at 10PM, determines the likelihood of rain, and waters accordingly. The script looks up the forecast using the API. If there is less than a 50% chance of rain, the GardenPi will water for a short duration.

Future phases (already underway) will include sensors for temperature, soil moisture, light, and humidity. Based on that information, the GardenPi will be able to make better watering decisions. The sensor data could be made available via an onboard website or mobile application. Better sensors, form factor, time lapse, and user interface are all things that I’ll be looking at for future versions.

I’ve learned a lot in the last few weeks from building this project — a little bit more about basic electronics, how to solder, how to draw up schematics, and the joy of building actual gizmos that serve a purpose. I’ve also learned that I’m not the only one doing this kind of project with the Raspberry Pi; I’ve included links to other projects at the end of this post.

Required Parts (approx. cost ~$85)

  • Raspberry Pi
  • USB Wifi Dongle
  • SD Card
  • Soaker / Drip hose throughout the garden
  • Solenoid for turning on the soaker hose
  • A female hose swivel adapter to connect your garden hose to the solenoid
  • Relay for switching 12V power
  • 12V / Raspberry Pi power supplies
  • Assorted electronics (breadboard, resistors, wires, LED)
  • High tech weather resistant case (aka medium sized Tupperware container)


  1. Install Raspbian and configure WiFi access.
  2. Install Ruby for root user.
  3. Run gem install god.
  4. Pull the garden_pi_waterer repository and bundle install to install dependencies.
  5. Modify the parameters ( API key, timing info, etc.) inenvironment.rb.
  6. Build out breakout board (see schematic below).
  7. Connect the solenoid between water source and soaker hose, taking note of the directional arrow on the solenoid and using the adapter to connect the male end of your garden hose to the input on the solenoid.
  8. Power up the Pi and your 12V power supply.
  9. Install install/init.d to /etc/init.d/god and follow instructions in that file
  10. Install god.conf to /home/pi
  11. Restart and enjoy.


I’ve watered my garden with a Raspberry Pi. Success. There is a lot of room for improvement, and I’m looking forward to extending the GardenPi’s capabilities.



Source: GardenPi: Garden Care with Raspberry Pi


Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button