This project contains both the server and client code for managing RFID keys through Telegram and an Arduino-based RFID reader.
/
├── client/ # Arduino code (RFID reader client)
├── server/ # Python Flask + Telegram bot server
├── requirements.txt
└── README.md
The server exposes:
- A Telegram Bot for interacting with users.
- A Flask HTTP API to accept key validations or registrations from the client.
-
Install dependencies:
cd server pip install -r ../requirements.txt
-
Configuration:
Create a
configuration.py
insideserver/
with the following content:TELEGRAM_API_KEY = "your-telegram-bot-api-key" known_keys = [] # This will temporarily store registered keys
-
Run the server:
python server.py
The server will:
- Start polling Telegram for messages.
- Listen on HTTP port
5000
for/iskeyvalid
requests.
The client runs on an Arduino equipped with:
- An RFID reader.
- (Optionally) a WiFi/Ethernet module to send HTTP requests.
- When a card is scanned:
- The Arduino sends a GET request to the
/iskeyvalid?id=<CARD_ID>
endpoint. - Based on the server's response:
'g'
➔ Key is known ➔ Access granted.'r'
➔ Key is unknown ➔ Access denied.'a'
➔ Key added (if in key registration mode).
- The Arduino sends a GET request to the
(You can find the Arduino source code inside client/
.)
Once your bot is running, you can use these commands:
/newkey
→ Start a 30-second window to register a new RFID key.
When prompted, scan the RFID card to register it.