Zum Hauptinhalt springen

Build a more efficient watering cycle

Instructions

This lesson covered how to control a relay via sensor data, and that relay could in turn control a pump for an irrigation system. For a defined body of soil, running a pump for a fixed length of time should always have the same impact on the soil moisture. This means you can get an idea of how many seconds of irrigation correspond to a certain drop in soil moisture reading. Using this data you can build a more controlled irrigation system.

For this assignment you will calculate how long the pump should run for a particular rise in soil moisture.

⚠️ If you are using virtual IoT hardware, you can work through this process, but simulate the results by increasing the soil moisture reading manually by a fixed amount per second the relay is on.

  1. Start with dry soil. Measure the soil moisture.

  2. Add a fixed amount of water, either by running the pump for 1 second or by pouring a fixed amount in.

    The pump should always run at a constant rate, so every second the pump runs it should supply the same amount of water.

  3. Wait until the soil moisture level stabilizes and take a reading.

  4. Repeat this multiple times and create a table of the results. An example of this table is given below.

    Total Pump timeSoil MoistureDecrease
    Dry6430
    1s62122
    2s60120
    3s57922
    4s56019
    5s53921
    6s52118
  5. Work out an average increase in soil moisture per second of water. In the example above, each second of water decreases the reading by an average of 20.3.

  6. Use this data to improve the efficiency of your server code, running the pump for the required time to get the soil moisture to the level needed.

Rubric

CriteriaExemplaryAdequateNeeds Improvement
Capture soil moisture dateIs able to capture multiple readings after adding fixed quantities of waterIs able to capture some readings with fixed quantities of waterCan only capture one or two readings, or is unable to use fixed quantities of water
Calibrate the server codeIs able to calculate an average decrease in soil moisture reading and update the server code to use thisIs able to calculate an average decrease, but cannot update the server code, or is unable to correctly calculate an average, but uses this value to correctly update the server codeIs unable to calculate an average, or update the server code