Skip to content

Benedito821/access-control

Repository files navigation

Keywords ESP32 WebSocket NodeJS WiFi HTTP SQLite RFID SPI

Access Control

The project implements a simple system for access control using RFID cards(key cards). Upon scanning tapping the card,its serial number is checked against a database located on the server(a Linux machine in our case). If the serial number matches one of the existing ones on the database,holder data are shown on the admin webpage. The project uses ESP-IDF v5.1.2,VS Code and Ubuntu 24.04.3 LTS, but could also be replicated on Windows machines installing the respective packages. The average system responsiveness(tap to LED triggering time) is around 200ms; a wired connection(through RJ-45) could improve this delay.

Getting up and run

A router(AP) is needed to connect the ESP32 and the server PC together through WiFi. All devices should be on the same network.

On the server side:

  1. On the project root run: chmod +x installPackages.sh

then:

  1. ./installPackages.sh

  2. If development is held on the server machine, install also VS Code with ESP-IDF v5.1.2 framework. Clone this repo and open the workspace file(on the repo root) on VS Code. After installing ESP-IDF extension, the required version can be selected and clonned on the extension welcome page.

  3. Open the users.db on the DB Browser for SQLite GUI and fill in with your user cards data. Note that new user attributes can be added as needed.

  4. Run the server on the terminal inside the project root: node server.js. You should get something like:

Server running on port 3000
WS connection from: 127.0.0.1
WebSocket client connected
  1. On any browser enter your_machine_ip:port/admin.html or just localhost:port/admin.html. In our case port=3000,so we get something like 192.168.0.5:3000/admin.html(or localhost:3000/admin.html).

On the ESP32 side:

Server endpoint address(HTTP_ENDPOINT) from 6. and WiFi credentials should be hardcoded in http_client.h so it automatically connects to the AP upon powering. After a successfull connection the blue LED stops blinking. After that,build and flash the board. By tapping the badge/tag, if access is granted, the green LED turns on, otherwise, the red one.

ESP32 - RC522 connections

ESP32 RC522
3v3 3v3
HSPI_MOSI(GPIO13) MOSI
HSPI_MISO(GPIO12) MISO
HSPI_SCK(GPIO14) SCK
GND GND

ESP32 - LED's connections

330 Ohm resistances were connected in series with the LED's. Other loads could be used instead,e.g. a relay, motor, etc.

ESP32 LED
GPIO33 Green
GPIO32 Red

Demo

About

Keeping track of whoever passes by a turnstile

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors