Automatic Plant Watering using Soil Moisture Sensor

Example Description
This example demonstrates how to use the Soil Moisture sensor to detect the moisture in the soil and water the plant using the drip system. The system will water the plant when the moisture of the soil is low.

This example demonstrates how to use the Soil Moisture sensor to detect the moisture in the soil and water the plant using the drip system. The system will water the plant when the moisture of the soil is low.

Drip Irrigation Assembly Guide

The following tutorials cover how to make the Drip Irrigation System:

  1. For 1 Plant: https://ai.thestempedia.com/docs/iot-house-quarky-addon-kit-documentation/1-plant-drip-irrigation-assembly-iot-house/
  2. For 2 Plants: https://ai.thestempedia.com/docs/iot-house-quarky-addon-kit-documentation/2-plants-drip-irrigation-assembly-iot-house/

Circuit

We are using 2 devices in this project:

  1. Moisture Sensor: The moisture sensor provides real-time moisture reading from the soil. The moisture sensor connections are as follows:
    1. GND Pin connected to GND of the Quarky Expansion Board.
    2. VCC Pin connected to VCC of the Quarky Expansion Board.
    3. Signal Pin connected to A2 of the Quarky Expansion Board.
  2. The Water Pump Connected to the Relay: The water pump is controlled by the smart switch of the IoT house which has a relay controlling the state. If the relay is ON, the smart switch gets ON, turning on the water pump. The relay has the following connections:
    1. GND Pin connected to GND of the Quarky Expansion Board.
    2. VCC Pin connected to VCC of the Quarky Expansion Board.
    3. Signal Pin connected to Servo 8 of the Quarky Expansion Board.

Note:  Once the connection is done, make sure you have the drip irrigation system placed with some water in the tank.

Script

The project has 3 scripts:

  1. Script to display the real-time moisture level on the display of the Quakry. Based on the moisture value, the number of LEDs will light up. The script is a custom block defined with the name – Display Soil Moisture Level.
  2. The second script is another LED display showing the animation of the watering. The script is a custom block defined with the name – Watering Animation.
  3. The final script is the main script which has the logic to detect the moisture value. If the value becomes less than 30%, the pump gets ON and the watering continues until the moisture level gets to 80%.

Output

Uploading Code

You can also make the script work independently of PictoBlox using the Upload Mode. For that switch to upload mode and replace the when green flag clicked block with when Quarky starts up the block.

Table of Contents