Lesson 3 - Farm Panoramic Surveillance

Lesson 3 - Farm Panoramic Surveillance: Sweeping Camera with a Servo

This lesson shows how a servo can turn the AI camera to remove the blind spot of a fixed camera. Students find the angle range in which face detection stays stable, watch the teacher build a sweeping scanner, then add their own intruder alert and simplify the program with a function.

image1.pngI can explain why a fixed camera has a blind spot and how rotating it helps.

image3.pngI can find the angle range in which the camera can stably recognize a face.

image3.pngI can add a condition to detect an intruder and use a function to simplify my program.

 

1. Engage: Does a Fixed Camera Have a Blind Spot?

Open by describing the farm gate with a fixed camera: it only watches straight ahead, so someone can walk around the side without being seen.

image5.png

 

2. Explore: How Wide Is the Camera’s View?

Set up the hardware connection (shown below):

image6.png

Activity 1

Have students build and install the hardware following the Building Instruction.

 

image7.png

Download the teacher-prepared program 3-1. Pressing A turns the servo 1° one way, and pressing B turns it 1° the other way.

image8.png

Project Link

Have a student place the face card straight in front of the camera until the AI camera detects it.

Press A (or B) again and again, 1° at a time, until the face card is no longer recognized, then record the number of degrees. Repeat in the other direction and add the two numbers.

Have students complete the table, then discuss the results together:

ActionExpected result
Place the face card straight in front of the cameraFace recognized (✓)
Rotate left with A, 1° at a time, until recognition stopsAbout 5–10° (depends on distance and angle)
Rotate right with B, 1° at a time, until recognition stopsAbout the same as the other side
Stable range (left + right)10-20°

Because the fixed camera only sees a narrow slice, it has to turn to scan—so we program the servo to sweep by itself.

 

3. Engineer: Make the Camera Sweep

Part 1 — Look at a Program with No Loop (sequence structure)

Show students the first program:

image9.png

Key Question

What will this program do? Can it make the camera slowly turn left and right?

 

Teacher notes: It can make the camera sweep, but the program is long and not flexible.

 

Part 2 — Optimize with a Repeat Loop and a Variable (teacher demonstration)

Add extensions.

image10.pngClick Extensions
image11.pngSearch “https://github.com/cdjq/pxt-expansion-board-for-microbit-k10”
image12.pngAdd the extension
image13.pngSearch “BOSON”
image14.pngAdd the extension and go back to the coding page

Build the program.

image15.png

Download the program and check the effect.

Run the program → the servo turns slowly from 0° to 180° and back.

Place a face card in front of the camera → it is detected as the camera sweeps past.

Teaching note: start with a small step (for example 1°) and a short pause (for example 100 ms); a smaller step and a longer pause make the sweep slower and smoother.

 

4. Experience & Challenge: Upgrade Your Surveillance

 
Experience: add an intruder alert

 

Activity 2

Ask students to add an if block inside the sweep: when a face is detected, trigger an alert. image16.png

Project Link

Students can choose their own alert—a buzzer, a sound, an icon, or a light.

 

Challenge: Simplify with a function

Have students run the program and look for blocks that repeat.

 

Key Question

Which parts of the program repeat, and how can we simplify them?

 

Activity 3

Challenge students to wrap the repeated blocks in a function and call it, so the program becomes shorter and easier to read.

image17.png

 

5. See More: Cameras and Privacy

 

Key Question

Is it okay for a camera to watch everyone, all the time?

 

Explain that a sweeping camera is a kind of surveillance. It can keep the farm safe, but it also raises questions about privacy and who controls the data.

Think about it:

Step 1: Representation

The camera turns what it sees into data—pixels and features—that the AI reasons over. What the camera “sees” is only a representation of the real scene.

Step 2: The choice to use AI

Someone decides where the camera points and what happens to the recordings. Using AI is always a choice people make.

Step 3: Individual impacts

A sweeping camera can protect the farm, but it also makes people feel watched. It affects different people in different ways.

AI can help the farm, but it should be used fairly and responsibly. Who should decide when and where the camera watches?

 

Next lesson: Lesson 4

All Lessons

icon Lesson 3.zip 3.66MB Download(0)
License
All Rights
Reserved
licensBg
0