Skip to content

๐Ÿš€ 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 behavior

  • Security 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
  • 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:

  • Captainalt text
  • Astronautalt text
  • Visitoralt text

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?

alt text


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 face
  • 1 โ†’ Captain
  • 2 โ†’ Astronaut
  • 3 โ†’ 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 if condition
  • OR logic
  • AI result โ†’ motor action

(4) Failure Counting & Mode Switching (Key Concept) โ€‹

Added Variables โ€‹
  • fail_count โ†’ number of failed attempts
  • mode โ†’ normal / high_risk
Logic Flow โ€‹
  • Stranger detected โ†’ fail_count + 1
  • If fail_count exceeds threshold โ†’ switch to high_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 alt text
  • RobotCode example
    First, you need to set up a face template.
    alt text Then, code alt text

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


VI. Classroom Presentation Materials โ€‹

๐ŸŽฅ Demo Video โ€‹

Released under the MIT License.