Forget your house keys? Not a problem, you can now unlock your door with just your smartphone!
How often have you come home after a long day only to find that you forgot your keys? With aLock this is no longer a problem. This invention will allow you to simply go to an app on your smartphone, enter a passcode which will be sent to the Arduino over Bluetooth LE, and your door will be unlocked. The unlocking process is actuated by a servo with a metal rod (for blocking purposes) rotating 90 degrees. This servo will also have an accelerometer attached to it which will be used to analyze whether the the device actually unlocked. In the case that the accelerometer picks up motion it will trigger an LED to flash so that you are notified that you are now free to enter your home. Now, you may ask, what happens if your smartphone is dead or you forgot it? Well aLock has a solution for that as well. In the case that your smartphone is inaccessible you can access your home by using a preprogrammed button code as a backup key. With aLock you can always unlock your door!
We used the nRF8001 Breakout to establish an easy to use wireless link between the Arduino and any bluetooth enabled smartphone. It works by simulating a UART device and can be used to send ASCII data between an Arudino and the bluetooth device of your choosing.
The other technological element used in the bluetooth portion of our product is the Adafruit Bluefruit LE Connect app that can be found on the Apple app store. Similar apps are also available on android devices now that Android supports Bluetooth Low Energy as well. Having one of these apps is necessary to connect and interact with your Arduino Uno which is attached to the servo motor (the lock). Bluetooth Low Energy communication is what is truly special about the technology we used in this product. Because the nRF8001 uses Bluetooth Low Energy instead of classic Bluetooth it can be easily from both iOS and Android 4.3 or higher devices. This ease of use does not exist with classic Bluetooth because it has big contract that makes it difficult to work with. In our product we integrated these technologies by using the phone app to send the unlock code in the form of ASCII data to the nRF8001 which is connected to the Arduino Uno with the lock. The coding on the Uno checks if the right ASCII unlock code was sent and the moves the lock if it was. Note that an Arduino Uno has to be used for our Bluetooth functions because a Leonardo does not have bluetooth compatibility.
We incorporated an accelerometer into our design by using it to detect when the door has been locked or unlocked. The accelerometer is attached on the Arduino Leonardo that is mounted on the door lock component, and therefore collects the x and y position values to determine when the motor has moved. We set the threshold value of the accelerometer to a specific value that measures when the servo motor has turned 90 degrees, and subsequently tells the LED to flash for one second when the threshold has been met. This way, the user always knows when the lock has worked. In addition, the a-Lock has a switch that turns and off the accelerometer portion (it is also used for calibration purposes). The accelerometer, LED, and switch are attached to the Arduino Leonardo, which is mounted on the servo motor.
The pushbutton system allows the user to unlock their door without the use of Bluetooth. This backup system is similar to the idea of a hidden spare key. Each button is connected to its own digital pin on the Arduino Uno. The code uses a flag variable system to detect the sequence in which the buttons are pressed. If the buttons pressed match the predetermined code, then the motor will be told to unlock. If you mis-press a button in the sequence, you can simply restart your sequence again to unlock the door.
We programmed the servo motor to move by writing the motor to move counterclockwise for a certain amount of time until it had completed a 90 degree turn. We did this through a delay function for how long the motor turns, and found this value by a simple trial and error process. The servo motor, along with the pushbutton system and Bluetooth chip, are all attached on the Arduino Uno.