Soil Moisture Monitor

Soil Moisture Monitor

Category: Water
Communication: None
Components: Internal
Created By: Gouri Lekshminarayanan
Difficulty Level: Beginner
Input Sensor:
Microcontroller: Arduino UNO
Output Device:,
Status: Complete


Refer to the first booklet Discover in the Solve Ninja Techno Kit for information on the components available with the Solve Ninja Techno Kit.

Things you need


Questions you need to ask

Get data. Examples:

  • How can soil hydration be measured?
  • What are the acceptable ranges/values of soil hydration?
  • On what factors does the soil hydration depend? Is it different for each season, type of plants, etc.?

What are the things you need to learn about the user? Examples:

  • Who is the user?
  • How familiar is the user with gardening or farming?
  • Can the user read and/or understand the implication of the hydration level displayed?
  • How far is the toilet from the user, the plants, the irrigation source?
  • How many times a day or week or month would they normally irrigate the soil?
  • Does the user recognise soil dehydration or over-hydration as a problem?
  • What is stopping the user from recognising the problem and taking action? What are the main pain points of watering the soil?

What are the things you need to think about to implement the solution and solve the problem? Examples:

  • Why is it a problem?
  • Is the objective of the solution to only test hydration level of the soil, or is it to get the user to take active measures to keep the soil hydrated?
  • Does the user have access to adequate water to water the plant?
  • Where should the hydration meter and moisture sensor be placed in order to measure hydration level of the soil?

This will help the Solve Ninja decide what output device to use, for example-

  • buzzer with a loud beeeep or a gentle music (like a water filter) if the user has to be alerted when the soil is too dry or too moist.
  • multicolour LED that blinks red when soil hydration is low, or green when the soil is adequately moist or hydrated.
  • LCD screen that displays some encouraging message, or hydration level of the soil.

Refer to the second booklet Investigate in the Solve Ninja Techno Kit for information on which Input sensors and Output devices to use.


Refer to the third booklet Solve in the Solve Ninja Techno Kit for information on making connections and Arduino IDE.


  1. Take the Solution Box from the Solve Ninja Techno Kit.
  2. Connect the 4 pin wire connector to the PCB in the port named “Moisture Sensor”.
  3. Connect the moisture sensor (comparator) to the 4 pin wire connector.
  4. Connect the moisture sensor (comparator) to the electrodes using 2 pin wire connector.
  5. Connect one end of the USB cable to Arduino and other to Computer/laptop.
  6. Plug in one end of the power adapter to the DC jack, and the other end to a power socket.

You will need 9V-1A power supply for using this kit. It will not work with the USB cable alone.

  1. Switch on the Solution Box.

  2. Open Arduino IDE on computer/laptop.

  3. Download, Copy, Paste code from here to the Arduino IDE.

  • Click here for the code.

    /* Prototype Name : Soil Moisture Monitor
       Input Sensor   : Moisture sensor
       Output Device  : Buzzer, Multicolor LED
       Libraries Used : LiquidCrystalPCF584 ,FastLED to turn off from use
    #include <LiquidCrystal_PCF8574.h> //
    LiquidCrystal_PCF8574 lcd(0x3F); // Check the sticker on the LCD to know the address
    #include <FastLED.h> //
    #define DATA_PIN 9// Digital pin number for LED (NeoPixel)
    #define NUM_LEDS 3
    CRGB leds[NUM_LEDS];
    int soil_pin = 0;
    int buzzer = 8;
    void setup() {
      // initialize serial communication at 9600 bits per second:
      pinMode( buzzer, OUTPUT);
      lcd.begin(16, 2);
      lcd.print("Soil Moisture");
      FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
      pinMode(4, OUTPUT);
    // the loop routine runs over and over again forever:
    void loop() {
      leds[0] = CRGB::Black;;
      // read the input on analog pin 0:
      int sensorValue = analogRead(soil_pin);
      // print out the value you read:
      lcd.setCursor(0, 0);
      delay(1000);        // delay in between reads for stability
      if (sensorValue > 0 && sensorValue < 420)
        digitalWrite(buzzer, LOW);
        //delay(000); // Beeps if its Salt water.
        lcd.setCursor(0, 1);
        lcd.print("Plant is Watered");
        leds[0] = CRGB::Green;;
        digitalWrite(4, HIGH);
      if (sensorValue >= 421 && sensorValue <= 1023) {
        digitalWrite(buzzer, HIGH);
        lcd.setCursor(0, 1);
        lcd.print("Water the Plant");
        leds[0] = CRGB::Red;;
        digitalWrite(4, LOW);
  1. Then Check for Tools→ Board→ Port in the IDE.

  2. Compile and Upload the code.

  3. Disconnect USB cable.

  4. Switch off the Solution Box.

  5. Switch on the Solution Box.

  6. Test by dipping the moisture sensor (electrode) in a sample of adequately moist soil of a living plant. If the LCD screen output is “Plant is watered”, the prototype is working. Also, take a sample of dry soil. If the LCD screen output is “Water the plant”, the prototype is working.

  7. Hang the Solution Box on the wall at a suitable distance from the plant and soil. To check if the distance is suitable,

  • Make sure that the moisture sensor comes into adequate contact with soil.
  • Make sure that the wires and the SNT kit do not get wet with the irrigation water.
  • the wires/power adapter wire should not be too taut.


Refer to the fourth booklet Share inside the Solve Ninja Techno Kit to know how you can share your solution.

  • Locally: Once you install the solution near a plant, observe how the user interacts with the soil moisture monitor. Talk to them about the solution and learn what they think of it.
    • Do they keep track of the soil hydration and how frequently they need to water the plant?
    • Is there any way to collect data to prove that the plant is adequately hydrated thanks to the moisture monitor?
  • Globally: Share your solution on the Solve Ninja App, and inspire 5 of your friends to take similar action. Continue collecting data; real victory is when your users realise the importance of keeping plants hydrated and take action!