This project aims to turn assets such as physical spaces into services using Internet of Things. The use case chosen is a studio that can be used for different activities such as dance/yoga/pilates classes, photoshoots or workshops. The purpose of the project is to automate the workflow of accessing such assets in order to easily expose it to the public without the need of a constant human supervision. By implementing this system an owner of a space can reduce time and money while also keep the quality of the services provided.
A person who owns a space and wants to monetize it has to invest time and resources in managing it. This might include activities like scheduling the appointments, access and reception of clients, managing infotainment of the studio and assure the space is well-maintained and clean. In other words the owner needs to invest:
The suggested solution is an ecosystem composed of several modules that are meant to function together in order automate the workflow of an appointment. The architecture is separated in 5 modules: access control and check-in, infotainment, cloud, application and cleaning. Each module tackle a certain task. For reservations and check-in, the straightforward approach is to create a web application. The users authenticate inside the app, book an interval and then receive a QR for access. The booking table is safely stored on a cloud server and is accessible by any user that has the application. The QR code is used later for both studio access and check-in. After successfully scanning the code, the user is authenticated inside the studio via the cloud communication and has access to the studio infotainment.
The complexity of the system necessitates a phased approach, thus the objective of this project is to develop a Minimum Viable Product (MVP) that incorporates the access control and the check-in module.
The user interacts with the website and creates an appointments. The platform generates a QR code and sends it to the user by email. The data of the appointment is kept in the firebase database and it’s accessible by the lock module of the studio. The lock in this case is represented by the ESP32-CAM module. When the user arrives at the location and scans the QR code, the lock module checks if the scheduled appointed matches the time and the QR code provided and opens the door. The user is allowed to enter the room.
Hardware
Software
The authentication system
The authentication logic is build on the Django framework default implementation (which is also used in the admin panel that is automatically generated by Django at project creation). The default User model has been modified to use the email address as the username and some new features, such as the phone field, have been added. There are field validators both on frontend and backend that check the integrity of data. For the frontend validators, the fields phone and email are checked to respect the specific format while the password is checked against good practices from strong passwords. In the backend, the email and phone fields are checked for uniqueness.
The communication between Django and Vue
As Vue is a framework for single-page applications, it can be used to mount the components directly into the Django template. This may be done by setting up Vue to save the builded Javascript files in a place where Django can access and use them as needed. As a result, the output path for the build files has been configured inside vue.config.js of the Vue project. While in Django, settings.py is where the static files choices are specified. Ultimately, Django can serve the Vue components with no issues.
The QR generation
The qr codes are generated by the qrcode library using the time string corresponding to the booked interval. The image of the QR is saved on the server while the path to the file is saved in the reservation object. The existing method of producing QR codes from the time string both a current drawback and a potential future enhancement in that anyone could fake the QRs because they are easy to reverse and recreate. The QR codes should contain something unique that cannot be guessed by a possible attacker.
The booking table
The vue-meeting-selector library is used to implement the reservation table. The booking intervals are set to last an hour, and the table is modified to show the entire week. The reservations are saved in the database as ISO-8601 formatted date strings which are guaranteed to be unique.
ESP32 code
The ESP32 connects to a wi-fi network at startup and sends a request to time server to get the current time. Then it authentificates to the Firebase Realtime Database and starts the QR reader process. When the reader recognize a QR, it starts a validation sequence by connecting to the database and checking to see if the data is valid, if the QR is valid, a meesage is printed on the console. The biggest challenge of the code implementation on the ESP32 was the timezone syncronization and time in general.
There are multiple improvements that can be done to the system but some future steps would be: