Gardenboss.org is reader-supported. That means as an Amazon Associate we may earn a small commission from qualifying purchases (at absolutely no extra cost to you).

If you love gardening but don’t have much time or money to spend on it, you might be interested in building a smart garden system that can automate some of the tasks and monitor the conditions of your plants.

Believe it or not… it’s not that hard…

Read on below – I will show you how to build a simple and affordable smart garden system using some basic components and a Raspberry Pi.

What You Will Need

To build this smart garden system, you will need the following items:

  1. A Raspberry Pi (any model will do, but I recommend the Pi Zero W for its low cost and wireless connectivity)
  2. A microSD card with Raspbian OS installed
  3. A power supply for the Raspberry Pi
  4. A breadboard and some jumper wires
  5. A soil moisture sensor (you can find one online for less than $5)
  6. A water pump (you can use a small aquarium pump or a submersible pump)
  7. A relay module (to control the power of the pump)
  8. A water reservoir (a plastic bottle or a bucket will do)
  9. Some tubing and connectors (to connect the pump to the reservoir and the plants)
  10. Some plants and pots (choose plants that are suitable for your climate and location)

How to Build It

The basic idea of this smart garden system is to use the soil moisture sensor to measure the water level in the soil of your plants and use the Raspberry Pi to control the water pump based on a threshold value.

When the soil is too dry, the Raspberry Pi will turn on the pump and water the plants until the soil is moist enough. When the soil is wet enough, the Raspberry Pi will turn off the pump and save water.

To build this smart garden system, follow these steps:

Connect Moisture Sensor with Breadboard and Jumper Wires

Connect the soil moisture sensor to the Raspberry Pi using the breadboard and jumper wires. Connect one pin of the sensor to a 3.3V pin on the Pi, another pin to a ground pin, and the third pin to GPIO pin 17 (you can use any GPIO pin you like, but make sure to change it in the code later).

Connect Relay Module with Breadboard, and Jumper Wires

Connect the relay module to the Raspberry Pi using the breadboard and jumper wires. Connect one pin of the module to a 5V pin on the Pi, another pin to a ground pin, and the third pin to GPIO pin 27 (again, you can use any GPIO pin you like, but make sure to change it in the code later).

Connect the Water Pump to the Relay Module with Wires

Connect the water pump to the relay module using some wires. Connect one wire of the pump to one terminal of the relay module, and another wire of the pump to a positive terminal of your power supply. Connect a negative terminal of your power supply to another terminal of the relay module. Make sure that your power supply has enough voltage and current to drive your pump.

Connect the Water Pump and Water Reservoir with Tubing

Connect one end of your tubing to your water reservoir and another end to your water pump. Make sure that there are no leaks in your tubing or connectors.

Add Watering Tube to Water Pump

Cut another piece of tubing and connect it to your water pump. This will be your watering tube that will deliver water to your plants. You can either split this tube into multiple branches for each plant or use one tube for all plants and move it around manually.

Set up Grow Sites for Your Plants

Place your plants in pots with drainage holes and fill them with potting soil. Insert your soil moisture sensor into one of your pots, making sure that it touches the soil well.

Connect Your Controller Near the Plants and Power it Up

Place your Raspberry Pi near your plants and connect it to your power supply. You can also connect it to a monitor, keyboard, and mouse if you want to access it directly or use SSH or VNC if you want to access it remotely.

Create Your Own DIY Python Code (or whatever coding language you prefer)

Write some code for your Raspberry Pi that will read the value from your soil moisture sensor and control your water pump accordingly. You can use any programming language you like, but I recommend using Python for its simplicity and ease of use. Here is an example code that you can use or modify:

Example DIY Python Code For Your Smart Garden

Here’s a DIY python code you can use to build your own smart garden from scratch with Raspberry Pi. However, you may use any type of code you wish – but, we highly suggest python!

python

#Import the libraries

import RPi.GPIO as GPIO
import time
import requests

#Set the GPIO mode

GPIO.setmode(GPIO.BCM)

#Define the pins for the soil moisture sensor, water pump and LED

sensor_pin = 21
pump_pin = 20
led_pin = 16

#Set the sensor pin as input and the pump and LED pins as output

GPIO.setup(sensor_pin, GPIO.IN)
GPIO.setup(pump_pin, GPIO.OUT)
GPIO.setup(led_pin, GPIO.OUT)

#Define a function to check the soil moisture level and water the plant if needed

def water_plant():
# Read the sensor value
sensor_value = GPIO.input(sensor_pin)
# If the sensor value is 1, it means the soil is dry
if sensor_value == 1:
# Turn on the LED to indicate watering
GPIO.output(led_pin, GPIO.HIGH)
# Turn on the pump to water the plant for 5 seconds
GPIO.output(pump_pin, GPIO.HIGH)
time.sleep(5)
# Turn off the pump and LED
GPIO.output(pump_pin, GPIO.LOW)
GPIO.output(led_pin, GPIO.LOW)
# Send a notification to your phone using IFTTT

requests.post(“https://maker.ifttt.com/trigger/water_plant/with/key/your_key_here”)
# If the sensor value is 0, it means the soil is moist
else:
# Turn off the LED to indicate no watering
GPIO.output(led_pin, GPIO.LOW)

#Run the function every hour in a loop while True:

water_plant()
time.sleep(3600)

#Clean up the GPIO pins when exiting the program

GPIO.cleanup()

Note: All sections of the above code that read “#word” should be updated to # word, in your device – in other words, insert a space between the # and the next word)

Tips

here are some tips and FAQs for building a smart garden system on a budget:

  1. Start small: Consider starting with just one or two smart products, such as a smart irrigation system or a smart plant sensor, and then gradually add more as you can afford them.
  2. Look for sales and discounts: Keep an eye out for sales, discounts, and coupon codes for smart gardening products.
  3. DIY: Consider building your own smart gardening system using inexpensive components like a Raspberry Pi or Arduino board and open-source software.
  4. Choose cost-effective products: Look for smart gardening products that are designed to be affordable, such as simple plant sensors or smart plugs that can control your existing devices.
  5. Prioritize: Identify the aspects of gardening that are most important to you and focus on automating those first.

FAQs

Do I need to be tech-savvy to build a smart garden system on a budget?

No, you don’t need to be tech-savvy to build a smart garden system on a budget. There are many resources available online that can help you learn about smart gardening and how to build your own system.

What are some affordable smart gardening products?

Some affordable smart gardening products include simple plant sensors, smart irrigation controllers, and smart plugs that can control your existing devices.

Can I use my existing gardening equipment with smart gardening products?

Yes, many smart gardening products are designed to work with existing gardening equipment. For example, a smart irrigation controller can be used with your existing sprinkler system.

Is it possible to build a smart garden system using open-source software?

Yes, there are many open-source software options available for building a smart garden system, such as OpenSprinkler or MySensors.

How much money can I save by building a smart garden system on a budget?

The amount of money you can save by learning how to build a smart garden system on a budget will depend on the products you choose and how you use them. However, in general, smart gardening can help you save money by reducing water usage, fertilizer usage, and energy costs. Additionally, it can help you avoid costly plant diseases and pests by detecting and preventing them early on.

Amazon and the Amazon logo are trademarks of Amazon.com, Inc, or its affiliates.