DIY Projects

Hidden Lockbox Opens Only to a Secret Magnet Gesture

Hidden Lockbox Opens Only to a Secret Magnet Gesture

Hidden electronics keep showing up in maker projects: sensors tucked behind wood, glass or fabric so the finished object looks like nothing special. A lockbox with no keyhole, no keypad and no visible button is one of the cleanest examples, and the Hackster write-up of Stephen Cass’s build is worth a read before you pick your next weekend project.

The build

Cass started with a wooden craft box and removed its latch. A servo now turns a small beam that catches a notch on the lid. To open it, you drag a magnet across the surface in a secret path. A plain magnet held in the right spot will not do it, because the box checks the whole gesture, not just the presence of a field.

Technical takeaway

The sensing comes from SparkFun’s Magnetic Imaging Tile, an 8×8 grid of Hall-effect sensors that reads field strength and polarity over SPI. A Teensy 4.1 (600 MHz, 1 MB RAM) polls the grid and compares each new gesture to one stored in nonvolatile memory, using an adjustable match threshold. That threshold is the gotcha: set it too tight and your own hand fails, too loose and a lucky swipe works. Two NPN transistors shift the Teensy’s 3.3 V logic up to the servo’s 5 V control input. The tile only senses a 3 cm square, so Cass printed a Celtic knot pattern on the lid as a disguised reference grid to guide the stylus.

His own list of flaws is useful too. A dead battery leaves the box locked, so a hidden inductive charging coil or a backup path is worth planning in from the start.

What to try next

You do not need the Teensy to test the idea. Wire a single A1302 Hall sensor to an Arduino analog pin, log the readings while you move a magnet past it, and plot the curve. Once you can repeat a 2-sensor gesture, add more sensors on a breadboard and store the pattern in EEPROM. For a school project, a hidden-lock cabinet makes a good thesis demo for sensor fusion and gesture matching. Hall sensors, servos and Arduino boards are all available at circuit.rocks, and the original code approach is described at the Hackster page.

Frequently Asked Questions

How does the lockbox recognize the secret gesture?

An 8×8 Hall-effect sensor tile reads magnet strength and polarity over SPI. A Teensy 4.1 records the path and compares new swipes to the saved one using an adjustable threshold.

What parts and skills does a smaller version need?

A microcontroller, one or more Hall sensors, a hobby servo, a battery pack, a record button and two NPN transistors if you shift 3.3 V logic to 5 V. Basic soldering and SPI or analog reading are enough.

What will I learn if I build this?

You learn Hall-effect sensing, SPI communication, servo control, logic level shifting and gesture matching with tolerance thresholds, all useful for thesis work in embedded security or sensing.

This article was inspired by reporting from Hackster. Find the parts and modules to build it at Circuitrocks.

// written by Ann Arandia

Ann Arandia covers community projects and maker events for the Circuitrocks blog. She writes about local workshops, kid-friendly electronics, and the Philippine maker scene — the people, the meet-ups, the projects that come out of them.