Smart QR Code Attendance System ๐ฅ using ESP32-CAM and Python (Auto Google Sheet Update) ๐
Introduction
Smart QR Code Attendance System ๐ฅ using ESP32-CAM and Python (Auto Google Sheet Update) ๐

Introduction
Manual attendance systems are still widely used in schools, colleges, and offices. However, they are time-consuming, prone to human error, and allow proxy attendance. Maintaining records manually also becomes difficult over time. To solve these problems, we can build a Smart QR Code Attendance System using the ESP32-CAM module and Python.
This system scans a studentโs QR code using ESP32-CAM, processes it with Python, and automatically updates attendance in Google Sheets along with date and time. The entire process is wireless, automated, and requires very low-cost hardware.
https://youtube.com/shorts/fMEnT9MKLDg
Benefits of this System
- Low-cost hardware setup
- Fully wireless operation
- Contactless attendance
- Real-time Google Sheet update
- Duplicate attendance prevention
- Easy to scale for large classrooms
Project Overview
The system works in a simple pipeline:
- ESP32-CAM captures live video and streams it over WiFi
- Python script reads the live stream
- QR codes are detected using computer vision
- Student ID is extracted from the QR
- Data is sent to Google Apps Script
- Google Sheet updates automatically with timestamp
- Duplicate attendance is prevented for the same session
This makes the entire attendance process fully automated and reliable.
Components Required
To build this project, you only need a few components:
- ESP32-CAM Module
- ESP32-CAM Development Board (for uploading code)
- USB Cable (for code upload)
- WiFi connection
- Laptop with Python installed
This makes it an ideal beginner-friendly IoT + AI project.

Step 1: Generate QR Codes for Students
Each student needs a unique QR code containing their ID. These QR codes will be scanned by the camera to mark attendance.
Python Code to Generate QR Codes (Snippet)
import qrcode
students = {
"S01": "Rahul",
"S02": "Amit",
"S03": "Priya"
}
for sid, name in students.items():
img = qrcode.make(sid)
img.save(f"{sid}_{name}.png")
This script will generate QR code images for each student. You can print these QR codes and distribute them.
Example output:
- S01_Rahul.png
- S02_Amit.png
- S03_Priya.png
Step 2: Setup Google Sheet
Create a new Google Sheet to store attendance. Add the following columns:
| ID | Name | Date | Time |
You can also optionally add:
- Department
- Subject
- Status
This sheet will automatically populate when QR codes are scanned.
Step 3: Setup Google Apps Script
Google Apps Script acts as a bridge between Python and Google Sheets.
Steps
- Open Google Sheet
- Click Extensions โ Apps Script
- Delete default code
- Paste the following snippet
function doGet(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var id = e.parameter.id;
var date = new Date();
sheet.appendRow([id, "", date.toLocaleDateString(), date.toLocaleTimeString()]);
return ContentService.createTextOutput("Success");
}
Deploy as Web App
- Click Deploy โ New Deployment
- Select Web App
- Access: Anyone
- Click Deploy
- Copy Web App URL
This URL will be used inside Python code.
Step 4: Setup ESP32-CAM in Arduino IDE
Install ESP32 Board
- Open Arduino IDE
- Go to Preferences
- Add board URL
- Install ESP32 boards
Select Board
Tools โ Board โ AI Thinker ESP32-CAM
Configure WiFi
Update WiFi credentials in camera code:
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
Upload the CameraWebServer example code.
After uploading, open Serial Monitor. You will see IP address like:
Camera Ready! Use 'http://192.168.1.5'
Copy this IP address.
Step 5: Python QR Scanner
import cv2
from pyzbar import pyzbar
import requests
ESP32_STREAM = "http://192.168.1.5"
GOOGLE_SCRIPT = "YOUR_WEB_APP_URL"
marked = set()
cap = cv2.VideoCapture(ESP32_STREAM)
(continued...)
This script:
- Connects to ESP32-CAM stream
- Detects QR code
- Extracts student ID
- Sends data to Google Sheet
- Prevents duplicate attendance
Required Libraries
- OpenCV โ for camera stream handling
- pyzbar โ for QR code detection
- requests โ to send data to Google Sheet
- qrcode โ to generate QR codes (optional but recommended)
- Pillow โ required dependency for qrcode
Install All at Once
Run this command in terminal:
pip install opencv-python pyzbar requests qrcode pillow
How the System Works

- Student shows QR card to camera
- ESP32-CAM captures image
- Python detects QR code
- Student ID extracted
- Google Sheet updated automatically
- Date & time recorded
- Duplicate scan ignored
Features
- Real-time attendance tracking
- Automatic Google Sheet update
- Duplicate entry prevention
- Low cost hardware
- Wireless system
- Easy deployment
Applications
This project can be used in:
- Schools and colleges
- Office attendance
- Event entry system
- Workshop registration
- Lab attendance
- Smart classroom automation
Future Improvements
- Face recognition integration
- Mobile app dashboard
- Cloud database storage
- RFID + QR hybrid system
- Student name auto mapping
Full Code
For complete working code and setup instructions: ๐ฉ DM me on Instagram and I will share the full project files.
Conclusion
This Smart QR Code Attendance System using ESP32-CAM and Python is a practical IoT project that automates attendance efficiently. It reduces manual work, prevents proxy attendance, and stores records in real time. The system is low cost, scalable, and ideal for educational institutions and offices.
๋ฉํ๋ฐ์ดํฐ
- post_id
- ae4e65a276f4
- slug
- smart-qr-code-attendance-system-using-esp32-cam-and-python-auto-google-sheet-update-ae4e65a276f4
- url
- https://medium.com/@pritamkumarroy/smart-qr-code-attendance-system-using-esp32-cam-and-python-auto-google-sheet-update-ae4e65a276f4
- canonical_url
- https://medium.com/@pritamkumarroy/smart-qr-code-attendance-system-using-esp32-cam-and-python-auto-google-sheet-update-ae4e65a276f4
- author_url
- https://medium.com/@pritamkumarroy
- status
- ok
- fetched_at
- 2026-07-18 18:40:04