Chapter 3: Security Systems

Day 13: HERO Security 101

Video lesson · 25 min

Security breach detected — space pirates are attempting unauthorized access. Build a security system using the keypad to create a passcode lock for the control panel. Learn password verification logic, access control, and security concepts.

Day 13: HERO Security 101

Mission Log: Security Breach Detected

The dim red warning lights cast eerie shadows across your ship's control panel as you float weightless in the captain's chair. Yesterday's musical interlude with the buzzer seems almost quaint now. The vast cosmos around you isn't just empty space anymore—it's a hunting ground. And you're not the only predator out here.

Your ship's automated systems have detected multiple unauthorized access attempts on the main control panel. Space pirates. The thought sends a chill down your spine that has nothing to do with the cold vacuum outside. These aren't the romanticized buccaneers of old Earth stories—they're ruthless scavengers who would steal your ship's resources and leave you drifting in the void.

The ship's AI crackles to life: "Commander, immediate security upgrade required. Current access protocol: none. Recommendation: implement personal identification system using available keypad interface." The 4x4 keypad glows softly in the red emergency lighting, each button waiting to become part of your digital fortress.

You lean forward, fingers hovering over the keys. This isn't just about learning to code anymore. This is about survival. Every spacefarer knows the golden rule: lock your doors, or someone else will open them for you. Time to turn your humble control panel into an impenetrable security system. The pirates can try all they want—but they won't crack your code.

The universe may be vast and unforgiving, but you're about to prove that intelligence beats brute force. Your keypad awaits. Your destiny as a security expert begins now.

What You'll Learn

When you finish this lesson, you'll be able to transform your keypad into a secure access control system that would make any space station engineer proud. You'll master the art of PIN validation, implement function return values for the first time, and discover how Boolean logic can be your shield against unauthorized access.

Specifically, you'll learn to:

  • Create functions that return true or false values instead of just executing code
  • Store and validate PIN codes using character arrays
  • Build a two-level security system with PIN entry and PIN changing capabilities
  • Use special keypad buttons (* and #) for system functions
  • Provide auditory feedback with your buzzer for every key press
  • Handle user input validation with proper error messages

By the end, your control panel will have the same kind of security that protects real spacecraft systems across the galaxy. No more worrying about unwanted visitors.

Understanding Security Systems

Before we dive into the code, think about every security system you've encountered. Your phone's lock screen. Your bank's ATM. The keypad at your apartment building. They all share the same fundamental concept: prove you're authorized before accessing the system.

A PIN (Personal Identification Number) system works like a digital lock and key. The PIN is your key, and the system's memory is the lock. When you enter the correct sequence, the lock opens. Enter the wrong sequence, and you're denied access. It's beautifully simple in concept, but the implementation requires careful thinking about user experience and security.

Real spacecraft use similar systems, but with multiple layers. There might be biometric scanners, voice recognition, and yes, good old-fashioned PIN codes. Why PINs? Because they're reliable, don't require special hardware, and work even when other systems fail. Your keypad becomes the gateway to your ship's most critical functions.

The beauty of our system lies in its dual functionality. Not only can you use it to access the control panel, but you can also change the PIN itself. This means if someone discovers your code, you can immediately lock them out with a new one. It's like being able to rekey your locks instantly.

But here's the clever part: to change the PIN, you first have to prove you know the current one. This prevents unauthorized PIN changes. Imagine if anyone could just walk up and change your door code without proving they belong there first. Your security would be worthless.

Wiring

Good news, space explorer! Your wiring from Day 12 is perfect for this mission. The universe has blessed us with continuity.

Your keypad is connected to pins 2-9 (with rows on pins 5,4,3,2 and columns on pins 6,7,8,9). Your buzzer remains on pin 10. This setup gives us everything we need for our security system: input through the keypad and audio feedback through the buzzer.

This is lesson 14 of 31 in 30 Days Lost in Space — a professionally produced Arduino course taught by Dr. Greg Lyzenga (NASA JPL scientist, Harvey Mudd professor). Each lesson features cinematic-quality video produced with a 20-30 person professional crew.

All video lessons are free to watch. Get the kit at craftingtable.com — $100 with a 30-day money-back guarantee.