Raspberry pi face recognition treasure box is about the creation of a box that opens only when the right person looks at it. You don’t need to remember a combination of carrying key and the fear of being hacked is far away now. By using a raspberry pi and open source computer vision libraries like openCV, this treasure box has been made that unlocks itself using face recognition.
The project is quite complicated as it requires compiling and installing software on the raspberry pi. The author has used raspberry pi in the project because it provides a perfect platform and power to run openCV and can be fit almost anywhere. OpenCV computer vision library provides an algorithm, upon which the software is based.
Apart from raspberry pi, either model A or model B, you will require raspberry pi camera and camera cable. The length of cable will depend on the small wooden box and make sure to have internet access to setup the software of raspberry pi. Use a box that can fit the raspberry pi, servo and a latching mechanism. Further, find a small servo or solenoid for the locking mechanism. If your box has a door or drawer, you can use solenoid. To keep it simple, the author has used servos that rotates a latch, which can work with most boxes. A power supply for the raspberry pi and servo or solenoid and 1/4 watt resistor to use as a pull-up resistor with the momentary push button will be required.
How to build the box
To begin, you can start your project by assembling them and mounting the raspberry pi, servo and a latching mechanism. Drill a hole on the top or side of the box, in order to fit a raspberry pi camera and to mount the push button. Drill another hole to allow power cables to fit into the box for both the Raspberry Pi and servo.
Now comes the latching mechanism where you have mount a small dowel perpendicular to the side of the box. Then the raspberry pi has to be mounted on the top of the box or near the hole for the camera along with the locking servo. Attach that board to dowels glued in to form a frame in the box top with few screws
The wiring section of this project is comparatively simple and includes connecting a servo and push button to the raspberry pi. For servo, connect the signal line to GPIO 18 of the Raspberry Pi and for the power, connect it to the battery pack. The push button is further attached to GPIO 25 of the Raspberry Pi with a resistor to 3.3 volt power from the Pi.
To the software section, you need to install openCV, which will take longer time. This project completely depends on the OpenCV computer vision library to perform the face detection and recognition. Unfortunately. The current version of openCV is too old to contain the face recognition algorithm to install in the raspbian operating system which can be replaced later.
Before compiling the code, install openCV dependencies because a few dependencies has to be installed. The code for this project is written in python. After OpenCV and the python dependencies have been installed, software for this project is downloaded.
To run the box software, it is essential to assemble hardware properly and then finish your training. Initially you will run the box with power to raspberry pi only and the lock servo. This is done to test the face recognition without locking yourself out of the box. After completing all training data, you will get positive and negative predictions for face recognition. As per the term, the former opens up the box and the later doesn’t. This completely depend on training data, if its negative, then you need a better training data or vice versa.
This is a great project to explore the usage of raspberry pi and pi cameras with openCV computer vision algorithm. Latest version of openCV is required in this project and it provides a nice scope for advancement. LED can be added to the box which will face, when the face is detected or adding a microphone for speech recognition. It is open to other innovative ideas that can help this project to extend in positive manner.
Filed Under: Reviews