The Scanner

The Scanner

An escape room experience, completely portable


Python
Linux + Raspberry Pi
NFC Reader
LED Animation
Audio Playback
Gameplay
Interactive
Daemons
Multithreading

A homebrew digital scavenger hunt game made to work at an outdoor camping trip. Modular gameplay system for future events and generalized compatibility. Great attention went into a seamless LED sequence for a dynamically and uniquely themed scanning state machine.



Aug 2023 – Nov 2023

Overview

A simple experiment: what would it take to get a Raspberry Pi that was easy to deploy on the road? I wanted a portable device or game with more capabilities than a microcontroller could have. A full Raspberry Pi would unlock audio playback and speaker support, GPIO for an NFC reader and addressable LEDs, more storage, battery operation, and a Python environment with its expansive libraries. Long-term, if it worked, it could serve as a central server for future devices to connect to.

The event this device was made for was Fallout-themed, leading to this mixed apocalyptic tech aesthetic. I recommend watching the video for reference of how it actually works.

Highlights

Game Loop

People look around the campsite for little mushrooms and scan them in once found. Scripted events and narrative moments tied into this, and the mushrooms all had scripted lines that were "encoded" until you scanned enough of them to "decipher the signal". In practice, we think this made the loop less approachable and didn't give enough motivation early on to keep hunting.

Audio

The audio design in many places was inspired by Zelda, especially how the discovery builds up and releases at the end with a sort of "shatter" sound effect.

Data Driven Hookup

A programmed key on an NFC card/chip maps to its data through a JSON file. Mushrooms with unique behavior were still data driven, and support for narrative items and assorted items made it easy to add content very late in the process.

Seamless LED Animations

Pygame and the Adafruit framework had incompatibilities with FastLED, so I went without it and built my own structures, performant enough for complex animations with seamless blending between states. The animations ran on their own thread, and a universal system kept the transitions flexible without boilerplate per state. Like a lot of my latest projects, premium LED animations are where I put the majority of my time, as I believe that's what creates immersion with these devices.

Boot Time Optimizations

The device had a hardline power switch straight to the power source, and needed to be battery powered and portable, so boot time on Raspberry Pi OS was a genuine concern. I made the program a Linux daemon that runs on startup, then broke down the startup times of every daemon Linux was running and disabled what I could. Internet usage was one of the highest, with around 12 seconds of boot time allocated to it. This took a large amount of the dev time, but I sort of liked this form of optimization.

Tech Breakdown

Hardware

A PN532 NFC receiver with a ring of WS2812B lights, a 4x8 segment display, and a hardline power switch. The brain is a Raspberry Pi 2B, which has a lot more power efficiency than the later Raspberry Pi versions, and is also harder to acquire nowadays.

Pygame

The device ran an instance of Pygame with no display output, which gave an easy architecture to build off of, with support for fully disabling the GUI side of the library. The entire game loop was multithreaded so the NFC scanner would not interfere with the LED animations.

SSH Development

With GPIO used so heavily, testing off device was impractical. Remote SSH development in VS Code was an incredibly smooth pipeline, and the project stayed under version control to avoid data loss while testing Linux and system optimizations.

Lessons

Tech Stack Raspberry Pi 2B Raspberry Pi OS Pygame PN532 NFC WS2812B JSON Linux Daemons VS Code Remote SSH

Additional Keywords Raspberry Pi Game NFC Scavenger Hunt Escape Room Device Portable Escape Room Fallout Prop Boot Time Optimization