- Overview
- 1.1 ESP8266 Code
- 1.1.1 Requirements
- 1.1.2 Setup
- 1.1.3 Functionality
- 1.2 Telegram-based Access Control System
- 1.2.1 Requirements
- 1.2.2 Setup
- 1.2.3 Functionality
- 1.1 ESP8266 Code
- Usage
- Troubleshooting
- System Flowchart
The Smart Access Control System project comprises two main components: the ESP8266 code for RFID card detection and server communication, and the Python code for a Telegram-based access control system.
1.1 ESP8266 Code
- ESP8266 board
- MFRC522 RFID reader
- 16x2 I2C Liquid Crystal Display
- WiFi connection
- Replace placeholders in the ESP8266 code (
your_wifi_ssid
,your_wifi_password
,your_cloud_server_address
) with your WiFi credentials and server details. - Adjust
buttonPin
,lcd
, andrfidReader
pin configurations based on your hardware setup.
- Detects RFID cards using the MFRC522 reader.
- Sends RFID card data and action (enter/exit) to a server via HTTP POST.
- Displays user messages on the LCD screen based on server responses.
- Supports turning off the LCD backlight after a specified delay.
- Python environment
- Flask web framework
- SQLite database
- Telegram bot token and chat ID
- Install required Python packages:
flask
,python-telegram-bot
. - Replace
your_database.db
with the desired SQLite database filename. - Set
your_telegram_token
andyour_chat_id
with your Telegram bot credentials. - Run the Python script on a server accessible from the ESP8266.
- Manages user data in an SQLite database (name and RFID card).
- Uses a Telegram bot to grant or revoke access.
- Sends notifications to the admin when access is granted or revoked.
- Provides a list of users with access.
- Upload the ESP8266 code to your device.
- Run the Python script on your server.
- Use Telegram commands (
/grant_access
,/revoke_access
,/list_users
) to manage access.
- Check the serial monitor for ESP8266 debugging information.
- Ensure the server is running and accessible.
- Verify Telegram bot credentials and chat ID.
graph TD
subgraph cluster_ESP8266
RFIDCardDetected(RFID Card Detected?)
ServerResponse(Server Response?)
LCDMessage(Display LCD Message)
TurnOffLCD(Turn Off LCD?)
ServerRequest(Send RFID and Action to Server)
AccessGranted(Display Welcome Message on LCD)
AccessDenied(Display Access Denied Message on LCD)
Loop
RFIDCardDetected --> |Yes| ServerRequest
RFIDCardDetected --> |No| Loop
ServerRequest --> ServerResponse
ServerRequest --> |Error| Error
ServerResponse --> |Access Granted| AccessGranted
ServerResponse --> |Access Denied| AccessDenied
AccessGranted --> TurnOffLCD
AccessDenied --> TurnOffLCD
TurnOffLCD --> |Yes| Loop
TurnOffLCD --> |No| Loop
Loop --> RFIDCardDetected
end
subgraph cluster_TelegramBot
UserCommand(User Command Received?)
DatabaseQuery(Query Database)
Notification(Send Notification to Admin)
GrantAccess --> RFIDCheck
RevokeAccess --> RFIDCheck
ListUsers --> DatabaseQuery
RFIDCheck(Check RFID in Database)
AccessUpdate(Update Access)
GrantAccess --> Loop
RevokeAccess --> Loop
ListUsers --> Loop
Loop --> UserCommand
end
subgraph cluster_Common
Error(Error Handling)
Error --> LoopCommon
LoopCommon --> Error
end