Smart Lock

From ESE205 Wiki
Jump to navigation Jump to search


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.

Project Proposal

Smart Lock Github: [1]


  • 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.
  • 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

Gantt Chart

Gantt Chart


  • 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 with the server to obtain identification
  • Integration of beacon with phone Bluetooth


  • Total
    • $213.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

Work Log

  • Basic Project Outline
    • Hardware:
      • 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).
    • App:
      • Our app will be the main interface for controlling our lock. Additionally, it will also serve as the “key” for the lock. App will be responsible for fetching the generated keys/ tokens from the server and sending them also.
  • Key Features
    • Secure Locking Mechanism
    • Secure Software Encryption
    • Phone Proximity Unlocking
    • Phone Application Interface
  • Design


  • 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. The stl file for the piece is downloadable below, and the Fusion360 file is 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 [INSERT GITHUB LINK HERE Here]. 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.

  • 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.
  • Lock Servo Connection Piece Design

Overview Top View Side View Bottom View

Fusion360 File File:Lock Piece.stl

  • Circuit Diagram

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. [Insert here]

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.

Ethical Issues

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.

Security Issues

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.

Safety Issues

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.