Lesson 6 - Growing Stage: Auto Weeder Control

Lesson 6 Growing Stage: Auto Weeder Control

 

 

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

Students will express a program using a flowchart and use the flowchart to organize an algorithm to address the problem.

image5.png I can explain if-then-else conditionals in a program.

image5.png I can use if-then-else conditionals to control hardware.

image5.png I can use a flowchart to plan and organize my programming ideas.


Engage

image7.png 2 min.

On a farm, when using a manual weeder, the grass is often cut unevenly, leaving a messy, uneven field.

What do you think is the key to getting a clean, even cut with a weeding machine? Guide students to think about distance.

image9.png

What sensor could help us measure that distance?


Background

image7.png 3 min.The ultrasonic sensor works like a bat's echolocation. It sends out a sound wave and listens for the echo to bounce back. By timing this, it can calculate distance.

image10.png

The read the distance block returns the distance in centimeters.

image11.png

The fan module represents the cutting blade of our auto weeder.

image12.png

The fan's speed is controlled by Pulse Width Modulation (PWM) using the analog output block. The value ranges from 0 to 1023, with the default value of 512 representing medium speed.

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 weeder using block pins.


Program

image15.jpeg 25 min.


Challenge 6-1: Predict and Test

image18.pngAsk students to connect the ultrasonic sensor and the fan to the UNIHIKER K10.
image19.pngAsk students to predict what they think will happen.
Encourage students to describe the process in the if/then frame.
image20.pngimage21.png
Ask students to upload the program. What data is the UNIHIKER K10 reading now?The numbers on the screen report the distance between the ultrasonic sensor and the ground (if the sensor faces the ground without any obstacle in the middle).
Difference speed: PWM values control the fan speed. A higher value means faster rotation.

image22.png Introduce the key vocabulary flowchart.

A flowchart uses shapes and arrows to clearly show how a program works step by step.

image24.pngTerminator (Oval): Represents the start or end of a flowchart. Example: Start, End.
image25.pngArrow (Connector): Shows the flow or direction of the process.
image26.pngProcess (Rectangle): Indicates a process, operation, or action. Example: turn the light on.
image27.pngDecision (Diamond): Represents a decision point with multiple outcomes (Yes/No, True/False). Example: Is temperature > 30?


Challenge 6-2: Plan with a Flowchart

image28.pngimage29.png
Prompt students to fill in the flowchart to explain how the smart window works.
Here is an example answer:
image30.pngChallenge students to draw a new flowchart for this new rule.
A typical solution might start with “measure distance,” then have a judgement diamond: “Is distance > 10 AND < 12?” with “Yes” leading to “Turn Fan ON” and “No” leading to “Turn Fan OFF.”
image31.pngGuide students to upload the program and test it.


Extra Practice

image15.jpeg 5 min.

Modify the comparator: change Program 6-2 using two if-else-else functions to achieve the same result?

image32.png

Add a Safety Alert: Program the weeder to play a warning sound when it is outside the safe operating range (not between 10–12 cm), alerting the user to adjust the height.

image33.png

 

Next Class: Lesson 7

Current Tutorial: Click Here

icon Lesson 6.zip 2.8MB Download(0)
License
All Rights
Reserved
licensBg
0