← Back to Missions
ADVANCED • 60 MINUTES

Mission 7: Face Recognition 😊

Teach the robot to recognize and greet family members!

😊

🎯 What You'll Learn

🧠 Machine Learning

How AI learns and recognizes patterns from examples

👤 Facial Features

What makes each face unique (face geometry)

💾 AI Training

Teaching machines through examples and reinforcement

🔐 Biometric Security

How face unlock works on phones and computers

📦 What You Need

This Is The Magic Moment!

This mission is where kids usually say "WHOA!" 🤯

When the robot recognizes their face and says their name (via LED display or sound), it feels like real AI. Because it is! This is the same technology in:

🛠️ Let's Train the AI!

1

Set HuskyLens to Face Recognition Mode

Power on the HuskyLens. Press the Function button (left button) repeatedly until you see a face icon at the top of the screen. The mode name should say "Face Recognition."

🎭 You'll Know It's Right When: The camera displays a box around detected faces with a "?" symbol (meaning "unknown person").
2

Teach It the First Face

Have one of the boys stand about 2 feet from the camera in good lighting. Their face should fill about 1/3 of the screen.

Training Process:
1. Face the camera directly (looking straight at it)
2. Press and hold the LEARNING button (right button)
3. Keep holding for 2-3 seconds while staying still
4. The screen will flash and show "ID1" in a box around the face
5. Success! The AI has learned this face as "Person 1"
💡 Pro Tip: The AI captures multiple angles during those 2-3 seconds. Try to stay still but natural—no need to freeze like a statue!
3

Add More Faces

Now teach it the second boy's face! Repeat the same process. The HuskyLens will assign "ID2" to the second person.

You Can Train:

  • • Up to 7 different faces (ID1 through ID7)
  • • Mom, Dad, siblings, grandparents—anyone!
  • • Even pets if they stay still (cats are tricky 😸)
🎯 Challenge: Can they train all family members, then see if the robot recognizes them from across the room?
4

Test Recognition (Standalone)

Before coding, verify the HuskyLens is recognizing correctly. Point it at the trained faces:

  • Trained face: Shows ID number in a blue box
  • Unknown face: Shows "?" in a yellow box
  • Multiple faces: Can track several at once!
🧪 Experiment: Try different angles, distances, and lighting. How far away can it still recognize? What if they wear glasses or a hat?
5

Code: Read Face IDs

Now let's make the micro:bit respond to recognized faces!

On Start:
  HuskyLens Initialize I2C
  HuskyLens Set Algorithm [Face Recognition]

Forever:
  HuskyLens Request

  If [HuskyLens Is Learned] AND [HuskyLens Get ID] = 1:
    // First boy detected!
    Show String "Hello Boy #1"
    Play Melody [Power Up]

  Else If [HuskyLens Get ID] = 2:
    // Second boy detected!
    Show String "Hello Boy #2"
    Play Melody [Jump Up]

  Else:
    // No recognized face
    Show Icon •

  Pause 500ms
6

Add Robot Actions!

Make the robot DO something when it sees each person:

Fun Behaviors to Try:

  • Spin when ID1 appears: Turn in a circle celebrating
  • Drive toward ID2: Follow that person around
  • Different LEDs per person: Blue for one, green for another
  • Secret intruder alarm: Beep loudly if unknown face!
  • Greeting dance: Move + lights + sound combined!
Example - Spin for ID1:
If [HuskyLens Get ID] = 1:
  Show String "Hi!"
  Set Motors: Left=100, Right=-100
  Pause 1000ms (spin for 1 sec)
  Set Motors: Left=0, Right=0
7

Advanced: Face-Following Robot

Let's make it follow a specific person around the room!

Forever:
  HuskyLens Request

  If [HuskyLens Get ID] = 1:
    Set [x_position] to [HuskyLens Get Center X]

    // Face is on left side of screen
    If [x_position] < 100:
      Set Motors: Left=50, Right=100 (turn left)

    // Face is on right side
    Else If [x_position] > 220:
      Set Motors: Left=100, Right=50 (turn right)

    // Face is centered - drive forward!
    Else:
      Set Motors: Left=80, Right=80
🎯 How It Works: The HuskyLens reports where on screen it sees the face. The robot steers to keep the face centered—making it follow that person!

🔬 What's Happening Behind the Scenes?

When you train a face, the HuskyLens AI analyzes facial landmarks—the unique geometry of eyes, nose, mouth, and face shape. It creates a mathematical "fingerprint" called a feature vector (basically a list of numbers that describes that face).

When it sees a face later, it generates a new feature vector and compares it to stored ones. If the match is close enough (above ~85% similarity), it says "That's ID1!" This happens 30 times per second!

The Neural Network Process:

  1. 1. Face Detection: Find faces in the image (separate from background)
  2. 2. Alignment: Normalize face angle and size
  3. 3. Feature Extraction: AI identifies key landmarks
  4. 4. Encoding: Convert landmarks to a 128-number vector
  5. 5. Comparison: Match against stored face vectors
  6. 6. Classification: Return ID if match confidence > threshold

Real-World Impact: This exact process unlocks your phone, tags friends in photos, helps police find missing persons, and even lets cameras automatically focus on faces. Your nephews just built the same AI that Facebook and Google use! 🤖📸

🤔 Important Discussion: Privacy & Ethics

This is a great moment to talk with the boys about AI ethics:

🔐 Consent Matters

Always ask permission before training someone's face. It's their biometric data—they should control it!

💾 Data Storage

The HuskyLens stores faces locally (not in the cloud). That's good for privacy! But it also means if you reset it, the faces are gone.

⚖️ Potential Misuse

Facial recognition can be used for good (finding missing kids) or bad (surveillance without consent). As future engineers, they should think about ethical implications!

Mission Success Checklist

🚀 Ready for Color Vision?

WOW! The robot now recognizes people! This is peak AI coolness. The boys learned about machine learning, neural networks, facial geometry, and biometric data—concepts used in trillion-dollar industries!

Next up: We'll teach it to track colored objects! Make it follow a red ball, stop at a green sign, or play fetch. This unlocks game and toy applications! 🎨

Next Mission: Color Tracker 🎨 →
← Back to All Missions