Gardenbot — an IoT device to monitor my garden

Building a basic IoT device is simple and definitely fun. It started with the thought how can I better understand my balcony garden through data.

This blog is the first in a series of articles I plan to write on how I went about building this device, the learning, the experiments and discoveries along the way.

The big ideas and possibilities:

  • Measure temperature, humidity
  • Detect ambient light
  • Track soil moisture and water automatically
  • Motion detection, capture images & video
  • Image recognition and machine learning
  • Communicate with the world

Components used

The first version

After a few iterations, I zeroed on the first version of bot which went live in the 3rd week of October. The capabilities included

  • Periodically track temperature & humidity
  • Track the moisture in a single plant
  • Tweet the data out every hour and attach an image if there is enough light
  • Visualise them in a portal

How it works

The gardenbot is built on Raspberry Pi 3 running om Raspbian, the recommended operating system. I’ve been playing around with several sensors modules for measuring the environment.

One of the limiting factors of the Raspberry Pi is the ability to handle analog inputs. I’ve been using an Arduino Uno for consuming the analog data from some sensors and read them serially on the Raspberry Pi.

The data recorded from these sensors is initially stored in the device itself as csv or text files and periodically transferred to a remote machine via SSH.

Finally, I hooked up an old webcam via USB and using tweepy, send out tweets periodically.

Almost all the code is written in Python with the exception the code on the Arduino.

A few experiments

During this period, I tried out a few experiments which showed potential to be included in the future

  • Detect moisture and automatically turn on a water pump
  • Measure the water storage level using an ultrasonic sensor
  • Measuring the intensity of light

Some upcoming experiments include

  • Motion detection & image recognition to identify when our friends (birds) visit
  • Track moisture levels more accurately and across plants
  • Sound detection

Insights from the data collected

Though there are several thousand rows of data, not much insights can be drawn from them at this point. The two basic insights I’ve drawn so far is how the average humidity and temperature has changed over the last 4 months.

Originally published at on February 25, 2018.