LockerGnomeTech news and nostalgia for today's technology professionals
Subscribe

Search

Hacks & Buildselectronicsteensysensorsmaker

IEEE Spectrum's Hidden Lockbox Opens Only When You Trace a Secret Gesture With a Magnet Over an 8-by-8 Hall-Sensor Grid

Stephen Cass hid SparkFun's $100 magnetic imaging tile behind a carved panel, recorded a gesture made with a magnet stylus, and had a Teensy 4.1 swing a servo-driven bolt when the same gesture comes back. Any plain magnet won't do it.

Picture made of iron filings on white card: Chris Pirillo in a canvas work apron traces a looping path with a small magnet wand over the lid of a wooden box, and the filings trail behind the wand.
Illustration: LockerGnome

Cass ruled out the usual options first. RFID meant “resigning myself to keeping track of yet another access card,” and a simple magnet-triggered latch has the obvious flaw that “any strong magnet will open it.” What he wanted was a lock that knows not just that a magnet is there, but how it moves.

The sensor that does that is “SparkFun’s US $100 magnetic imaging tile.” It “features an 8-by-8 grid of Hall-effect sensors” and reports the strength and polarity of the field over each one, hundreds to thousands of times a second. A magnet swept across it leaves a track, and a track can be recorded.

The brain is a Teensy 4.1, at “an equally slim $32 price tag.” The software splits in two. “One library is in charge of recording a lock gesture and saving it to the Teensy’s nonvolatile storage.” The other “reports whether or not a newly detected gesture passes a selectable threshold to be considered a match.” Cass says Claude wrote those two support libraries and he wrote the top-level code. The code is on IEEE Spectrum’s GitHub, next to SparkFun’s own library for the tile.

The mechanism is plain on purpose. A notch is cut in a beam, and the lock “uses a servo motor to rotate another beam in and out of this notch.” The stylus is a leftover magnet from a 2022 core-memory kit. To hide the tile, which is “just 3 centimeters square,” Cass made a knotwork pattern “that runs in a band across the front of the lockbox,” so the sensing spot is just one patch of a pattern.

He also lists what’s wrong with it. The board has a gotcha: “one side of the board has a silk-screen error that misidentifies the SPI connections.” The battery is a bigger one: “if the box is locked when the battery runs out, you can’t open it again without breaking something.” His proposed fix is a hidden inductive charging coil. For anyone worried about someone sniffing the field from outside, “In extreme paranoia mode, I could shield the entire lock behind copper sheeting.” He doesn’t say how many tries it takes a stranger with a magnet to stumble onto a gesture, and the threshold setting means that number is up to whoever builds one.

Most hidden locks hide where the lock is. This one hides what the key is, so even a person who knows the box is magnetic still needs the exact shape of the swipe. The open question is how forgiving the match threshold can be before a lucky guess works.

More Hacks & Builds

Every Hacks & Builds story →