Close
0%
0%

The ULTIMATE Raspberry Pi Smart Home Door Lock

It's got 3-factor authentication including NFC fob, touchscreen PIN entry and one-time passcode sent via SMS - then the door unlocks!

Similar projects worth following
In this DIY Gadget build, we’ll be building a secure door entry system using a Raspberry Pi.

You already may be familiar with two-factor authentication for logging into secure systems like your online banking or your Facebook or email accounts. This door entry system goes one step further and uses THREE factor authentication. To unlock the door, you require;

1. An RFID keyfob
2. A 6-digit PIN
3. A random one-time access code which is generated and sent as a text to your phone.

Since two of the 'factors' are "something you have", this isn't quite strictly true "three factor" authentication. The code is easily modifiable, however, so you could add a "something you are", such as a fingerprint reader or retina scanner, if you want!

Watch an in-depth video tutorial on YouTube at https://www.youtube.com/watch?v=T

To build this project for yourself, you will need…

You’ll also need a few tools, so make sure you’ve got all of the following before you get started:

  • 1
    Watch an In-Depth Video Tutorial
  • 2
    Install and Configure the LCD Touchscreen for the Raspberry Pi

    The very first thing we need to do is get our LCD touchscreen working. Depending on which model you purchase for your build, it may just come with drivers to install or it may come with its own Operating System image for you to write to your Raspberry Pi’s SD card. That’s the case with my one, so I need to use Win32 Disk Imager to write the image to my SD card. Make sure you select the correct device to write to, so you don’t accidentally erase any external hard drives!

    Once that’s complete, pop the microSD card back into the Raspberry Pi and fit the LCD to the GPIO ports like this, starting at the top end which is by the SD card slot and away from the USB and ethernet ports. Next, take the microUSB power lead and plug it in to boot up the Rapsberry Pi to confirm that the screen – and the touchscreen element of it – are working correctly.

    As you’d expect, the orientation of the display is in landscape as standard, but for our virtual keypad we want the display to be portrait so we need to change some config files to achieve this. With your Raspberry Pi connected to your network either via WiFi or an Ethernet cable, shell into it and open up the config.txt file inside the boot directory:

    $ sudo nano /boot/config.txt

    This file determines the orientation of the display. We’re looking for the line towards the bottom which contains “dtoverlay=waveshare35a” and to that we’re going to add a semicolon followed by “rotate=180”. Save and exit.

    Next, we need to rotate the touchscreen to match the display, so we need to open up the “99 calibration” config file:

    $ sudo nano /etc/X11/xorg.conf.d/99-calibration.conf

    Inside this config file, we first need to change the SwapAxis option from one to zero, and then enter in the following base values for the Calibration options. Once you’ve done that, Save and Exit. Then, you can reboot your Pi, and once it boots back up your display should be rotated to portrait.

  • 3
    Install MySQL Database & Apache Web Server on the Raspberry Pi

    Whilst we’re in the shell, now’s as good a time as any to install the database, which will hold the access control list for our door entry system, as well as record a log of all successful and unsuccessful access attempts. We’ll install a full LAMP stack so that we can use phpMyAdmin to access the database, and this also means you can create your own web interface using PHP to add and delete users to the system easily in the future.

    First off, we’ll install the Apache web server with this command:

    $ sudo apt-get update
    $ sudo apt-get install apache2

    Once that’s set up, we’ll install PHP, and then MySQL.

    $ sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
    $ sudo apt-get install mysql-server

    As part of the MySQL server installation process it’ll ask you for a nice secure password for the “root” user, so enter one in and make sure you don’t forget it.

    Finally, once MySQL is installed we’ll restart Apache and then install phpMyAdmin.

    $ sudo service apache2 restart
    $ sudo apt-get install phpmyadmin php-mbstring php-gettext

    As part of the installation process it’ll ask us which webserver we want to configure to use it, so make sure Apache is selected and select OK. We’ll allow phpMyAdmin to install and configure its own database automatically, and then enter the root password we chose when install MySQL to allow phpMyAdmin to create its own database and user. Next, we’ll create a secure password for that user.

    Once that’s installed you can type your Pi’s IP address in your web browser, followed by “/phpmyadmin” and then login with the root account you created when installing MySQL.

View all 14 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates