# Build a Hidden Lock With a Magnetic Imager

DevFeed: [Build a Hidden Lock With a Magnetic Imager](<https://devfeed.tech/articles/build-a-hidden-lock-with-a-magnetic-imager-100591.md>)

Original publisher: [Read original article](<https://spectrum.ieee.org/magnetic>)

Author: Stephen Cass

Published: 2026-10-26T13:00:02Z

Content type: tutorial

Language: en

Sources: [IEEE Spectrum](<https://devfeed.tech/sources/ieee-spectrum.md>)

Topics: [Nesso N1](<https://devfeed.tech/topics/nesso-n1.md>), [Tool](<https://devfeed.tech/topics/tool.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [board](<https://devfeed.tech/tags/board.md>), [box](<https://devfeed.tech/tags/box.md>), [build](<https://devfeed.tech/tags/build.md>), [components](<https://devfeed.tech/tags/components.md>), [diy](<https://devfeed.tech/tags/diy.md>), [drive](<https://devfeed.tech/tags/drive.md>), [field](<https://devfeed.tech/tags/field.md>), [grid](<https://devfeed.tech/tags/grid.md>), [hall-effect](<https://devfeed.tech/tags/hall-effect.md>), [hidden](<https://devfeed.tech/tags/hidden.md>), [imaging](<https://devfeed.tech/tags/imaging.md>), [interface](<https://devfeed.tech/tags/interface.md>), [lock](<https://devfeed.tech/tags/lock.md>), [magnet](<https://devfeed.tech/tags/magnet.md>), [magnetic](<https://devfeed.tech/tags/magnetic.md>), [magnetic-imaging](<https://devfeed.tech/tags/magnetic-imaging.md>), [magnitude](<https://devfeed.tech/tags/magnitude.md>), [measurements](<https://devfeed.tech/tags/measurements.md>), [microcontroller](<https://devfeed.tech/tags/microcontroller.md>), [motor](<https://devfeed.tech/tags/motor.md>), [physical-security](<https://devfeed.tech/tags/physical-security.md>), [teensy](<https://devfeed.tech/tags/teensy.md>), [typedepartments](<https://devfeed.tech/tags/typedepartments.md>)

## AI overview

A hidden lock can recognize a secret magnet gesture using SparkFun's 8-by-8 magnetic imaging tile, rather than opening whenever a strong magnet reaches a concealed latch. Hall-effect sensors read field magnitude and polarity over SPI; a Teensy 4.1 samples the tile quickly enough to capture a hand-drawn gesture. Support libraries record a gesture and check later attempts against a selectable match threshold, while custom top-level code controls recording and a servo latch. In the demo box, a Celtic knot pattern serves as a concealed guide because the 3-centimeter sensing area is hard to target from outside. The author notes a serious limitation: if the battery dies while locked, the box cannot be opened without damage; a hidden inductive charging coil could address this.

## Source excerpt

Like many a nerd, I have a certain fascination with locks. This originates in reading the memoir Surely You're Joking, Mr. Feynman as a teenager, in which Richard Feynman recounts picking locks and cracking combinations while at his day job working on the Manhattan Project at Los Alamos. I currently have a couple of locksport pick sets and training locks that I purchased at hacker conferences over the years (although I'm still terrible at it), and I delight in the YouTube exploits of folks like the LockPickingLawyer. All of which left me wondering if I could try building an interesting lock. One dodge that lockmakers have long used to challenge would-be plunderers is to conceal the existence of the lock itself. A modern variant of this is the magnetic lock, where a magnet is held or slid against an innocuous portion of a door or box, releasing a catch. The problem with this is that, once you guess the location of the lock, any strong magnet will open it. So I started thinking about embedding an RFID reader under the surface and resigning myself to keeping track of yet another access card. But then I stumbled across something much more interesting: SparkFun's US $100 magnetic imaging tile. I realized I could use this to build a magnetic lock that opens with a programmable secret gesture. I used a few discrete components to drive the servo motor and put the lock into program mode [top], controlled by a Teensy 4.1 microcontroller [middle]. An array of Hall-effect sensors detect magnetic fields [bottom].James Provost The magnetic imaging tile is a small-run SparkFun board based on the work of Peter Jansen. It features an 8-by-8 grid of Hall-effect sensors, and uses an SPI interface to talk to the microcontroller of your choice. These sensors can detect both the magnitude and polarity of a magnetic field, and the board can report its measurements hundreds to thousands of times per second, depending on how much processing power your microcontroller has available. This is