Lesson 7 - Bird-Repelling Scarecrow

Lesson 7 - Bird-Repelling Scarecrow

Students apply the self-learning mode to a real farm problem. They teach the camera to recognize a bird, then build a scarecrow that swings and buzzes whenever a bird appears.

image1.png I can teach the camera to recognize a bird.

image1.png I can build a scarecrow that swings when a bird is detected.

image1.png I can use an if inside a loop to control when the scarecrow acts.


 

1. Engage: The Birds Are Eating the Crops

Birds keep landing on the farm and eating the crops. A scarecrow that moves all the time wastes power, and after a while the birds ignore it. We need a scarecrow that acts only when a bird comes.

image2.png

Key Question

How can the scarecrow scare the birds away only when a bird appears?

The AI camera can recognize birds: when a bird is seen, move the scarecrow and sound the buzzer; when there is no bird, stay still.


 

2. Explore: Build the Scarecrow and Teach the Bird Card

Activity 1

• Make the hardware connection:

image3.png

• Build and install the hardware following the Building Instruction:

image4.png

• Install the scarecrow on the servo arm so the servo can swing it.

• Press the mode button to switch the camera to self-learning mode.

• Teach the camera the bird card: press the learn button, then wait for the white light to fast-blink.

• Test it: show the bird card — the camera recognizes it (the white light stays on). Show a different card — nothing happens.

Teacher note: guide students to build a card stand, just like in Lesson 6; check the white light before moving on to the program.

Here is a sample you can refer to:

image5.png


 

3. Engineer: Build the Smart Scarecrow

Build the Code

Open MakeCode and add the required Extensions.

image6.pngClick Extensions
Search “https://github.com/DFRobot/pxt-Building-Block-Expansion-Board-for-microbit-UNIHIKER.git”
Add the extension
image7.pngType boson and search
image8.pngClick the extension and go back to the coding page

Build the program.

image9.png

Project Link

 

Download the program and check the effect.

Teaching note: the if checks for a bird; the repeat loop swings the scarecrow several times; the servo returns to rest when no bird is there.


 

4. Experience & Challenge: Make the Scarecrow Smarter

Experience: tune the scarecrow

Activity 2

• Change the servo angles and the number of swings (the repeat count), and add the buzzer effect.

image10.png
image11.png

• Test which settings scare the birds best.

 
Challenge: Confirm Before Scaring

Key Question

How can the scarecrow tell a real bird from a single false reading?

 

Activity 3

• Add a confirmation counter so the scarecrow acts only after the bird is seen for 5 consecutive checks.

• Build the program as follows:

image12.png

project link

 

• Test: flash the bird card briefly and confirm nothing happens; hold it steady in view and confirm the scarecrow acts.

Teacher note: the reset (set count to 0) is what makes the checks consecutive. Ask students what happens if the reset to 0 is removed. Students who finish early can change the threshold.


 

5. See More: AI Eyes on the Farm

Key Question

How do farms use AI cameras to grow better crops?

 

Our scarecrow is a small example of a big idea. Farms around the world use AI cameras — “AI eyes” — to help them grow better crops.

Here are some ways real farms use AI vision:

What it doesHow the camera helps
Spot weedingThe camera tells a weed from a crop, so a machine sprays only the weeds — and uses less pesticide.
Disease watchThe camera finds sick leaves or pests early, before they spread.
Fruit countingCameras count the fruit on the trees to predict the harvest.
Livestock careCameras count the animals and watch their health.
Animal deterrenceVision-triggered devices scare birds and other animals away — the real-world cousin of our scarecrow.

They all work like our scarecrow: the camera sees, the program decides, and something acts — see, decide, act.

 

Next lesson: Lesson 8

All Lessons

icon lesson 7.zip 2.68MB Download(0)
License
All Rights
Reserved
licensBg
0