This is a system running on Raspberry Pi that helps to record at what exact time each student has taken his meal. It uses personal RFID tags as user identifiers.
- Raspberry Pi 3B+
- RDM6300 RFID Reader - 125kHz
- RFID wrist tags - 125kHz
- Python as main project language
- Google Sheets API as data storage
- I'd personally use MySQL for these purposes, but all school data is stored in Google Sheets API - @andrewyazura
- RDM6300 sensor library
ENVIRONMENTDEVELOPMENT- app will use.env.devPRODUCTION- app will use.env
- Create a new Google Cloud Platform (or use an existing one) project. Enable Google Sheets API and create a service account for this device. Read this manual on how to get it: Creating a service account. Next, download a
JSONkey for that service account. - Create a Google Sheets document where your data will be stored.
- Give your service account access to the document. Just copy email address of service
- Insert data into
.envfile- Copy example from
.env.example - Set
DOCUMENT_IDto ID of a document you created - Set
SERVICE_ACCOUNTto a path toJSONkey you downloaded
- Copy example from
Follow this steps:
- Go to Credentials tab
- Open Manage service accounts link
- It's located near Service Accounts list
- Find the service account you need.
- Press Actions button (three dots) and choose
Create key - Choose
JSONand pressCreate
Copy this example: link.
If for some reason the link isn't working, here is how table looks:
| IDs | Users | Records | ||
|---|---|---|---|---|
| 1 | user1 | --- | 1970/01/01 00:00:00 | |
| 2 | user2 | --- | 1970/01/01 00:00:00 | 1970/01/01 00:00:00 |
| 3 | user3 | --- | ||
| 4 | user4 | --- | 1970/01/01 00:00:00 |
New records are appended into user's row. Record only has date and time of the request.
Run sudo raspi-config. Select Interfacing Options / Serial then disable Serial console and enable Serial hardware. Now use /dev/serial0 in any code which accesses the Serial Port.
If given instructions didn't work, try using this tutorial: link.
You can use mealtracker.service that is provided in the repostitory or write your own unit. If you're using the existing one, you have to:
- Enter path to your project in specified placed
- Enter name of the user you're going to use
- On the Raspberry Pi it's most probably
piuser.
- On the Raspberry Pi it's most probably
- Copy the unit file to
/etc/systemd/system/
Now the service is accessible over sudo systemctl command.
Remember to stop the service before using
input.py
sudo systemctl start mealtracker.service - start the service
sudo systemctl stop mealtracker.service - stop the service
sudo systemctl status mealtracker.service - check status of the service
Here is a link to official Raspberry Pi documentation on writing services: link