Lesson 7 - Growing Stage: Irrigation System

Lesson 7 Growing Stage: Irrigation System

 

image3.png Challenges: 7-1, 7-2

Students will develop programs that combine control structures, including nested loops and compound conditionals.

image5.png image5.png image5.png I can set a proper soil moisture threshold to control the pump’s on/off status.I can use the compound condition of light and soil moisture to achieve automatic irrigation.I can understand and use nested loops to implement an intermittent watering pattern.


Engage

image7.png 2 min.

What do plants need to grow? (Water, sunlight, etc.) Today, we're going to build a smart system that waters plants automatically, but only when they need it!

image9.png

How do we know the crops need water?


Background

image7.png 3 min.Soil Moisture Sensor: This is a simple moisture sensor used to detect the water content in soil.

image10.png

The read analog block is to get a value from the sensor connected to port P0. The sensor outputs low values for dry soil and higher values for wet soil.

image11.png

A relay is an electrically operated switch that turns on and off the pump to safely drive high-power devices like water pumps.

image12.png

NOTE: The relay module has a toggle switch to select NO or NC mode. NO stands for Normally Open, which means the wire connected to this contact will normally be open (or off), and current will not flow when the relay is deactivated. And the NC (Normally Closed) works in the opposite manner.

When the relay is switched to NO, the digital output HIGH signal activates the relay and turns on the water pump, while the LOW signal turns the pump off.

image13.png


Build and Connect

image7.png 10 min.

image14.pngBuild together by following the Building Instruction.

NOTE: Students can install the UNIHIKER K10 on the holder and link to the base using block pins.


Program

image15.jpeg 25 min.


Challenge 7-1: Basic Automatic Irrigation

image18.pngimage19.png
Instruct students to insert 4 AA batteries into the battery holder, then connect all sensors and actuators to the UNIHIKER K10.
NOTE: Switch the relay to NO mode, and power on the battery supply only after uploading the program.
Add the required extensions and prepare for programming.
image20.pngGuide students to rebuild the program from an image. This program checks if the soil is dry and turns on the water pump.
image21.pngRun the program and encourage students to answer:Insert the sensor into wet soil and dry soil separately. What is the sensor reading now?What threshold value should we set to represent dry soil?Ask students to adjust this threshold value.
image22.pngimage23.png
Explain that we should avoid watering plants in the middle of the day when the intense sunlight is because the water can evaporate too quickly.
Challenge students to modify the if block with the and block to turn on the pump only if the soil is dry and the sunlight is soft.
Sample code:


Challenge 7-2: Intermittent Watering with Loops

image24.pngimage25.png
Guide students to load the program7-2-1, and add blocks to make the watering repeat an “on-off” cycle three times total.
Sample code:
image26.pngimage27.png
Challenge students to make it repeat a set of actions a specific number of times without writing the same blocks over and over.
Sample code:

NOTE: It is recommended that teachers avoid testing the device with water during class. If the equipment needs to be used in a real watering scenario, ensure all exposed electronic components are properly waterproofed. Refer to the figure below for the recommended application scenarios of the water pump.

image28.png


Extra Practice

image15.jpeg 5 min.

Change the time in the wait blocks so the watering cycle moves faster or slower.

image29.png

Challenge students to create other watering patterns with the digital output HIGH and digital output LOW blocks. For example, create a music fountain on your farm.

 

Next Class: Lesson 8

Current Tutorial: Click Here

icon Lesson 7.zip 3.41MB Download(0)
License
All Rights
Reserved
licensBg
0