Automatically watering your plants with sensors, a Pi and webhooks

Monitoring beyond the server

By Chris Hannam, Product Engineer at Server Density.
Published on the 19th December, 2013.

Monitoring is the first step to understanding and fixing almost all issues. As a hobby I have been growing my own chillies with varied success; my issue has been remembering to water the poor things. So after countless disappointing harvests, I decided to monitor my chilli plants and automate their care as much as I could by using cheap, off the shelf components. This post will detail my experiments with electronics, APIs and the Server Density monitoring tool.

Chilli Irrigation System

My first step was to set up the technology behind the components, for this I needed a Raspberry Pi and an Arduino board. The Raspberry Pi to connect the Arduino to my network, and the Arduino to add analog inputs to the setup (which the Pi is unable to do). Although there are converters and hacks to give the Pi an analog reading, none of them seemed 100% reliable and I had an Arduino Nano spare.

Server Density don’t currently have a packaged agent for the Raspberry Pi but as it’s Python, you can easily clone the source from Github or download it from Server Density

Once I did that, it was time to have a look at the basic sensors I was able to attach to the Arduino board, that would help to prolong the life and improve the yield of my plants:

  • Temperature – averaged from the humidity and pressure sensors
  • Humidity – detect water vapour level in the air
  • Moisture – two prong sensor embedded into the soil and into the water reservoir
  • Light – light dependent resistor
  • Pressure – barometric air pressure (not directly related to plant health but fun to graph)

When I started I had little experience with electronics and Arduino boards, luckily there are a lot of very simple guides available for using each of the sensors – let me Google that for you. I was able to mount the Arduino directly into the breadboard to make it easier to connect up the sensors. Below is a close up of the board:

Automatic Plant Watering System

Nano Close Up

The Arduino connects to the Raspberry Pi via USB and sends the data back over serial in a JSON string. The cable powers the board and provides a serial link to allow the data to come back from the sensors. A plugin then runs in the Server Density agent which reads the serial device until a complete set of readings is received (or 20 seconds is exceeded) – then the PI’s WiFi dongle allows it report the data back to Server Density for graphing.

Monitoring a Chilli Plant

Full setup:


monitoring chilli plants

Once the basic monitoring was in place and working reliably I added a pump to automatically water my chilli plants. It would draw water from a reservoir, that holds roughly a litre of water. From this point, I wanted the following to happen:

  1. When the soil becomes too dry, the pump is triggered.
  2. Once the water level is too low in the reservoir, I get an email alert from Server Density.
  3. I fill the reservoir back up.

So far this has worked very well despite some early issues with pump performance. The pump is cheap kids kit from Maplin as luckily it fitted the pipes I had.


I purchased some bhut jolokia peppers and removed the seeds to grow my own plants. With a few failed attempts with seeds already, I set out to monitor as much as possible. Using a basic incubator box I added light and temperature sensors inside and out, along with 2 moisture probes in the soil. I also added an LCD panel so I could view the internal settings at a glance.

Basic Environment Monitor

I decided to extend the monitoring to the basic environment my chillies were in. I had a spare temperature and light sensor which I hooked up to a Arduino Nano clone. With minimal code I was able to create a basic set of sensors connected to an old laptop. The laptop has the Server Density agent running and using a plugin reports the output back for graphing. The Nano I used is a Chinese clone from eBay of the Arduino. It needed the headers soldering and the bootloader to be installed, but at £4.50 instead of £20 (ish) for a genuine board, it was worth the effort.

Arduino board

Once the headers were soldered on, I installed the bootloader using this. It didn’t work initially, but after dropping -U flash:w:blink.hex" from the command:

(N.b. Connecting to the board required the latest ftdi drivers for my Mac.)

server density monitoring

PC with light and temperature sensors reporting to Server Density

Again, I started these fairly basic projects with no real background in electronics, and owe a great deal to some of the excellent tutorials available. All of the parts were bought from eBay mostly for less than £2.

Light Dependent Resistor

For light measuring I used a basic LDR connected to the analog input on the Nano. With help of this post I was able to convert the analog 0 to 1024 value into lux. It’s an approximate measurement but close enough for this project.

Pressure Sensor BMP085

The BMP085 is a great little board that contains a pressure sensor and a temperature sensor. It must be connected to the analog pins 4 an 5 on the Nano to work correctly. Adafruit have a great tutorial for setting it up, again a simple case of hooking up power and the signal connections. Using the pressure reading and the temperature it’s possible to calculate your current altitude with your current sea level pressure but that was a bit beyond what I needed.

Soil Moisture Hygrometer

I used a basic sensor, a simple two pronged device that is pushed into soil. This model has an LED on it as well that is either red for dry or green for moist. You can use it either analog or digital mode. I used analog and connected directly to the analog port on the Nano.

Humidity  DHT22

This gives the percentage of water in the air using this guide. It also has a temperate sensor which I average with the temperature from the BMP085.

Sound LM393 Electret Microphone

I am waiting for this to arrive. Noise was the last aspect of the environment I could think of to measure. I am hoping to adapt this to read the decibel level and log it.


The main limiting factor at the moment is the Arduino board needs to be connected to some thing with a network connection. Ideally I would like to build in some wireless protocol so the boards could be placed anywhere. Xbee looks like a valid solution but each transmitter costs twice as much as all the sensors and Nano board combined!

Monitoring soil PH is another sensor I am investigating. I have bought this, a basic soil monitor and am hoping I can take it apart and log the soil PH values.

Thanks for reading. It’s been really fun experimenting with our software outside of the realms of infrastructure – it’s incredible how important and useful monitoring can be and how available the technology is to buy now. It’s also proven to be a rather addictive hobby – so there’s plans to keep on monitoring and I’ll keep you posted on how we get on! In the meantime, what are you monitoring with your server density account that isn’t a website or server?


  • Alex Corley

    Nice.. I did something similar using some of the Seeduino components.

    I’m also a huge fan of JeeLabs & his JeeNodes ( and am still waiting on my Flutter to show up…

    Been doing some solenoid work, so I’m hoping to have automated watering added in with enough safety features that it’s flood-proof.

    • bassdread

      Thanks for the suggestion, that looks perfect. I met the guys behind at a Maker Faire, it’s another good project that combines Arduino and the Pi.

      I just bought a 433mhz transmitter and receiver, pretty basic but should be fine over short distance.

      I have also been looking at solenoids, my intention is to have my garage door open when I return from a bike ride. First I need a decent lock mechanism other than just a padlock on the outside…

  • rclymer

    Very awesome project, I never even thought about sound as an influence. I am building something very similar but with Arduino alone. What is your exact plan on how it is watered? I was thinking, deliver a certain amount of water (for example trigger my 80mL/s pump for 2 seconds to deliver 160mLof water) whenever the soil moisture drops to a certain threshold. To prevent flooding, maybe have few hour delay before it can be re-triggered.

    • Chris Hannam

      I went simple. After it detects it’s dry, the pump runs for 20 seconds then stops, this happens when the Server Density agent runs. The agent runs every minute, so next time it runs if it’s still dry it will run for another 20 seconds and so on, until the sensor decides it’s wet enough or we run out of water. The idea of a flood prevention is a great idea, I hadn’t considered flooding past not putting too much water in the pump reservoir.

      I have really struggled to find a decent pump, the one you see in article was a kids project one from the local electronics shop. It has the advantage of running off two AAs and fits the irrigation system I bought from eBay also having a low throughput.

  • Vasile Iulian

    Cool. I must replicate this project.

  • Vasile Iulian

    Regarding the connection, I use a wireless USB card on my Pi

  • Yashendra Shukla

    Any way to combine multiple sensors to use their average to gauge when to water? I have a central motor for 6 rows of plants and wanted to use one Arduino-Pi setup for each group of 6…

  • Misiu

    Hi Chris,
    I know this is bit old article, but I just found it and it looks interesting. I just bought arduino and was thinking about ploting some sensor data. I don’t have Raspberry so I’d like to ask if it would be possible to do something similar with only Arduino? I plan to buy ethernet shield, so maybe this can be done? Someone did similar configuration?