Skip to content

This project uses two ESP32s to implement an access control system with RFID.

Notifications You must be signed in to change notification settings

PhilipeSousa/Control-System-with-RFID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Access Control System with RFID

This project uses two ESP32s to implement an access control system with RFID.

Functionality:

Dashboard

ESP32_2 waits for an RFID card to be read. When the card is detected, it triggers the buzzer for authorized or unauthorized access and sends a message to an MQTT broker. ESP32_1 subscribes to the same MQTT channel and waits to receive the access status to activate the RGB LED and provide feedback on the OLED display.

ESP32_2 also sends temperature and humidity data to another MQTT channel, allowing data visualization on ThingsBoard.

  • esp_1:
    Contains the OLED display, RGB LED, WiFi, and MQTT configurations.
  • esp_2:
    Contains the RFID reader, DHT11 temperature and humidity sensor, buzzer, WiFi, and MQTT configurations.

Technologies Used

  • C Language: Firmware development for ESP32.
  • ESP-IDF: Espressif's development framework for ESP32.
  • MQTT: Communication protocol between ESP32s and ThingsBoard.
  • ThingsBoard: IoT platform for monitoring and remote control.

Components Used

  • RFID Module MFRC522: RFID reading and writing module for access control.
  • ESP32: Microcontrollers for control and communication.
  • Temperature and Humidity Sensor (DHT11): Measures environmental conditions for possible system adjustments.
  • LEDs: Simulate controlled lighting.
  • OLED Display: Shows the current operating mode.
  • Internal Button: For switching operating modes.
  • Buzzer: Indicates changes in operating mode.

Communication and Integration

  • The communication between ESP32s and ThingsBoard is done using the MQTT protocol, allowing telemetry data transmission and receiving commands to adjust operating modes.

ESP32 Environment Setup

This guide provides instructions to set up the ESP32 development environment, clone the ESP-IDF repository, install dependencies, and build the project.

1. Create the ESP Directory

mkdir ~/esp

2. Clone the ESP-IDF Repository

git clone --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf

3. Install Dependencies

cd ~/esp/esp-idf
./install.sh

4. Activate the ESP Environment

. ~/esp/esp-idf/export.sh

5. Configure Environment Variables

Navigate to each ESP directory and run the menuconfig command:

idf.py menuconfig

How to Run

1. Export the ESP-IDF environment:

Locate the ESP-IDF installation directory:

source ~/esp/esp-idf/export.sh

2. Compile and run for each ESP32:

Navigate to the ESP directory (esp_1 or esp_2):

cd esp_1  # or cd esp_2

Compile the project:

idf.py build

Upload the firmware (replace /dev/ttyUSB0 with the correct port):

idf.py -p /dev/ttyUSB0 flash

Monitor the output:

idf.py -p /dev/ttyUSB0 monitor

3. Check the USB port:

Use the following command to identify the correct port where the ESP32 is connected:

ls /dev/tty*

External Libraries Used (Submodules)

The project uses external libraries for RFID and the DHT11 sensor, included as Git submodules:

[submodule "esp_2/components/rc522"]
    path = esp_2/components/rc522
    url = https://github.com/abobija/esp-idf-rc522.git

[submodule "esp_2/components/DHT11"]
    path = esp_2/components/DHT11
    url = https://github.com/Anacron-sec/esp32-DHT11

[submodule "esp_1/components/components/u8g2-hal-esp-idf"]
    path = esp_1/components/components/u8g2-hal-esp-idf
    url = https://github.com/mkfrey/u8g2-hal-esp-idf.git
    
[submodule "esp_1/components/components/u8g2"]
    path = esp_1/components/components/u8g2
    url = https://github.com/olikraus/u8g2.git

About

This project uses two ESP32s to implement an access control system with RFID.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •