Introduction
Keycards and RFID fobs have replaced physical keys in offices, makerspaces, apartment buildings, and home labs. But commercial access control systems from vendors like HID, Paxton, and Salto come with per-door licensing fees, proprietary management software, and vendor lock-in that can cost thousands of dollars per door.
The open-source ecosystem offers capable alternatives built on inexpensive ESP32/ESP8266 microcontrollers. ESP-RFID provides a complete standalone web-based access control system with a built-in user database, while OpenMQTTGateway bridges RFID readers into broader smart home and automation platforms through MQTT. For those who need maximum flexibility, raw Wiegand-to-serial bridges let you integrate commercial RFID readers with any backend.
Comparison Table
| Feature | ESP-RFID | OpenMQTTGateway | Wiegand-Interface (ESP-RFID-Tool) |
|---|---|---|---|
| Architecture | Standalone web server + WebSocket | MQTT bridge to Home Assistant/Node-RED | Raw Wiegand decoder |
| RFID Protocols | RC522 (MIFARE), PN532 (NFC), Wiegand, RDM6300 (125kHz) | PN532, RC522, RDM6300, PN5180 | Wiegand (26-58 bit) |
| User Management | Built-in web UI with user database, access groups | Delegated to home automation platform | None (raw data) |
| Door Control | GPIO relay output, timed unlock | Via MQTT-triggered relay | Via serial/network output |
| Web Interface | Full management dashboard with live event log | None (MQTT only) | None |
| API | WebSocket, JSON, REST | MQTT (JSON payloads) | Serial, TCP socket |
| GitHub Stars | 1,468+ | 3,600+ | 573+ |
| Hardware | ESP8266/ESP32 + RFID reader + relay | ESP32/ESP8266 + multiple radios | ESP32 + Wiegand reader |
| Best For | Standalone door access | Smart home-integrated access | Custom backend integration |
ESP-RFID
ESP-RFID is a complete access control firmware for ESP8266/ESP32 microcontrollers. Flash it onto a $5 development board, connect an RFID reader and relay module, and you have a fully functional door controller with a polished web management interface.
The web dashboard lets administrators add and remove users, assign access groups, set time-based access schedules, and view a real-time event log of every tap. The WebSocket connection pushes events to the browser instantly — you’ll see who just badged in before they’ve finished walking through the door.
| |
Configuration is done entirely through the web interface — no firmware recompilation needed after initial flashing:
| |
ESP-RFID supports multiple authentication modes: card-only, card+PIN (for higher-security areas), and administrator override cards. The event log persists in flash memory and survives power cycles.
OpenMQTTGateway
OpenMQTTGateway takes a different approach: instead of being a self-contained access controller, it acts as a universal bridge that converts RFID readings into MQTT messages. This design philosophy means the device itself doesn’t make access decisions — it publishes “card X was presented at reader Y” and lets your home automation platform (Home Assistant, Node-RED, OpenHAB) decide what to do.
This architecture shines in complex environments. The same RFID reader that unlocks the front door can also arm/disarm the alarm system, log attendance, or trigger personalized lighting scenes. OpenMQTTGateway supports not just RFID but also BLE, infrared, LoRa, and 433MHz radios — making it a multi-protocol IoT gateway, not just an access controller.
| |
In Node-RED, you can build sophisticated access flows: check the card against an authorized list, verify time-of-day restrictions, trigger the door relay, log to a database, and send a notification — all with drag-and-drop nodes.
Wiegand Interface Tools
Many commercial buildings already have Wiegand-interface RFID readers installed on every door. The ESP-RFID-Tool project helps you decode these existing readers without replacing hardware. Connect the reader’s D0 and D1 lines to GPIO pins, and the tool outputs the raw facility code and card number over serial or TCP.
This is particularly useful for integrating legacy access systems with modern backends. A university with 200 existing HID readers can place an ESP32 next to each reader, decode the Wiegand output, and pipe the data into a centralized PostgreSQL database without touching the physical readers.
| |
Why Self-Host Your RFID Access Control?
Commercial access control systems charge per-door licensing fees that add up fast: $500-$2,000 per door for the controller, plus annual software maintenance. An ESP-RFID setup costs under $30 per door (ESP8266: $5, RC522 reader: $3, relay: $2, power supply: $5, enclosure: $10) with zero recurring fees.
Data sovereignty matters for physical security. With a self-hosted system, your access logs stay on your network, not a vendor’s cloud. You control backup schedules, retention policies, and who can view audit trails. When a vendor discontinues their cloud platform (as several access control startups have), self-hosted systems keep working.
On the integration side, MQTT-based systems connect seamlessly with existing smart home and building automation. Your door unlock event can trigger HVAC adjustments, lighting scenes, and occupancy tracking — integrations that commercial systems gate behind expensive “enterprise” API tiers.
For related physical security and IoT projects, see our network access control guide and our comparison of ESPHome vs Tasmota IoT firmware platforms. For wireless sensor integration, check our BLE MQTT gateway guide.
Deployment Topology and Failover Planning
A single ESP-RFID device controlling one door is straightforward, but real-world deployments quickly grow more complex. A typical small office might have a front door, a back door, a server room, and two interior office doors — five doors total, each needing independent or coordinated access control.
For multi-door setups, deploy one ESP device per door, each with its own IP address on the IoT VLAN. All devices publish MQTT events to a central broker, and a Node-RED or Home Assistant instance serves as the coordination layer. This architecture means a failure at one door does not affect any other door — each ESP operates independently with its own cached user database.
Power reliability deserves attention. A PoE (Power over Ethernet) ESP32 board like the Olimex ESP32-POE eliminates the need for a separate power supply at each door, drawing power from the same Ethernet switch that provides network connectivity. Combined with a UPS on the network switch, this ensures door controllers stay operational during brief power outages.
For high-security environments, consider a dual-reader configuration at each door: an entry reader on the outside and an exit reader on the inside. ESP-RFID supports this natively, logging both entry and exit events and enabling anti-passback rules that prevent a card from being used twice without an intervening exit.
Audit trail retention is the final consideration. ESP-RFID stores events in flash memory with a configurable maximum count, but for compliance purposes, pipe all events through MQTT to a time-series database like InfluxDB or a simple PostgreSQL table. This gives you searchable, long-term access logs without consuming the limited flash storage on the microcontroller.
FAQ
Is ESP-RFID secure enough for production use?
ESP-RFID uses standard RFID protocols (MIFARE Classic, which has known vulnerabilities if using default keys). For higher security, pair it with PN532 readers using MIFARE DESFire EV2 cards, or use the card+PIN mode. The web interface should be placed behind HTTPS (via a reverse proxy) if accessed over the internet. For mission-critical facilities, consider defense-in-depth: ESP-RFID as the first factor, with a separate PIN pad or biometric as the second factor.
Can I use existing HID/Paxton readers with these open-source solutions?
Yes, if your readers output Wiegand protocol (the industry standard for 26-58 bit cards). Connect the reader’s D0/D1 lines to an ESP32 running ESP-RFID or ESP-RFID-Tool. Most commercial readers from HID, AWID, and Keri Systems use Wiegand output. Note that some readers use proprietary encrypted protocols (HID iCLASS SE, some Paxton models) that require the manufacturer’s decoder.
How many doors can one ESP-RFID device control?
One ESP8266 can control one door (one relay output, one or two readers for entry/exit). An ESP32 has more GPIO pins and can potentially control two doors. For multi-door installations, deploy one ESP device per door and manage them all through the MQTT integration — a central dashboard can aggregate events from dozens of doors.
What happens if Wi-Fi goes down?
ESP-RFID caches its user database in flash memory and continues to operate without network connectivity. Door unlocks work normally; events are queued and synced when connectivity returns. The web interface and MQTT logging will be unavailable, but physical access control is not disrupted. For critical deployments, consider adding a local status indicator (LED/buzzer) to signal connectivity issues.
💰 想测试你的市场判断力?我用 Polymarket 做预测市场交易——这是全球最大的预测市场平台,从大选结果到技术监管时间线,什么都可以押注。和赌博不同,这是真正的信息市场:你懂的信息越多,胜率越高。我靠预测技术相关事件的走向已经赚了不少。用我的邀请链接注册:Polymarket.com