Embedded
NFC access control
Access control for a sports club’s clubhouse: NFC readers, a controller on an ESP32 running FreeRTOS and a backend that sends permissions to the device without any personal data. In service for years.
- Status
- In production
- Area
- Embedded
- Role
- Hardware, firmware, backend
Features
The images show the management app and the controller's web UI with made-up demo data; click to enlarge.
Overview
The management app shows members, devices and cards at a glance, plus the entries of the last 30 days and what happened most recently — entries as well as device syncs.

Cards and members
Every card has its number, a status (new, labelled, lost) and the member it currently belongs to. Assigning works from a phone too: the UI reads the card via Web NFC where the browser supports it. Lost or returned cards are missing from the door's next card index.

Access log
The controller records every entry with time and card number and hands the list over during sync; only the server maps it to a member. Each device authenticates with its own API key.

The controller in the browser
The controller ships its own web UI, served by the ESP32 itself: Wi-Fi status, recent events, device data and a button to sync right away. Firmware updates arrive over Wi-Fi, for the controller and the reader.

Card index on the device
The device holds only the sorted list of valid card numbers, four bytes per card. Over a direct connection it can also be maintained by hand — the fallback in case the server is ever unreachable.

Relay, reader and LED ring
How long the relay keeps the door open, which pins the relay and reader use and whether the door stays open permanently are set in the UI. The LED ring on the reader gets its own animation per state: idle, open, rejected, held open.

Architecture
The reader at the door is an ESP8266 with an NFC module. It talks to the controller over UART by cable or, where there is none, over Wi-Fi. The controller is an ESP32 running FreeRTOS; it decides on access and switches the relay for the door opener.
A backend (Node.js, web UI in Svelte) manages members and cards. The controller polls it for changes at intervals — over Wi-Fi or an LTE modem — sending only the date of its last state. The answer is a small delta, binary with Protobuf (nanopb) over HTTP, so a cheap data SIM is plenty.
Hardware
The boards are etched and assembled by hand.
The controller
The board carries an ESP32 board, a real-time clock with a coin cell for the entry timestamps, a voltage converter and the relay for the door opener. The display on the left is still attached in the photo; it has since been removed. The board sits in a printed case.


The reader
The reader consists of an NFC module (RC522) with an ESP8266 on a hand-etched board behind it, both on a printed base. The ESP8266 reads the card, drives the RGB LED on the back and sends the number to the controller over UART; power and two wires are all it needs.

In the test setup the reader glows in its case, with a card and a key fob in front. On the right the controller, its display showing its own Wi-Fi.

The first prototype
In the beginning a single ESP8266 did everything. The reader sat about two metres away and needed so many lines that a network cable carried them — hence the RJ45 jack. Today the same run uses UART.

An experiment: the keypad
The keypad was an early experiment and never made it to the door, as it added little. It was still instructive: an IO expander in the module scans the keys, so four lines are enough instead of one per row and column.

The story of the data
At first the full member list lived on the device as a CSV file. That was slow, as measuring showed. Index structures would have helped but cost memory again. The breakthrough came from questioning the requirement: to decide at the door, a sorted index of valid cards is enough. A hit means access.
The server now builds that index; the device only stores it and finds a card by binary search within microseconds. The device records each entry with a timestamp (RTC module) and reports it to the backend, where the full log is kept. The result: fast decisions, small updates and no personal data on the hardware in the hallway.
Fallback and lessons
For emergencies the device ships a small web UI: firmware updates over Wi-Fi (OTA) and maintaining allowed cards over a direct connection.
The main lesson was to limit complexity. A display and keypad with their own menu layer added little in practice: the keypad never made it to the door, and I removed the display again. I put the time into the web UI and the data structures instead.