Clover’s Greenhouse Part 1: Soil Moisture Sensor

Hello Everyone!

My name is Clover and I am in love with vascular plants and robots.


This summer I wanted to combine my two loves of plant science and engineering. Thus I am constructing my very own greenhouse in my backyard. I am an undergrad, and as any former student knows, this means I move around constantly, and I am not always around to take care of my vegetable garden. I love my plants but since I am moving back to school in July, and my family is unreliable, I need a way to make sure that they are taken care of. Enter Arduino!

We tested our moisture sensor in this cute mug!

I have been a fan of Revolt Lab since it’s conception and am lucky enough to be able to work with the wonderful Will. Together we are constructing an automated watering system. This includes sensors that will turn the system on only when needed. This is essential when the ever-changing New England weather demands some intelligence in watering patterns.

This project will also grow to include temperature sensors and the construction of a small-scale greenhouse that will hopefully keep my plants warm and happy through the cool fall. I want to document this project on Revolt Lab so that anyone who is also in love with vascular (or nonvascular) plants can join me and we can nerd out together! I am using wonderful articles from MAKE and Instructables as very helpful templates. Also, I have never used an Arduino system on my own before so I am sure my efforts will be entertaining as I learn to figure that out. Already the Instructables, MAKE, and Ladyada blogs have been ridiculously helpful so, worry not biology nerds, you too can show the engineers just how awesome we are!


Yesterday we completed the first step of setting up the moisture sensors. I first learned how to solder and then we proceeded to solder a wire to each of two galvanized nails purchased at home depot. This took a couple of tries but the secret is to scrape off some of the galvanized coating from where you want to solder with a knife. This helps the solder stick to the nail.

Next we hooked the nails up to the breadboard and the breadboard to the arduino. We followed the instructions from the make project verbatim when it came to wiring the nails to the breadboard. Look at this diagram! Then we programmed using the code below. We just had to delete the other sensory input stuff we don’t need right now, such as light and temperature. It worked really well which was awesome. We connected the nails to analogue input 0 and used the pin 13 LED as an output.

Finally, we tested the nails using dry, perfect, and water saturated soils. You will want to calibrate your soils to your own watering habits and garden needs. We found that in our system a return value of under 400 was dry and over 550 was too wet. These numbers are completely dependent on your own nail specs though.

Then we were joyful and celebrated.

(working draft of) CODE!!;

int moistureSensor = 0;
int moisture_val;

void setup() {
Serial.begin(9600); //open serial port
pinMode (13, OUTPUT);

void loop() {
moisture_val = analogRead(moistureSensor); // read the value from the moisture-sensing probes
Serial.print("moisture sensor reads ");
Serial.println( moisture_val );
if (moisture_val < 400)
{digitalWrite (13, HIGH); //soil is too dry- turn on LED since we don't have the pump connected yet
if (moisture_val > 550)
{ digitalWrite (13, LOW); // soil is saturated- turn off LED



Filed under Uncategorized

2 responses to “Clover’s Greenhouse Part 1: Soil Moisture Sensor

  1. charlie oconnell

    Did you ever complete this project? I am interested in soil moisture.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s