Now it is no longer necessary to use a key or a password to protect your treasures from prying eyes. Just teach your treasure box to recognize your face and it will open to no one except only when you are near it. The trick is to use the tiny, credit card sized, single board computer, the Raspberry Pi (RBPi) and its camera. When you are near, the camera and the RBPi recognize your face and the box unlocks itself.
The RBPi is the best-suited platform for this project, as it is very small and you can fit it almost anywhere. Additionally, all algorithms for this project are from the OpenCV computer vision library, which the RBPi is able to run. The advantage in building this project is that being an intermediate-level design, the project will teach you how to compile and install software on the RBPi.
For this project, you will need an RBPi model A or B and it should be running the Raspbian or the Occidentalis OS. You will also need Internet access when you are building the project. Additionally, you will require the RBPi camera module.
For the treasure box, you can use any type as long as it opens from the top and is big enough to hold the RBPi, and of course, your treasure. Among the other things you will require are a battery holder to hold 4x AAA batteries – this will be used to power the servo. For making the latch, you may use a wooden dowel and a few planks – these will be used to make a frame for the RBPi. A momentary push button may also be used – you can mount that on the side of the box.
As a start, you will have to make a hole on the top cover of the box for fitting the RBPi camera. You will also need a few more holes on the side of the box for the power cables and the push button. Mount a dowel in front of the box – the latch will catch this when the servo turns. You will need a small frame to support the RBPi and the latch servo. Clamp the servo to the frame using some wood scraps and machine screws. Fit the RBPi under the top cover of the box, such that the latch servo can swing down and catch the dowel to lock the box.
For the software, you will require the latest version of OpenCV. However, you will need to compile this from source, as the binary versions available are too old to be of use for face recognition. Compiling OpenCV on the RBPi will take about 5 hours.
For training the system to recognize you, you need to press the button to let the camera take a picture of your face and save the picture in the training directory. RBPi requires at least five pictures from different angles, with different lighting etc., for making a positive identification. The images form a database of the permitted faces that are allowed to open the treasure box.