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.