Hi, I’m Will, and I am a rising junior at Menlo School. My interest for engineering is fueled by my passion for cars and airplanes. My main project was an Internet of Things Door Lock using a Raspberry Pi, and my starter project was the Big Time watch kit.
Reflection:
Hi it’s Will. My door lock ended up working well in the end, but, on the way, there were a few issues that confused and annoyed me. One of the most memorable issues for me was the SD card that would have the Raspberry Pi OS on it. It was, in theory, an easy setup process, but I could not get the Raspberry Pi to read the SD card and install the OS on it, and I wasted 3 days trying to format the card and everything. In the end, after reading through all of the forums on the Raspberry Pi website and tech blogs, I decided to watch a YouTube video of Raspberry Pi setup, and only then did I find that the files on the SD card needed to be out of the folder that the Raspberry Pi OS downloaded in. It was annoying but when the raspberry pi was working I was relieved and happy. Coding was also an issue, but that was an issue that was more from being new to coding in general. As I spent time over the six weeks of the program learning about and working with the Raspberry Pi, I did become more fluent in the operation and usage of it, and now, although I am no developer pro or anything, I can understand a lot of different aspects of the Pi’s abilities. The fact that I have a lock that I can control with my phone is shocking to me, and I never thought that somebody with no programming experience would be able to make one in 20 or so afternoons. I don’t know how secure it is, but it works and I think that it is pretty efficient. One of the best and worst experiences for me during the program was not working off of a website to make my project. The inspiration was there, but the website that I was working off of had no documentation that was meaningful, so I went off on my own path. Doing my own thing allowed me to learn more and get out of the experience as a whole. Through the 6 weeks that I spent working on this, I gained respect for computer science and electrical engineering because it’s amazing how much you can do with a forty dollar computer. I, however, will continue to believe in the superiority of mechanical engineering because frankly, mechanical engineers have the cool jobs making things like cars and airplanes.
Final Version:
Hi, I’m Will, and this is the final variation of my Internet of Things door lock. Since milestone 2, there have been lots of refinements to the lock usage, all of which are very beneficial. Below in milestone 2, I was turning the bolt by opening a python shell in a secure shell (ssh), which is one form of remote connection to a computer or device, and entering the code line by line to get the servo to turn the bolt. Obviously there was room for improvement upon that method, which takes a couple hundred taps on the phone screen to get the lock open. To pare down that process I decided that I was going to try to write a web app, which would decrease the taping to getting into the phone, opening Safari, typing in the address for the app, then pressing the button to unlock the door, which would have been approximately 35 taps or so. I tried to write the web app, and I ended up with a black webpage with “Door lock” in white text. The theory was that, by clicking or tapping on the “Door lock” button, a request would be sent through the cloud to the Raspberry Pi, which would then open the lock then 30 seconds later close it. That unfortunately didn’t work out often, and being the programming novice that I am, I would have run out of time, and been stuck with the ssh method from milestone 2 for my final. However, as a result of wasting plenty of time at the beginning of the program trying to figure out the basics of the Raspberry Pi, I was able to figure out the method that I am using right now, which I believe is the most efficient. My current method is to control the Raspberry Pi using Virtual Network Computing (VNC). The Raspberry Pi, when mounted on a lock, always has to be on to be ready to open the lock for me, so I can open up a VNC server on it, and that will stay up for me to connect to whenever, as long as the Raspberry Pi doesn’t lose power. I can also leave the file with the code to open the lock open on the Raspberry Pi, which makes it easier to run. All I need to do to open the lock, from anywhere, is open my phone which takes four taps (or 1 for touch ID), open the Weaved app and press on “VNC-Pi” (2 more taps), and then, once I am connected over VNC, press “run” and then “run module” on the python file (2 more taps), which runs the code, opening the lock. Using that process, I can open the lock in 8 (or 5) taps*, which takes 20-25 seconds. 20-25 seconds is probably how long it takes me to open regular lock including getting the key out of my pocket, so I think my method is really good. On the actual hardware, I just did some tinkering and beautification. I screwed down the Raspberry Pi, and I screwed down the battery pack, which is not present in the video. The battery pack, however, offered an opportunity for me to do something hands-on during a time in which I was messing around with the web app code and not much else. I am not using the battery pack because it was a bit of dud, and I think it was broken or maybe just underpowered, but that’s why there are those four screws doing nothing on the one side of the servo. That’s it for the project as of now, but I may try to revisit the web app in the future and see if I can get that to work.
* It actually takes 17 taps (or 14) on the first time you try to get in after every time the Raspberry Pi boots up because there is an 8 character authentication for the first time you try to get into the VNC viewer.
Documentation:
All the materials + Software I used:
https://docs.google.com/spreadsheets/d/1QnyWYDUWFJeKkMx9iPwabe6jbwZgs1H3zJIDZeVkuaQ/edit?usp=sharing
The schematic for the final product:
The link for the lock turning code (unlock, wait 30 seconds, lock):
https://docs.google.com/document/d/1EqbTOxtYkonkywSAp_ZWwy8Kwm1BwF06D6ltPmoZO8Q/edit?usp=sharing
Here are the manufacturing drawings for the wood:
Servo-lock interface piece drawing:
Milestone # 2:
I recently completed my second milestone. My second milestone was very vaguely stated on my build plan as controlling the lock with my phone. To get from where I was at milestone 1 to my current prototype, I, on the mechanical side, mounted my servo on my lock and milled a few acrylic pieces as special servo plates that could turn the lock rod. On the computer science side, I installed a cloud service called Weaved on my ssh port on my Raspberry Pi, which enables me to make an ssh connection from any network to my Raspberry Pi. The Weaved software gives the Raspberry Pi an address that can be accessed from anywhere, for the address is not associated with any specific network or router. Weaved then has an app that allows me to get that address and open it in an ssh app, which then enables me to make an ssh from anywhere and enter the code to open the lock. After some experimenting, I discovered that the pulse widths for locking and unlocking are 5.75 and 9 milliseconds, which allows me to make the operation smoother because I don’t try to turn the servo further than the lock allows. As far as security goes, I will probably look into what I can do with that as I begin writing my web app, but for now the security is not something that I am focused on. In the video below my phone was on LTE rather than the wi-fi, which validates that the connection can be achieved from a long range. Electrically nothing has changed from the setup I used in milestone #1 to move the servo. My lead up into this milestone was smooth except for one huge issue with the Raspberry Pi. The issue that arose was a mystery to me but I simply reinstalled the Raspberry Pi OS and everything was fixed which allowed me to easily complete my prototype. I am still looking to add a separate power supply for the servo so that I am not powering it off of the Pi’s GPIO board, which should make whole system run more smoothly, and I am, as mentioned earlier, looking to make a web app for 1 tap unlocking to replace the process that is writing out all of the code every time I want to do anything with the lock.
Milestone #1:
I’m Will, and I completed my first milestone. My first milestone was to write some simple code to move a servo and mount my lock inside of a piece wood to simulate a door. I encountered some setbacks in reaching this first milestone including a knot in the wood that I had to file out, which was very tedious, an error in putting the Raspberry Pi OS on an SD card, which I slipped out of by breaking the files out of a folder which I was unaware of, and a bunch of issues with controlling the Raspberry Pi remotely, which I got sick of, causing me to use a monitor, mouse, and keyboard directly connected to the Pi. Along with my problems, I was compelled to learn things like manufacturing drawings and dimensioning to make my “door”, and the basics of the Linux OS to use the Raspberry Pi. Other things that were more necessary to learn were parts of the Raspberry Pi like the GPIO pins and the meanings of the LEDs on it. The LEDS on the Pi are not very interesting, although very helpful in using it, but the GPIO pins and their purpose was much more interesting for me. The General Purpose Input/Output pins can control things like servos using pulse width modulation which sends pulses to certain pins to give instructions. The servo that I am using is controlled with a 50 Hz frequency which means there are 20 millisecond periods, and within the 20 millisecond periods, pulses can be sent to change the the position of the servo. The servo brings up another problem which is the fact that powering the servo off of the 5V GPIO pin is somewhat sketchy, so I am going to need to find some sort of external power supply to power the servo with. There are not many other topics to discuss; the next steps for me, however, will be to finish the mechanical connections, and learn about the cloud so that I can write the code to control the lock with my phone.
Starter Project:
I’m Will and I am going to be a junior next year. I built the big time watch for my starter project. It was a smooth experience, for I encountered only one slight issue in soldering the crystal in, which was easily fixed by soldering it again. When building it, I learned about the functionality of various parts in the watch, like the 32kHz crystal, which is responsible for counting seconds to keep the time moving after being set, and the capacitors, which store charge and release it in order to improve the smoothness in the operation of the circuits in the watch. In addition, I learned that components in small electronics, like the LED display in the watch, run on really small currents, necessitating things like 10 kilo ohm resistors, like the one in the watch. The other components of the watch are a button, which closes a circuit and causes the microprocessor to order to watch to carry out various tasks, depending on how long the button is pressed, and the microprocessor that takes in all of the information from the other components to determine the time and when to show it.