Creating a Programmable Magnetic Lock Using Imaging Technology

A new project demonstrates the creation of a hidden lock that opens only with a programmable magnetic gesture. This innovative lock utilizes SparkFun’s magnetic imaging tile and a Teensy microcontroller, providing a unique approach to physical security.
The concept originated from the author’s fascination with locks, inspired by Richard Feynman’s memoir, where he recounts experiences with lock picking during his time at the Manhattan Project. The author, who has collected locksport tools over the years, sought to build an interesting lock of their own.
Traditional magnetic locks can be easily compromised once the location is known, as any strong magnet can unlock them. To enhance security, the author considered embedding an RFID reader but discovered the more intriguing option of using SparkFun’s $100 magnetic imaging tile, which allows for a programmable secret gesture to unlock the mechanism.
The magnetic imaging tile features an 8-by-8 grid of Hall-effect sensors that can detect both the magnitude and polarity of magnetic fields. It communicates with a microcontroller via an SPI interface, reporting measurements rapidly enough to capture the motion of a magnet moved across its sensor area.
Additionally, the author noted that the lock could be shielded with copper sheeting, acting as a Faraday cage to block RFID signals and other electromagnetic fields, enhancing its security against detection.
Microcontroller Selection
The Teensy 4.1 was chosen as the microcontroller for this project due to its extensive input/output capabilities, 600-megahertz processor, and built-in SD card, all for a modest price of $32. Wiring the Teensy to the magnetic imaging tile was straightforward, despite a silk-screen error on the board that misidentified SPI connections.
For gesture recognition, the author developed software that records a lock gesture and saves it to the Teensy’s nonvolatile storage. This software also monitors the tile to determine if a newly detected gesture matches the stored one.
The top-level code, written by the author, manages the system’s operation, including a button for entering gesture-recording mode and an indicator LED for visual feedback.
To demonstrate the lock’s functionality, the author repurposed a wooden craft box, removing its existing latch and constructing a mechanism using a servo motor to engage the locking mechanism. The design allows for the magnetic imaging tile to be discreetly mounted inside the box, alongside the Teensy and other electronic components.
To facilitate the unlocking gesture without revealing the lock’s location, the author created a Celtic knotwork pattern on the box, serving as a camouflage reference grid for executing the gesture accurately.
While the current design has limitations, such as being unable to unlock the box if the battery dies, the author suggests that adding a hidden inductive charging coil could address this issue. The project successfully demonstrates a unique approach to building a hidden lock that relies on a programmable magnetic gesture.
Related link: archive.org
Source: IEEE Spectrum