Introduction: Secure Sharp: a Multi-factor Authentication Security System

Secure Sharp is a Multi-factor Authentication Security System. This project is made as part of a course of the Bachelors degree Multimedia and Creative Technologies @ Howest Kortrijk.


Secure Sharp consists of 4 electronic authentification methods

  1. Username
  2. RFID
  3. Fingerprint
  4. Email verification code


The system is connected to its own website and dashboard. There user can be viewed, deleted and added, so they can access whatever you choose to secure.

If you have any questions or tips, feel free to contact me here!


Secure Sharp GitHub repository

Supplies

Electronics:

  • Raspberry Pi
  • Arduino
  • MicroSD Card (at least 8GB)
  • LCD-display
  • Servo-motor
  • RFID-reader
  • Fingerprint-sensor
  • PIR Motion-sensor
  • 10K Potentiometer
  • Wires
  • Breadbord



Attached below is the full bill of materials.

Step 1: Schematics

All schematics were made using Fritzing.

The colors used in the schematics are:

  • Red = 5V
  • Orange = 3.3V
  • Black = GND
  • Separate color = each device


Once you have acquired all the components, you can connect these to each other.

Follow the schematic closely and make sure you connect the components to the correct GPIO-pins of the Raspberry Pi and the correct Arduino-pins. This way you will avoid problems if you want to use the code mentioned below.

Make sure all components use the 3.3V and 5V from an outside power source and not the Raspberry Pi. This way you avoid damaging components and the Pi.


Below are the schematics in .pdf format if you want a closer look.

Step 2: Database

Data from the devices and user-data will be stored in a SQL database (MariaDB).


Device

Here will details of all devices be stored, such as name, brand, description, etc.

Historiek (History)

Here will all the history data of all devices including value and time be stored.

Acties (Action)

These are all the actions that are stored which will be used in the aforementioned History table.

Bezoekers (Users)

All user-data, such as name, RFID, fingerprint-ID, email, etc. will be stored in this table.

Make sure to comply with all GDPR regulations (or your regional regulations in connection to privacy) when storing personal data.

Bezoekerslog (Userlog)

When a user tries to get access, their attempt (and whether they gained access) will be stored in the userlog. As well as the time and date of this attempt.

Step 3: Getting the Raspberry Pi Ready

ore we can begin to program, we will have to configure the Raspberry Pi.


1) Raspberry Pi OS.

Go to Raspberry Pi OS and download the image --> (Raspberry Pi OS with desktop). This may take a while.

2) Writing image to SD Card:

When the OS is finished downloading, you can write the image to your sd card with (recommend 8 or 16GB) Win32 Disk Imager.

3) Insert SD card in the Pi and First connection

Make a first Putty SSH-connection with the PI to get access.

4) Basic configuration

Enable I2C and SPI:

sudo raspi-config


5) Adding WiFi.

Adding a wifi network.

sudo wpa_passphrase 'Networkname' 'Password' >> /etc/wpa_supplicant wpa_supplicant.conf


Reload your wireless network card in the PI.

wpa_cli -i wlan0 reconfigure


6) Installing packages and libraries for python:

Stay up to date

sudo apt update
sudo apt upgrade


Install packages and libraries

sudo pip install flask-cors
sudo pip install flask-socketio
sudo pip install simple-websocket
sudo pip install mysql-connector-python
sudo pip install gevent
sudo pip install gevent-websocket
sudo pip install selenium
sudo apt install chromium-chromedriver
sudo apt install python3-dev python3-pip
sudo pip3 install mfrc522
sudo pip3 install spidev
sudo pip3 install smtplib


Reboot the Pi.

sudo reboot


7) Installing Apache and the MariaDB server:

sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation
sudo apt install apache2


8) Automatically running the script on startup:

sudo systemctl enable myproject.service

Step 4: Backend

The backend is fully programmed in Python (Raspberry Pi) and C++ (Arduino).

If you want to make any changes, you can do so using Visual Studio Code or the Arduino IDE. Here is a Tutorial to remotely connect to Raspberry Pi using the VSCode Remote SSH.


Routes (API)

Data from the database will be put in routes so it can be retrieved by the frontend.

Socket.io

Socket.io allows the transmission of live data to the web page without refreshing.

Threading

Threading is used to run multiple tasks at the same time in parallel.


Set the database credentials in config.py (user, password and database) to take care of the connection with the database.


Arduino

The Arduino code will have to be uploaded separately to the Arduino.

Step 5: Frontend

The frontend is fully programmed in html css and javascript.


Unlock

Secure sharp is a multi-factor authentication security system. This means that it uses multiple electronic authentification methods (4 in this case).


1) Username

First the user will have to enter a valid username (these are comprised of a users name and surname <namesurname>

2) RFID

When a valid username is entered, the user will have to scan his personal RFID-badge.

3) Fingerprint

After scanning a valid RFID-badge, the user will have to scan his fingerprint.

4) Verification code

Finally, when all previous steps are successful, the user will have to enter his one-time use verification code which will automatically be send when step 3) Fingerprint is successful.


Dashboard

In the dashboard you can see all users and their user-data. The userlog is also shown and old data (14 days old) is automatically deleted. (this can be changed in DataRepository.py).

Next to retrieving and displaying data, there is also an possibility to delete and add users.