๐ Space Base AI Safe โ
Face Recognition & Security Logic Lesson โ
I. Learning Objectives โ
Students will:
Real-world Security Understanding
Understand how Face Recognition is used in real-world security systems:- Access control
- Safes
- Laboratories
- Space bases
AI Vision Capability
Learn the face recognition capability of an AI Vision Sensor and understand the concept of identity.System Design Thinking
Learn how to design a system that connects:
AI recognition results โ security rules โ motor behaviorSecurity Strategy Awareness
Understand security strategies such as:- Failure counting
- Risk escalation
- Two-person authentication
Security & Systems Thinking
Develop system modeling and security thinking:Identity โ Authorization
Higher risk โ stricter verification
II. Preparation โ
1. Hardware โ
Controller
- LEGO SPIKE Prime / EV3 Hub ร 1
Motor
- Medium Motor ร 1
- Used for rotating the safe dial or opening the door
- Example: Port D
- Medium Motor ร 1
AI Vision Sensor
- ร 1
- Set to Face Recognition Mode
LEGO Structure
- LEGO bricks to build a safe
- With a door or rotating dial
- Door can be unlocked or opened by the motor
Hub Screen
- Displays authentication status and prompts
2. Software โ
- LEGO SPIKE / EV3 programming environment
- AI Vision Sensor firmware supporting Face Recognition Mode
3. Teaching Materials โ
Students can role-play or use prepared images:
- Captain

- Astronaut

- Visitor

III. Teaching Process โ
1. Introduction (5 Minutes) โ
Scenario Setup (Storytelling) โ
Teacher explains:
This is a space base.
Inside the safe are classified mission files.
- Normally, either the Captain or an Astronaut can open the safe.
- If the system detects multiple failed attempts, it assumes the base is at risk.
- In high-risk situations, two people must authenticate together.
Guiding Questions โ
- Why shouldnโt anyone be able to open the safe?
- What happens if someone keeps trying?
- How do banks or laboratories handle this in real life?
๐ Key Idea Introduced
Today we will build an AI Safe that upgrades its security level.
2. Building (10โ15 Minutes) โ
Structure Explanation โ
- Reference LEGO official safe or rotating lock designs
- One motor is responsible for:
- Rotating a lock dial, or
- Opening / closing the door
Key Emphasis โ
- The mechanical structure is not the focus
- The key question is:
Who decides when the motor is allowed to move?

3. Programming (25 Minutes) โ
(1) Core System Rules โ Logic First โ
Basic Rule (Normal Mode) โ
- Captain โ โ Open
- Astronaut โ โ Open
- Visitor โ โ Denied
Risk Escalation Rule โ
- Multiple failures โ High-Risk Mode
- High-Risk Mode โ Two-person authentication required
(2) Face Recognition Logic Design โ
Example face recognition results from the AI Vision Sensor
(Face Mode):
0โ Not recognized / No face1โ Captain2โ Astronaut3โ Stranger / Visitor
IDs can be adjusted based on your sensor configuration.
(3) Single-Person Access โ Stage 1 โ
Program Logic โ
- If recognized face is Captain OR Astronaut โ Motor unlocks the safe
Teaching Points โ
- Simple
ifcondition - OR logic
- AI result โ motor action
(4) Failure Counting & Mode Switching (Key Concept) โ
Added Variables โ
fail_countโ number of failed attemptsmodeโnormal/high_risk
Logic Flow โ
- Stranger detected โ
fail_count + 1 - If
fail_countexceeds threshold โ switch tohigh_risk
๐ Key Teaching Message
AI is not just recognizing faces.
The system remembers what happened before.
(5) Two-Person Authentication (Advanced Rule) โ
Dual Authentication Logic โ
Authentication Flow
1๏ธโฃ First face detected
- Must be Captain or Astronaut
- Hub displays:
โFirst authentication successful. Please verify second person.โ
2๏ธโฃ Second face detected
- Must be different from the first
- Both must be authorized users
โก๏ธ Only then does the motor unlock the safe
Hub Screen Messages (Examples) โ
- โHigh-Risk Modeโ
- โVerified: 1 / 2โ
- โDual authentication successful. Unlockingโฆโ
Code Examples โ
- SPIKE code example

- RobotCode example
First, you need to set up a face template.
Then, code 
4. Demonstration & Testing (10 Minutes) โ
Students test the system in groups.
Normal Mode โ
- Captain โ โ Opens
- Astronaut โ โ Opens
Triggering Risk Mode โ
- Stranger attempts multiple times
High-Risk Mode โ
- One person alone โ โ Denied
- Two authorized people in sequence โ โ Opens
Observation Points โ
- Does the system truly upgrade its rules?
- Are Hub messages clear and understandable?
- Does the motor behave as expected?
IV. Extension & Discussion (10 Minutes) โ
Encourage students to enhance the system:
1๏ธโฃ Time Window โ
- What if both people must authenticate within 10 seconds?
2๏ธโฃ Reset Logic โ
- What if the second person never comes?
3๏ธโฃ Escalation โ
- What if failures keep increasing?
- Add alarm or full system lockdown
V. Lesson Summary โ
Students Learned โ
- Face recognition โ a simple open button
- AI can participate in security decision-making
Students Mastered โ
- Basic use of face recognition
- Failure counting and state switching
- Single-person vs dual-person authentication logic
Students Experienced โ
๐ A realistic AI security system โ
just like a real space base safe