Software apps and online services
Living with 3 younger siblings, I oftentimes wish I could keep all my belongings in one huge safe. Over the years I have been subjected to borrowed food, phone chargers, school supplies, socks, you name it. With this project, I was inspired to create a security system that even the most cunning little brother couldn't break into.
The project itself is a prototype security system that implements three sequential levels of security centered around BeagleBoard's PocketBeagle microcontroller. The first two layers of security are hardcoded into the code of the project itself, making the correct combination impossible to change for anyone other than the owner. The third security measure is a number that is randomly generated and sent via SMS to the user's phone (who's number is also hardcoded into the data).
The first layer of security the owner must face is the 3-dial indicator lock. Inspired by classic locker combinations, this lock uses three turn potentiometers to simulate the 3 different possible positions of a locker lock. The user turns the dials to a combination and then presses the enter button.
The second layer of security is a pattern lock using 3 simple push buttons. The user inputs a "pattern" by pressing the 3 buttons in a set four-touch pattern and then pressing the enter button.
The third and most rigorous form of security is a keypad inspired lock with a 5-digit password. The lock uses 10 small buttons, labeled 0 - 9. Before entering in a password with the buttons, however, the user presses another button to send a randomized 5-digit password to a set phone number via text using the Twilio SMS Messaging API. Note that the password (and subsequent message) is regenerated each time the program is run! When the user receives the password on their phone, they can then successfully enter it via the keypad buttons.
As the user inputs all 3 password combinations, they are then to press the designated "enter" buttons, which trigger either a flash of a red light to indicate an incorrect password or a continuous green light to indicate a correct one. The green light also indicates to the user that they can move on to the next layer of security.
When the user has passed all 3 layers of security, an output signal is sent by the PocketBeagle to unlock the safe!
A video of the whole process is shown below:
The wiring for the project is as follows:
The wiring of this project looks much more complex than it really is. With the exception of the potentiometers, all components use standard GPIO pins on the PocketBeagle. The table below is included for reference:
All components are assembled on 3 main solderless breadboards, with no special considerations needed. Power is provided through the PocketBeagle from an attached computer.
In order to accomplish the most ambitious portion of this project, sending an SMS message via PocketBeagle's python language, I chose to use the Twilio API. With this API, it is possible to send SMS via python and many other languages. To do this, however, the user of this system must sign up for a Twilio account in order to use their servers. Then, the user must purchase a phone number. This costs a small amount per month -- in my case, I chose to use a free trial of the service, hence why the SMS sent is prefaced with "Sent from your Twilio trial account". Instructions for using the API to send SMS via python can be found here: https://www.twilio.com/docs/sms/tutorials/how-to-send-sms-messages-python
To operate this project:
- Sign up for Twilio Account (A free trial is sufficient)
- Setup account and get an assigned phone number
- Substitute your account information and numbers into provided code
- Run the provided shell script to configure pins and run main python code
- Enter passwords one by one, pressing enter after each attempt. A red light means "try again" while a green light indicates that you can move on to the next layer of security
- When all three lights are green, you've successfully opened the safe
Unfortunately, due to the scope of this project, not all goals were met. Most notably, the lock-style solenoid could not be successfully implemented due to its high voltage requirements. A walkthrough of how to wire the needed solenoid is shown here: https://www.adafruit.com/product/1512
Additionally, the physical casing of the system is a logical next step for this project. A security system is only successful if it secures something, after all. Ideally, a wood (or similar) prototype could be constructed to hold the PocketBeagle and all wiring in a secure sub-container, while all necessary locks are prominently displayed on the face of the safe. A final product constructed out of stainless steel or similar could then be constructed. And, of course, the above lock solenoid could physically restrict the opening of the safe.
Finally, the PocketBeagle could be given an external power source so that it and all necessary powered components could be powered independently of a computer USB connection. Along with this, a USB-wifi connection could be set up so that the Beagle can send the SMS message without being tethered to a computer's internet connection. Instructions can be found here: https://www.teachmemicro.com/pocketbeagle-wifi/