Back to Projects

SmartGate: IoT Access Control System

SmartGate is a capstone case study on an IoT-based access control system designed for residential subdivisions like Camella Homes. The ESP32 microcontroller serves as the central hub, reading RFID credentials via the RC522 module, detecting approaching vehicles through an IR sensor, and driving a servo motor for gate actuation. A custom Python MQTT client handles bi-directional communication with an Eclipse Mosquitto broker. The entire backend — a Django 4.2.1 web app, MQTT broker, and Nginx reverse proxy — is containerized with Docker and deployed on a Digital Ocean Droplet, with PostgreSQL managed separately for reliability.

ESP32RFIDMQTTDjangoPostgreSQLDockerNginxPythonIoT
[ System Topology ]

Context

IAS101 Case Study

Response Time

< 2 Seconds

RFID Read

1.4–1.8s

System Overview

01. RFID Authentication

RC522 RFID module reads registered cards and fobs, passing the unique ID to the ESP32 for validation against the PostgreSQL credential store. Unregistered or tampered tags are denied and logged.

02. IoT Communication Layer

ESP32 publishes sensor events and subscribes to gate commands via MQTT over Wi-Fi. A custom Python MQTT client manages bi-directional topic routing (gate/open, gate/status) through the Eclipse Mosquitto broker.

03. Role & Rule-Based Access Control

Django backend enforces RBAC across four roles: admin, guard, resident, and visitor. Rule-based logic applies time-bound restrictions and context-aware conditions. All access attempts — successful or not — are audit-logged.

04. Containerized Deployment

Docker Compose orchestrates three containers: the Django web app, Mosquitto MQTT broker, and Nginx reverse proxy. HTTPS is handled via Let's Encrypt. PostgreSQL runs as a managed Digital Ocean service.

Technical Specifications

v1.0.0

Core Stack

MicrocontrollerESP32 (Wi-Fi)
BackendDjango 4.2.1
DatabasePostgreSQL
MessagingMosquitto / MQTT
Web ServerNginx
ContainerizationDocker Compose
HostingDigital Ocean

Performance Metrics

Gate Response< 2s
RFID Read Time1.4–1.8s
Access Roles4 (RBAC)
Uptime (Test)2h Continuous
Vulnerability ScanNo Critical

Core Architecture

Embedded IoT Layer

ESP32 microcontroller coordinates RFID credential scanning, IR vehicle detection, servo gate actuation, and buzzer feedback — publishing status events and consuming control commands over MQTT.

MQTT / Wi-Fi

Access Control Engine

Django enforces layered access: RBAC assigns role-scoped permissions (admin, guard, resident, visitor), while RuBAC applies dynamic conditions such as time-based entry windows. All events are immutably audit-logged.

RBAC + RuBAC

Containerized Cloud Stack

Docker Compose bundles the Django app, Mosquitto broker, and Nginx proxy into isolated containers. TLS via Let's Encrypt secures all traffic. PostgreSQL runs as a managed Digital Ocean service for persistent credential and log storage.

Docker / Digital Ocean