ESP32 Smart Access Control System

Tuesday, March 31, 2026

View Project

ESP32 Smart Access Control System

Summary

This hardware engineering project involved architecting and developing a multi-modal smart access control system from the ground up, targeting the ESP32 microcontroller. The system features three distinct methods of authentication: a physical 4x4 matrix keypad, an RC522 RFID reader, and a secure remote application controller via WebSockets.

To provide real-time user feedback, the system interfaces with a 128x64 OLED display to communicate the lock's current state. The physical actuation is handled by a 12V electromagnetic solenoid lock, safely isolated and triggered via a 5V single-channel relay. The entire firmware architecture was written in bare-metal Embedded C using the Espressif IoT Development Framework (ESP-IDF). Additionally, the device communicates with a custom-built Progressive Web Application (PWA) for remote monitoring and access.

Technical Implementation & Architecture As the sole embedded software engineer on this project, I designed a modular firmware architecture. The high-level state machine, OLED rendering logic, and output signal routing are centralized in the main.c file. To ensure clean hardware-software abstraction, I developed specialized component libraries to control each peripheral independently.

Key engineering highlights include:

  • Serial Communication Protocols: Directly interfaced with hardware peripherals by writing drivers for I2C (handling the SSD1306 OLED display) and SPI (managing high-speed data transfer with the RC522 RFID module).
  • WebSockets Integration: Implemented a WebSocket client in C to maintain a persistent, bidirectional connection between the ESP32 and a remote server, enabling real-time remote unlocking capabilities via the companion PWA.
  • Hardware Integration: Managed GPIO states and real-time processing to safely actuate the 12V solenoid via a 5V relay circuit, utilizing a 1N4007 flyback diode to protect the microcontroller from voltage spikes.

Technologies I used for this project

Main Technologies

  • Embedded C
  • ESP-IDF (v6.0)
  • FreeRTOS (Task Management)

Hardware & Protocols

  • ESP32 Microcontroller
  • SPI & I2C Protocols
  • WebSockets (TCP/IP)
  • RC522 RFID Reader & 4x4 Keypad
  • 12V Electromagnetic Solenoid

Companion Software

  • Progressive Web App (PWA)

Results

The project successfully demonstrates a complete end-to-end IoT embedded system, combining secure peripheral integration, protocol level driver development, and real time state management.

GIF of the Smart Lock Worflow3D render and wiring diagram of the ESP32 Smart Lock project.Top photo of the ESP32 Smart LockParts of harware components of SmartLockSmart Lock layout