Difference between revisions of "Smart Lock"
|Line 10:||Line 10:|
Revision as of 23:07, 3 May 2018
Smart Lock is a revolutionary new way for individuals to enter their households from simply the tap of a button on their phone. Considering that lock technology has been stagnant for many years, our group believes that we can revolutionize a door lock such that it can be integrated in the technology driven world that we currently live in.
Our approach to this opportunity posed requires us to create a three-part solution. The first part is an electronic mechanism that can be installed in doors that will be able to verify the identity of a smartphone users and unlock/open doors for the person. The second part will be an app on a phone that allows the user to securely log in and verify their identity. They will then be granted permission to certain locks which they can then open.
- Graham Webb
- Ahmed Hassan
- Kelvin Xie
- John Gibson (TA)
- Dr. Feher (Professor)
Goal of Product
- Unwieldy and ineffective electronic key-chains that use a smartphone to unlock doors. Our product will decrease the hardware required and try to create a universal system that would be viable and cheaper in real life. The goal is to create a smart lock that doesn't require a full installation of a new lock like many of the existing smart locks on the market.
- Desired list of features
- Automatic activation of lock based on proximity to the device
- Use beacon technology in the lock
- Have an app that can SECURELY request tokens from AWS
- App should be able to interface with phone to send tokens
- App should be password protected
- Program lock to SECURELY request token lists from AWS
- Set caps on token refresh time and how many requests can be made per minute
- Fully functioning deadbolt interfaced with the circuit board in the lock
- Deadbolt should be controlled by Servo
- Ensuring Software Security (Key Generation)
- Interfacing Locking Mechanism with Software (Proper Pi Integration)
- Creating a secure interface between the phone and the smart lock (HTTPS)
- Designing a mobile application (or web app) that reliably connects to the server to obtain identification
- Integrating original Estimote SDK code into a newly built app
- Interfacing POST request parameters with the server so that they can exchange information more efficiently
- Integrating beacon into the door frame securely.
- Raspberry Pi
- Hall Effect Sensor
- Breakout Cable for Raspberry Pi
- Amazon Web Domain
- $225.7 excluding tax
Other Equipment and Software
- Computer with Python 3
- 3D printer
- Used to print connection piece for lock and servo
- Fusion 360
Design and Construction
- Basic Project Outline
- This part of the project will comprise of the physical locking mechanism (Deadbolt and Servo) as well as the necessary hardware components (Raspberry Pi) to communicate with our AWS server
- AWS Server:
- The server will serve as the method of communication between the lock and our phone application. It will also be integral in the security of the lock. It will be used primarily for the generation of tokens (for the mobile app) and a list of authorized tokens (for the Raspberry Pi).
- Key Features
- Secure Locking Mechanism
- Secure Software Encryption
- Phone Proximity Unlocking
- Phone Application Interface
- With there being multiple components, it may be difficult to understand how all of the components interact with each other. Below, we will provide readers with a overview of how Smart Lock works.
- Smart Lock has 4 primary components: Android Application, Bluetooth Beacon, Amazon Web Services, and the Raspberry Pi.
- Initially, the Android app (based on the Estimote API) is opened and it automatically searches for Estimote Beacons that are in range of the phone. Once, the app recognizes that it is in proximity of a beacon, the application automatically sends a POST request to a secure (HTTPS) website. This POST Request contains the following information: username, password, id of the beacon that's in range, and a true boolean that signifies that the app wants the door. The Server receives this information and it compares the values received to a database that already contains registered users (username, password, and respective beacon id). As an added security measure, the passwords in the database are hashed through Python's Bycrypt module; this ensures that even if someone were to gain access of the database, they wouldn't be able to add themselves since they do not have access to the hash used to encrypt the passwords. Once the server compares the values received from the android app with the values in the database and decides that there is a match, the server will then update the webpage that the Raspberry Pi scrapes information from to notify the Raspberry Pi to unlock the door. Once the Raspberry Pi scrapes the proper information from the website, the Raspberry Pi will activate the servo to unlock the door.
- For Locking the door, a similar process is followed: Once the Android Device is out of range of the Bluetooth Estimote Beacon, the Android app will stop sending unlock requests and then the Server will interpret that as a sign to lock the door. The Server then updates the webpage that the Raspberry Pi scrapes with a string that tells the Raspberry Pi to stop unlocking the door and then lock the door again.
- Detailed Project Description:
- When designing our project, we first identified and outlined the basic modules for the project (briefly introduced above) before continuing on to decide the specific method of accomplishing our goal. The hardware/physical aspect of the module consists of the demonstration door, a deadbolt, a servo, the Raspberry Pi, a 3D printed component, the proximity beacon, and the servo mount. The goal of this project was to design a smart lock that could be attached to any door without the need to replace the existing lock. To do this, we designed a 3D printed component that connects the servo to a lock handle. This piece functions to physically turn the lock as if one's hand were operating the lock. Both the stl file and Fusion360 file for the piece are available below. The other two physical components of the project were the Raspberry Pi and the Estimote Beacon. The Raspberry Pi was used in order to control the movement of the servo and communicate with the AWS server to determine when to lock and unlock the door. Our code for the servo control can be found on our GitHub. The Estimote Beacon served as a sensor of proximity such that our server would know when a user is within 1.25 meters of the door.
- The application (downloaded to an Android phone) was another major part of the project. One of the key pieces of our project was Estimote's proximity beacon which gave us the hardware required to track the movement of a given individual through a hard perimeter of 1.25 meters, however, we needed a way to connect the beacon to AWS. The app solves this issue by creating a proximity zone for the beacon, tracking the movement of the phone in and out of the perimeter, and sending it to AWS. The app uses Estimote SDK as a base template but was modified to include custom beacon attachments, perimeter distance, proximity zone builder and observer, and POST requests to AWS.
- Another vital portion of this project was the implementation of Amazon Web Services. We used several services associated with AWS. Elastic Beanstalk was utilized to initial create an online environment where we could upload Python and Flask files. Elastic Beanstalk allowed for the Raspberry Pi and mobile application to communicate with each other wirelessly. Amazon's Route53 was used to purchase our own domain. A private domain was required for us to secure our connection via HTTPS. Security Certificates were created with Amazon's Certificate Manager. Our Elastic Beanstalk instance consisted of a login database that used bycrypt (Built-in Python security module) hashing and salting for security. Link to our server: https://my-smart-lock.com/?beaconid=0bad1f66ca2237d6f4afe723e2758a3d
- Lock Piece
- Since one of our goals was to create a lock that mounts onto an existing door lock, we needed to create a 3d printed part that could be easily changed to accommodate any lock. For demonstration purposes, we designed a piece that fit with the lock we bought for our project; however, the design file was created such that it would be relatively easy to adjust our design to fit a different lock. The parts seen in the top view (displayed below) can be manipulated to match the dimensions of whatever lock one may want to mount our smart lock to. A download to our stl file as well as a link to the Fusion360 file is below.
- Circuit Diagram
The overall project was a success, and essentially all our goals were accomplished. Our smart lock has full functionality and we are very satisfied with the results. Not only is our proximity sensor working effectively to identify when the user is nearby, but it can also detect the user leave and know when to re-lock the door. Additionally, the servo and the physical lock are move fluidly without any hitches. This part of the project initially had several technical difficulties. However, we were able to overcome all of them. The first issue we struggled with on the servo was that it would vibrate back and forth at the position it was moved to. Not only was this an issue for its ability to move the lock, but it also created an unpleasant noise that would have been unideal for the project. This issue was eventually resolved with a code adjustment. Once this was resolved, we realized the Raspberry Pi could not get the current position of the servo, which was crucial in determining whether or not the door needed to be unlocked. We addressed this issue by implementing a Hall Effect sensor to our project to help determine when the door was in the locked or open position. We attached a magnet to the locking piece glued the sensor onto the door. The sensor input returns a 0 (opened) or 1 (locked), which is used in the conditionals of our servo movement code. Another difficulty of the product was the physical construction, including the circuitry, mount, and connection piece. Both difficulties lied within the design process. Our first design of our servo connection piece involved connecting directly to the deadbolt mechanism. However, this brought up concerns about the strength of the plastic when the force of the servo was applied. As a result, we redesigned the piece to fit around the physical knob that one could lock and unlock the door with. This provided more stability and strength to our piece. The circuitry was initially very weak and the wires broke several times. However, this was resolved by sealing the connection points with hot glue. This prevented the wires from bending at the points at which they were soldered (the weakest section). Designing the mount proved to be a challenge as we had to ensure the mount provided both the precision and stability for turning the deadbolt. Initially, we had intended to have the servo housed within a box along with the Raspberry Pi and the rest of the wiring. This box would have been attached over the door lock. However, we realized the servo provided the necessary stability for the connection piece when pressed directly into the door. This allowed us to create a mount that only had to hold the servo in its specific position. Our mount was designed such that it would hold the servo from 3 sides since the main concern for stability of the servo was with side to side movement.
We successfully met all the goals we set to accomplish, and although our project was a success, the aesthetic of the door was not ideal. The servo mount ended up being slightly bulky, and the rest of our circuitry was either glued or taped onto the door. We accomplished our goal of creating a smart lock that could be attached to any existing door, but If a second iteration of this project were created, slimming the mount and wiring would be one of our priorities. Additionally, we would also implement an extra Hall Effect sensor to place on the door frame so we could detect when the door is closed before re-locking. As of now, the door will re-lock when the user leaves and the lock is in the open position; however, it does this under the assumption the user already closed the door. This means if they forgot to close the door, the deadbolt would come out of the door while it is still open. Adding a second hall effect sensor would allow us to ensure the door only re-locks when the door is actually closed. Lastly, if this were made into an actual product to be sold, we would have multiple pieces available to allow for this lock to be placed onto any existing door. Regarding the server and user interface aspect, we would plan to allow for customers to easily add additional users so that other people such as family members or coworkers could easily access shared doors without having to manually access the server's database. The app's user interface could be modified to facilitate the addition of new users. In addition, the ability of the app to only recognize one lock was far from ideal. In a 2.0 project ideally the app would create more proximity zones that would then allow more beacons to be interfaced into the project.
Presentation Poster: File:SmartLockPoster.pdf
The ethical dilemmas are not particularly prominent with this technology. In our ever-digitizing world, smart technology has been becoming more mainstream over the last several years. That said, there are skeptics of this type of technology that may argue that smart technology poses more threats than benefits due to the possibility of hacking. As a result this project poses more safety/security concerns than it does ethical. The safety and security concerns are further discussed below.
Since our project is the hardware and software behind digitizing a lock, there are obviously large concerns with security. If we are to create an effective and meaningful project, then the software must be as hard to hack into as the deadbolt is to physically force open. Due to this, we have devoted a large part of our project into studying various forms of encryption to help secure the token system. In addition to this, we recognize that a person's phone could be stolen and used to open the lock remotely that way. To counter this, we are looking into securing our app with some form of password protection to block that avenue of approach.
Due to the fact that most of our project is software based, we do not have many safety concerns for the production of it. There may be some small hazards with constructing the circuit-board or deadbolt (burning yourself with the soldering iron etc.), however, we feel that the project generally should be safe to construct and program.