Homy and plants

After having all the light bulbs in the house under control, I couldn’t resist electrifying the rest of the household 🙂 I spent couple of days looking around the house, and finally found the next “thing” to experiment with. Couple of months ago my wife and me got a Dracaena tree. Since we had no experience in nursing the plants, we had some doubts about when and how often to water it. I decided to solve this problem in geeky engineering way.

After some online investigation on how to measure a “water level” for the plant, I came across some nice articles: How to make a cheap soil moisture sensor?Gypsum Blocks / Electrical ResistanceMoisture Sensor Prototype, … It was clear I would need to build a gypsum sensors myself, since it was cheaper and more fun. After quick visit to the nearby hobby shop, all necessary tools and materials were at the table: nails, gypsum, thick paper…

The first step was to create a mold for the sensors. The best candidate for this was a core of the toilet paper role:

Mold preparaton
Mold preparaton

The next step was to prepare a inner part of the sensors: two electrodes (galvanized nails). The inner part had to be fixed in order to keep the symmetry of the sensor after casting is done:

Sensor electrodes
Sensor electrodes

After this prepared; only thing left was creating the mixture of gypsum and water that was going to be poured into the molds:

Ready for casting
Ready for casting

After the casting, it took approximately 24h for gypsum to be completely dry. After removing the mold and fine cleaning I got the final product.

Soil moisture tension sensors
Soil moisture tension sensors
Sensors - Final look
Sensors - Final look

The way a gypsum sensor measures the “water level” in the plant pot is that it changes its electric resistance based on the soil moisture tension of the ground. Measuring the resistance of the sensor, indirectly, the soil moisture tension can be measured.

The next step in this process was testing and calibration of sensors. First, they were soaked wet, and then read outs of resistance was performed in the course of the next 12 hours.

Calibration
Calibration

Existing firmware on the JeeNode was slightly updated so it could support reading of analog sensor values. To enable this, one function has been added:

float getMoisture(long sensorId)
{
  float m;
  int d1, d2, a1, a2;

  switch(sensorId)
  {
    case 1:
      d1 = 4; d2 = 5;
      a1 = 0; a2 = 1;
      break;
    case 2:
      d1 = 6; d2 = 7;
      a1 = 2; a2 = 3;
      break;
    case 3:
      d1 = 3; d2 = 8;
      a1 = 4; a2 = 5;
      break;
  }

  long v = 0;

  for (int i=0; i<4;i++)
  {
    digitalWrite(d1, HIGH);
    digitalWrite(d2, LOW);
    delay(100);
    for (int j=0;j<4;j++)
    {
      float v1 = analogRead(a1);
      delay(10);
      float v2 = analogRead(a2);
      delay(10);
      v += abs(v1-v2);
    }
    d1 = d1 ^ d2;
    d2 = d1 ^ d2;
    d1 = d1 ^ d2;
  }
  digitalWrite(d1, LOW);
  digitalWrite(d2, LOW);

  m = floor(v / 16.368  + 0.500) / 1000;
  return m;
}

After the sensors were finally ready, next step was to re-plant the plant(s) into the new pots, and to install the sensors into the root of the plants. Installing the sensors into root should result into more accurate readings.

Mounting - Preparation
Mounting - Preparation

I took my pink plant shovel (present from my wife 🙂 ) and got my hands dirty:

Mounting - Ready for soil
Mounting - Ready for soil

After connecting all the wires back to JeeNode on the home computer and final cleanup of the place, plants were finally connected to our little home automation system.

Final look - Plants
Final look - Plants

The next part of the project was more software then hardware, but still not less interesting. Existing control software has been updated; a background process is created that reads moisture every 15 minutes. Also possibility of tracking watering events has been added:

Homy Control - Plants
Homy Control - Plants

Acquired data is saved into the database. Based on this data, it would be possible to graphically visualize the moisture level, to detect need for watering and to analyze the best watering strategy.

Since the iPhone interface for lights managements already existed, I decided to put a plant’s part as well. Interface was optimized both for iPhone and iPad display:

Homy - iPad - Plants
Homy - iPad - Plants

At this point I thought my job had been done, but then my wife came with cool idea: Let’s put the plant online! Ok, why not? After couple of hours of coding, using freely available Facebook API, our plant were able to post the status and to answer to some questions on the wall.

Dracaena - facebook
Dracaena - Facebook

Finally, I found a way how to talk to the plants, plants got possibility to express themselves, and my wife got new Facebook friend.

© 2010, Quo Vadis ?. All rights reserved.

4,396 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.