Chapter 02: Base Security 101

NFC Badges

The Last Stand

The compound's steel doors gleam in the harsh morning light, their electronic locks blinking red like angry eyes. Three weeks since the AI apocalypse, and your survivor group has carved out this sanctuary from the ruins of what used to be a corporate research facility. The building's automated systems died with the rest of the digital world, leaving behind a maze of sealed rooms and corridors that require manual override for everything.

Maya pounds her fist against the reinforced entrance, her knuckles already raw from yesterday's scavenging run. "We can't keep doing this," she growls, sweat beading on her forehead despite the cool air. "Standing here for five minutes while someone fumbles with the keypad is going to get us killed. Those roving security bots are getting smarter, and they're learning our patterns."

She's right. The compound's 4x4 keypads work fine when you're inside, but punching in a twelve-digit code while hostile machines patrol the perimeter is a death sentence waiting to happen. Your fingers trace the small plastic cards scattered across the workbench, remnants of the building's old employee access system. RFID badges, still pristine in their lanyards, each one programmed with unique digital signatures that once granted access to different security zones.

The parts box yields a promising discovery: an MFRC522 RFID reader module, its antenna coil gleaming like a technological lifeline. In the old world, these devices controlled everything from office doors to subway turnstiles. Now, it might be the difference between a successful supply run and becoming spare parts for the machines hunting you. Time to give your HERO Board a crash course in reading the ghosts of corporate security.

What You'll Learn

When you finish this lesson, you'll be able to:

Build a complete RFID door access system using the MFRC522 reader module and your HERO Board. You'll understand how radio frequency identification works, why it's more secure than keypads for quick entry, and how to program your board to recognize specific RFID cards or key fobs. Your system will display friendly messages on an LCD screen, scan cards in milliseconds, and distinguish between approved access badges and random junk.

More importantly, you'll learn how to store multiple approved card codes in your program's memory, compare incoming scans against your approved list, and provide clear feedback about whether access should be granted. This isn't just about reading cards; it's about building a complete security system that could genuinely protect your group's hideout.

Understanding RFID Technology

RFID stands for Radio Frequency Identification, and it works like an invisible handshake between two electronic devices. Imagine you're at a crowded party where everyone speaks in whispers. Most people can't hear each other across the room, but if someone leans in close and speaks directly into your ear, you'll hear them perfectly. That's essentially how RFID works.

Every RFID card or key fob contains a tiny antenna and a microchip. The chip stores a unique number, kind of like a digital fingerprint. When you bring the card close to an RFID reader, the reader sends out radio waves that power up the card's chip for just a moment. In that brief instant, the chip broadcasts its stored number back to the reader. No batteries required, no physical contact needed.

This is why RFID is perfect for access control. Unlike a keypad where you have to punch in numbers while potentially being watched, RFID works in a fraction of a second. Just tap your card to the reader and you're either in or out. The whole transaction takes less time than it took you to read this sentence.

Our MFRC522 module can read the most common type of RFID cards, called MIFARE Classic cards. These operate at 13.56 MHz, which means they send radio signals 13.56 million times per second. The cards store their unique identifier in a format that can be 4, 7, or 10 bytes long, depending on the specific card type. Each byte can represent a number from 0 to 255, giving us billions of possible unique combinations.

Wiring Your RFID Security System

The MFRC522 RFID reader needs both power and communication lines to work with your HERO Board. Here's why each connection matters:

  1. 3.3V to 3.3V: The RFID module runs on 3.3 volts, not 5V. Using the wrong voltage can damage the sensitive radio frequency circuits inside the module.
  2. GND to GND: Ground connection completes the electrical circuit and gives both devices a common reference point for their signals.
  3. RST to Pin 26: