One of the small assignments used for learning Arduino was the classical "talking plant". Actually was more of a build own humidity sensor, sensor reading and sending the data to the Ethernet shield and also use LED lights to display the status of the soil moisture. 


First step is to build a sensor, very simple! Of course you can buy a humidity sensor, no one says not to do so, but makes more fun to built your own, cheaper and simpler.
After the sensor is build all you have to do is just to read the values and then use 3 LED (red, yellow, green) to visually display the soil moisture and at the same time send the values to the Ethernet shield so you can check the humidity of your precious plant over the internet.
Of course you can get more creative than this once you have the data, but I wasn't in the mood to invest money in more cooler ideas. I kept them for my mood lights.

How to build the soil moisture sensor
Actually this is the simplest part. You can use two nails, two thick wires or basically anything that is allowing electricity to pass. The trick is to pick a material that does not get rusty or oxides to quick, also must have a small electric resistance because we are talking here about very small values ... 5V and less than 1A. 
I used two fine steel nails about 5cm long with a 3mm distance between. The nails were fixed on a plastic base 5mm high (to keep the distance between the nails), you can use any material that is resistant to electricity (does not allow electricity to pass). Having a 5cm nail minus 5mm plastic base I remained with a 4.5cm for each nail as the sensing surface.
Note: the nails must be parallel with each other. 
Soldering a wire on each nail head is the only "hard part" of this sensor.

How it works
You need just to "stick" the sensor in the flower pot (you don't want to damage the roots of your precious plant so be careful where you stick it) connect it to the Arduino board like you will do with any other simple sensor (e.g. photoresistor see how to connect a photoresistor here Speed measurement with Arduino).
Unfortunately I have no drawing for this project but the wiring is not so hard. Actually you can get it only by reading the code.
Next step is to connect the 3 LED lights and then calibrate your sensor (see code). The values will differ from one soil type to the other ( depending on the pH value).
Plug your Ethernet shield, use your network values and have fun! (see in the code where)

The code


#include <SPI.h>
#include <Ethernet.h>

// Ethernet shield attached to pins 10, 11, 12, 13
//analog sensor
int sensorPin = 0;     // 1st sensor is connected to a0
int sensorReading;     // the analog reading from the analog port

//status LEDs
int LEDred =7;               
int LEDyellow =8;   
int LEDgreen =9;

//threshold values - calibrate sensor
int RED = 200;
int GREEN = 500;

//string that holds the status
String Status ="";

//Server part

//define mac address for ethernet shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
//define ip for ethernet shield
byte ip[] = { 192, 168, 1, 2 };           // ip in lan
//gateway - router ip address and mask
byte gateway[] = { 192, 168, 1, 20 };            // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                   //subnet mask

// Initialize the server library and port (port 80 is default for HTTP)
Server server(80);                                      //server port

//byte sampledata=50;

void setup(void) {
  pinMode(LEDred, OUTPUT);  //set LED1 pin to output mode
  pinMode(LEDyellow, OUTPUT);  //set LED2 pin to output mode
  pinMode(LEDgreen, OUTPUT);  //set LED3 pin to output mode

  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);

  //send debugging information via the Serial monitor

void HTTPserv () {
// listen for incoming clients
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c =;
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
    //set background color
          client.print("<body style=background-color:yellow>");
          //send first heading
          client.println("<font color='red'><h1>Soil humidity</font></h1>");
          client.println("<hr />");
          client.println("<hr />"); 
          client.println("<br />");
          client.println("<br />");
    //drawing simple table
          client.println("<font color='black'>Simple table: </font>");
          client.println("<br />");
          client.print("<table border=1><tr><td>Humidity</td>");
          client.println("<br />");
          client.println("<hr />");
    //text variant
          client.print("Humidity ");
          client.print(" = ");
          client.println("<br />");
          client.print("Status ");
          client.print(" = ");
          client.println("<br />");
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
    // give the web browser time to receive the data
    // close the connection:

void loop(void) {

  digitalWrite(LEDred,LOW); //initial state
  digitalWrite(LEDyellow,LOW); //initial state
  digitalWrite(LEDgreen,LOW); //initial state

  sensorReading = analogRead(sensorPin);


  if (sensorReading <= RED) {
   Status = "needs urgent attention";
   HTTPserv () ;
 else if (sensorReading > RED && sensorReading < GREEN ) {
   Status = "needs attention";
   HTTPserv () ;
 else if (sensorReading >= GREEN ) {
   Status = "needs no attention";
 else {
  Status = "";
  HTTPserv () ;