RFID Reader messaging and processing for Raffy.
-
Raspbian 10 (buster)
-
Git
sudo apt-get install -y git
- Python 3
sudo apt-get install -y python3 python3-pip python3-gpiozero
- Dependencies
sudo pip3 install spidev mfrc522
Clone the repository:
git clone https://github.com/net-shell/raffy-reader.git /home/pi/raffy-reader
The Python scripts that read the RFID tags are using a non-existent domain raffy-admin
to target the server that will process the activity.
In order to resolve this domain properly, add the IP address of the server either in local network or the internet.
# /etc/hosts
raffy-admin 192.168.0.100 # The IP where raffy-admin is running
Run sudo crontab -e
. Add the following line at the end, write changes and exit the editor.
*/5 * * * * /home/pi/raffy-reader/run.sh >> /home/pi/logs/run.log
- Create a service
sudo systemctl edit --force --full raffy-start.service
- Enter the following contents:
[Unit]
Description=Raffy Start
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/raffy-reader
ExecStart=/home/pi/raffy-reader/start-reader.sh
[Install]
WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl enable raffy-start.service
sudo systemctl start raffy-start.service
- Reboot
sudo systemctl reboot