That piggy bank is looking mighty low-tech these days, and you have to bash it open to get your cash. One piggy, one withdrawal. And then there are those cheesy, tin ”Wild West” lock boxes with the red combination dial. Not only do they lack wow factor, your granny could crack one in 30 seconds.
But stick an Arduino in a wooden box, along with a finger-operated sensor and small motor, and you’ve made a 21st-century treasure chest that’s suitable for a daily diary, petty cash, or even those special Rice Krispies recipes that your snoopy neighbor wants to steal.
There’s no key in this keyless electronic combination lock box; you just move your finger across a small optical window, and it’s “open sesame.” The combination to the lock is a secret movement pattern only you know.
How It Works
The keyless lock box uses a unique optical finger navigation (OFN) sensor as a combination decoder. The OFN sensor works much like an optical mouse, except it’s intended to be used in direct contact with your finger. They are used in handheld devices where a trackpad would be too large, but because they are more expensive than trackballs, they’re not common in consumer products.
Movement across the small surface of the sensor is converted to X and Y distance measurements — up, down, left, and right. Sequences of these movements make up the combination of the lock.
For this project I’m using the Parallax OFN module, which puts a commercial OFN sensor on a breakout board that provides connectors for power (3.3V to 5V), ground, and 6 signal lines. The OFN module uses 2-wire I2C to communicate with a microcontroller, and has additional I/O pins for such things as the momentary pushbutton switch that engages when you push the optical sensor down.
The locking mechanism uses a standard-size R/C servomotor that’s glued into the bottom of the box. To lock the box, the turning servo engages a metal arm attached inside the box’s lid. Turning the other way, it frees the bar, letting you open the lid.
An Arduino microcontroller works as the main brain of the lock box, handling all the communications with the OFN module, controlling the servo, and even making musical tones on a small piezo speaker.
For my box, I used a plain 8" square cigar box from a craft store — no need to smoke a bunch of stogies. The wood is unfinished; stain or paint to suit. You don’t get Fort Knox with these boxes, but they’ll keep out the casual thief.
Steps
Step #1: Prepare the box.
Next


- To make cutting and drilling easier, detach the box lid by removing the top screws in the 2 hinges on the back. Use a hacksaw or razor saw to cut out a small chunk on the left side of the box for the OFN module, just wide enough to fit. Gently pry loose the knockout piece, being careful not to crack the bottom of the box.
- Drill 1/8" mounting holes for the OFN module. To prevent the bit from pushing through and splintering the wood, press or clamp a piece of wood behind the hole while drilling.
- Measure and mark the center of a 1/2" hole in the rear of the box, positioned so you can insert a barrel plug through the hole and into the Arduino’s power jack. First drill a pilot hole with a 1/8" bit. Follow that with a 1/4" bit, and finish with a step bit, stopping at the 1/2" mark.
- Referring to Image 2, temporarily position the Arduino in the rear left of the box, on top of 1/8" nylon spacers. Make sure the Arduino power jack is in line with the rear hole you just drilled. Use a small nail or sharp pencil to mark the location for the 2 mounting holes indicated. Remove the Arduino and set aside.
Conclusion
Lock Box Power!
The Keyless Lock Box is designed to use external power for unlocking, but it can sit in a locked state for indefinite periods without any power. To power the lock and open it, insert the plug into the hole in the back, enter the combination, then lift the lid.
The box will automatically relock after 7 seconds. If the lid is still open, you can relock the box by manually pushing the servo arm toward the front of the box, pressing the Arduino’s reset button, and closing the lid. When the sketch restarts, it automatically moves the servo to its lock position. You may then remove the power plug.
If you forget the combination or can’t get it to work, here’s a “secret” override procedure that will briefly unlock the box:
Unplug power to the Arduino. Press and hold down the OFN sensor while you plug the Arduino back in. Quickly open the lid when you hear the servo move to its unlock position. You’ll have only 1.5 seconds before the servo relocks the box.
You can remove or comment out the override code in LockBox.ino if you don’t want this behavior.
Keep the box looking good by applying paint or finish to the bare wood, starting with a base coat. For a cleaner look, remove the clasp in front of the cigar box, and fill in the holes with wood putty. Sand for a smooth finish. Or replace the clasp with something fancier.
This project first appeared in MAKE Volume 32, page 110.































Listen up ! I just found a glitch in your website! Check if plugins is configured the right way
Hey man, was just browsing through the internet looking for some information and came across your blog. I am impressed by the information on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more. You, my friend, ROCK!!
This is actually among the list of greater articles or blog posts with the ones that Concerning keep reading this kind of matter nowadays. Great deliver the results.
I just couldnt leave your website before telling you that we really enjoyed the useful information you offer to your visitors Will be back soon to check up on new posts
// What's Trending
Raspberry Pi Design Contest
Maker Faire: Day Two
Seventeen Sneaky Secret Hides
10 Things to Connect to Your Raspberry Pi
Maker Faire: Day One
DIY Hacks & How To’s: Swiss Army Key Ring
47 Raspberry Pi Projects to Inspire Your Next Build
// What's Shared
A better way to slice a pumpkin
DIY Nerf Darts
In the Maker Shed: Minty Boost USB Charger
100 Dollar Store Organization Ideas for Craft Rooms and Beyond
Mad’s Mouse House
Lace Princess Crowns
I Have a (Puzzling) Dream
Play the Rings of a Tree Trunk Like a Record
// Most Commented
DIY Hacks & How To’s: Get Emergency Power from a Phone Line
Resin Casting: Going from CAD to Engineering-Grade Plastic Parts
Ten Tips for Screws and Screwdrivers
Ten Tips for Better Measurement
Makers on TV: Big Brain Theory
Arduino Announces New Wireless Linux Board
Grow: A Portable CNC Router System
Animatronic Beaker Puppet Lip-Syncs to Tunes