IoT Door Lock

My project is the internet of things door lock. Using an app I built on my phone, I can control a door lock to open and close.


Clement O.

Area of Interest

Computer Science


Gunn High School


Incoming Junior

Final Milestone

Final Milestone Explanation

My final milestone was adding fingerprint authentication for my app. At first I followed this tutorial, which worked well, for the most part. Since fingerprints are now a built in part of Android, the app has to generate a key to use the device-registered fingeprints. To do this it uses the built in java class keygenerator. It also has to generate a cipher for further authentication. However, with the way this tutorial works, it changes the main “activity” or screen to become the fingerprint authentication area, which does not work well with the way I wanted to activate the lock.

To get around this, I followed another tutorial, which created a “dialog” or popup to let the user know to authenticate. The challenge with this was getting it to work with my existing ui, since I wanted to use it to activate a switch. I modified the tutorial code to remove its setting and purchase activities and also so that the fingerprint dialog was connected to my switch. Doing this, I learned more about how activities work and about the Android fingerprint API.

Final Materials

My Code

Final Bill of Materials

Final Build Plan

Aashrav and I helped each other

Second Milestone

Second Milestone Explanation

In my second milestone I built an app to connect to the Raspberry Pi. To do this I used android studio. I made a simple design with three buttons to open, close, and open then close the lock. They interacted with the lock using jsch (java secure channel), a java implementation of ssh (secure shell, a network protocol for computers to communicate with each other). By pressing the buttons, the app would pass an ssh signal to the Pi to run the python scripts which would perform the selected action. To do this I created an “SSHManager” class that would create an instance of the jsch object.

I soon found out that in Android, you cannot run network tasks inside of the main activity, so I had to make it so that it would run the ssh tasks in an asynchronous task (AsyncTask). After I did this, I decided to change the buttons into a switch, to declutter the UI (User Interface). This way, when the switch was set to on, the lock would be locked, and off would be unlocked.

First Milestone

First Milestone Explanation

My first milestone was connecting and controlling the servo with the Raspberry Pi. Initially, I read the pin-out diagram upside down, so my servo connection did not work. I also found out that my servo was broken, so I had to get another one. Also, my Raspberry Pi’s 5V pin was not enough to power the servo, so I had to get a breakout board and an external battery. Eventually I connected my servo with a breadboard and the breakout board. The breakout board connected to the breadboard to power the servo and the servo connected to the Raspberry Pi to be controlled.

The next step was connecting the servo to the lock. First, I dremelled off a piece of a piece of the lock shaft to make room for the servo. Then, to connect the servo to the shaft, I dremelled a servo attachment to have a slot for the shaft and to fit in the lock. Then I glued the attachment to the shaft and servo and the servo to the outside of the lock.

Then I needed to build a python script to control the servo. To control the servo, the Raspberry Pi uses PWM, or pulse width modulation. This eseentially sends signals from digital devices at At first I used RPI.GPIO for PWM, but I found out that it twitched the servo and made it heat up. Then I switched to pigpio, which did not twitch the servo. To test the servo, I used a script I found in a guide, which made a gui to control servo angle. Using this, I found how far I needed to move the servo to open and close the lock.

Starter Project

Starter Project Explanation

My starter project was the Minty Boost, which uses AA batteries to charge USB devices. The Minty Boost uses a boost converter to boost the voltage of the AA batteries, and an inductor to maintain the current. The boost converter boosts voltage but lowers current, so the inductor stores power to maintain the current at a constant level. It also uses capacitors to reduce noise and store potential energy and resistors to regulate current. A diode is used to make the current one-way. In this project, I learned how to solder, and about the different electrical components I used.

Leave a Comment

Start typing and press Enter to search