Indoor gardening is a great hobby, particularly during the wintertime when outdoor conditions are frigid, and we’re spending plenty of time indoors. It also can be a useful way to inexpensively prepare plants for the Spring, as a package of seeds are a fraction of the cost of a tray of plants. Plants give off oxygen, and help clean the air, so there’s limited downside to creating an indoor garden – but how to get started?
This project builds a 21st century garden that enables tools for scientific growing as well as sharing the greenery with the world by sharing your garden via the internet. The sensors are built from a Raspberry Pi, and the monitoring and analysis is done using Amazon Web Services (AWS). Communication is done using API’s starting from your home wireless network, then out to the Internet and into AWS and Twitter.
Here’s a brief overview of the different layers of technology, and the narrative below will describe how to build each layer with step-by-step instructions. Please note, I’ve included all of the software written to build this in a single GitHub repo.
Within the repo there are four folders, and in each section is called out which folder is being used.
Part 1 – Build an Internet Connected Sensor
To collect information about the garden, we’re going to be using sensors that can collect critical data about growing conditions. For this project, I recommend a DHT22 humidity and temperature sensor running on a Raspberry Pi.
Section 1 – Selecting Raspberry Pi Equipment
The sensors will be driven by a Raspberry Pi, and either the original or series 2 models will work. If you are purchasing one, I would suggest the series 2 as having the extra USB ports is very useful. You will also need a wireless adapter that can connect to your home WiFi network.
Section 2 – Collecting Humidity and Temperature
Understanding what the temperature and humidity is for the growing environment is critical, particularly in wintertime. During the growing (light) cycle, temperatures for many plants need to resemble a nice Spring or Summer day, so you’re aiming for at least 75F (23C) temperatures. The inside of your home also can be quite dry during the winter, so your plants may dry out quickly. Monitoring the humidity of the air provides good indicators when the soil itself is dry, so is very useful information.
Step 1 – Connect the Sensor to the Raspberry Pi
I purchased a DHT22 sensor which is readily available from several retailers. The circuit diagram is also on this page, and below is a photo of the completed circuit running on a 30 row breadboard.
For the sensor to be used, you’ll need to install the C libraries that translate the basic signal data into usable temperature and relative humidity readings.
Installation instructions can be found on the associated GitHub page.
Step 3 – Build the Sensor App
SI’ve already written an app that uses, so you can clone the repo from this location onto your Raspberry Pi. There is additional documentation in the repo that can assist you along the way.
There are two programs needed for this sensor in the repo, stream.sh and simpletest.py. Both are located in the /sensor folder of the repo.
To start collecting the data, run the script on the Raspberry Pi, executing the bash script that will continuously execute the python program. Here is the command to enter to start the script and then run in a headless mode.
$ bash stream.sh & exit
This will record the data from the sensor every 20 seconds (driven by a sleep parameter in the script). Data is saved locally on the Pi, and in the next part I’ll explain how to configure this to also do HTTP calls to push the data out to the internet.
Part 2 – Configure a Camera to Capture Images
I like to be able to see how the plants are growing, and record the physical growth of the plants. This can be done quite easily with the Pi by acquiring a camera that can be connected to one of the serial ports.
For more detail: Simple Gardening Service : Manage Indoor Gardens using IoT