Safe Deposit Box with two-factor authentication


The Internet of Things is mostly about bringing Things to The Internet, but it’s also about bringing The Internet to Things. Two-Factor Authentication (2FA) has been offered by mission critical services websites like bank accounts or Bitcoin wallets for some time now, providing an additional layer of security beyond just a password. Since is all about crossing the gap between the internet and the real world we decided to put this concept into action by building a safe-deposit box that requires 2FA to deposit box with two factor authentication

By combining with Twilio’s Authy, we got to do this with a very simple deployment system —git push resin master— and a very easy way to add the 2FA mechanism.

Safes and lockers are usually opened by a key or by tapping in a code on a numeric keypad. We’ve come up with an alternative approach that combines a numeric code with an SMS sent via Authy to the user’s phone, which means that opening the safe involves having both the code and the mobile phone.


We used a Raspberry Pi 2 and a little circuit on a protoboard. The lock itself is a 5V solenoid.

The Pi runs a node.js server which performs authentication via a simple web interface. We use Authy to provide the 2nd factor authentication and to allow ultra-simple code deployment.

The procedure to lock and unlock the safe is as follows:-

  • The user inputs their email.
  • If it’s a new user, they’re asked for a phone number.
  • The UI asks for the user’s code to lock the safe.
  • When the code is inputted by the user, the lock is engaged.

Once this is done, to open the safe:-

  • First, the user has to input the correct code.
  • After inputting the code, Authy sends an SMS to the user.
  • The user inputs the SMS code, and the lock opens.
  • The lock only opens for a few seconds, but it can be opened again by pressing the ‘Open’ button on the UI.

When you use the UI on your phone, you’ll usually be able to input the SMS code when it arrives as it will appear in your phone’s notification area.

And this is what the unique experience of opening our safe looks like:-

Source codeBlog post

Build instructions

The hardware

The circuit schematic for the solenoid driver looks like this:-schematic safe deposit box with two factor authentication

(You can also find it on Upverter)

And this is how we assembled the solenoid driver on the protoboard:-

The software

the Raspberry Pi runs a node.js server which implements a multi-step authentication mechanism, in order to achieve this we designed a state-machine using machina.js served up over HTTP via express.js. Most of the interaction operates over, to provide real time feedback to the user.

For more detail: Safe Deposit Box with two-factor authentication

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top