Adventures with Arduino Part 21


I have now built a plant moisture monitor from project 8 in the Arduino project handbook.


I still need to do some finer calibration but it works.

If you have the book, the project is on page 58/59.  The code can be downloaded from

The full code from the book is now on the website for the book. My code is below as it just lights up and LED.

// Soil Moisture Sensor Hygrometer example code
// Code author:  aafent. This code is copy free, if you want please mention the author's name and/or the site
//Interface Description (4-wire)
//VCC: 3.3v-5v
//DO: Digital output interface (0 and 1) threshold taken from potentiometer
//AO: Analog output interface
const int moistureAO = 0;
int AO = 0;
int tmp = 0;
int LED = 13;
void setup (){
  Serial.println("Soil moisture sensor");
  pinMode(moistureAO, INPUT);
void loop ()
  tmp=analogRead( moistureAO );
  if ( tmp != AO ) 
  delay (1000);
if(analogRead(0) > 900){ // depends on soil moisture
digitalWrite(LED, LOW);

This lights up an LED if the sensor reads > 900 (as per code)

There is a trouble shooting guide to the FC-28 which I am using on the Arduino forums