This project uses two ESP32s to implement an access control system with RFID.
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.
- 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.
- 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.
- The communication between ESP32s and ThingsBoard is done using the MQTT protocol, allowing telemetry data transmission and receiving commands to adjust operating modes.
This guide provides instructions to set up the ESP32 development environment, clone the ESP-IDF repository, install dependencies, and build the project.
mkdir ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf
cd ~/esp/esp-idf
./install.sh
. ~/esp/esp-idf/export.sh
Navigate to each ESP directory and run the menuconfig command:
idf.py menuconfig
Locate the ESP-IDF installation directory:
source ~/esp/esp-idf/export.sh
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
Use the following command to identify the correct port where the ESP32 is connected:
ls /dev/tty*
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