My Mechatronics teacher frequently lends equipment to other students, but he doesn't have the time to keep track of who borrowed what. At the same time, student attendance is time-consuming to keep track of, but it's necessary for the school to function. Let's solve two issues at once by using students' RFID-enabled badges to track their attendance and inventory.
The sensor module§
The sensor module is an Espressif ESP32 development kit. I chose this microcontroller because it's cheap, easy to set up, and has built in Wi-Fi. It takes 5V power over the included Micro-USB port, so you can place it anywhere there's an outlet or USB port. The microcontroller is connected to an MFRC522 RFID module.
The sensor module doesn't interact directly with the Firestore database, nor does it know whose ID has been scanned. It simply POSTs the card's data to an API endpoint offered by Firebase Functions. Sensor modules are granted unique API keys, which allows the backend to save the scans to the appropriate logbook, and to reject scans that didn't come from an authenticated sensor.
The backend is built on Firebase. Specifically, we use Firebase Authentication to offer sign-up and sign-in functionality, and Firestore to keep track of scan events, the student roster, and other necessary data for the app to function. We also use Firebase Functions to handle the scanning process.
events table holds one record per scan. It only stores the RFID identifier, not the student identity (to use that data, one must join with
identities). This allows for scans that used unknown or incorrect identities at scan time to be identified later on. The
identities table holds mappings from student RFID identifiers to student information, and is populated using information exported from PowerSchool and from our student ID system. The
logbooks table and
sensors tables are mostly used to join with
sensors is also read on scan to ensure that an event is saved with the appropriate source and logbook data.
These are the tables in Firestore:
|events||data, logbook, source, timestamp|
|identities||cardNumber, firstName, grade, lastName, photo, studentNumber|
|sensors||key, name, assignedLogbook|
The webapp is built with React. We use React Router to manage routing between the marketing pages and app pages, and handle different routes such as the sign-in page, the student roster page, and the logbooks page. Tailwind CSS is used for styling. Other technologies include Sentry for error monitoring and Plausible Analytics for... well, you can guess.
These are the pages available:
|/app/||Main app page|
|/app/onboarding||First sign-in tutorial|
Right now, the app is very limited in scope. Only the attendance tracking feature is developed, and I have moved inventory tracking to the back burner for now. Plans for the future include:
- Greater reliability
- Inventory tracking
- Multi-user support
- Export to PowerSchool