Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP8266 NodeMCU Controlled RFID Access System with I2C LCD Feedback

View and Edit Project In Cirkit DesignerImage of ESP8266 NodeMCU Controlled RFID Access System with I2C LCD Feedback

Circuit Documentation

Summary

This circuit is designed around the ESP8266 NodeMCU microcontroller, which serves as the central processing unit. The circuit features an I2C LCD 16x2 screen for display, an RFID-RC522 module for RFID reading, a piezo speaker for audio feedback, and a fan for cooling or airflow purposes. The circuit is powered by an HLK-PM12 AC-DC converter module, which steps down the AC supply to a stable DC voltage. The ESP8266 NodeMCU is programmed to connect to a WiFi network, read RFID tags, display information on the LCD, and send data to a server.

Component List

Wiring Details

ESP8266 NodeMCU

I2C LCD 16x2 Screen

Piezo Speaker

Fan

RFID-RC522

HLK-PM12

Ac Supply

Documented Code

The following code is written for the ESP8266 NodeMCU microcontroller. It includes libraries for WiFi connectivity, HTTP client for server communication, SPI for serial peripheral interface communication, Wire for I2C communication, and libraries for the LCD and RFID modules.

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <MFRC522.h>
#include <SPI.h>
#include <Wire.h>
#include <hd44780.h>          // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h>

#define RST_PIN   D3     // Reset pin for MFRC522
#define SS_PIN    D4     // Slave Select pin for MFRC522
#define BUZZER_PIN D8    // Buzzer pin

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
hd44780_I2Cexp lcd;

// WiFi credentials
const char* ssid = "MVGR_SLC";
const char* password = "001010011100";

void setup() {
  Serial.begin(9600);
  SPI.begin();
  lcd.begin(16, 2);  // Initialize 16x2 LCD
  lcd.backlight();
  mfrc522.PCD_Init();
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
    lcd.print("Connecting....");
  }
  
  Serial.println("Connected to WiFi");
  Serial.println("All setup done");
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Connected To");
  lcd.setCursor(0, 1);
  lcd.print(ssid);
  delay(3000);
  lcd.clear();
  getcount();
}

void loop() {
  // WiFi connection check and RFID reading
  // HTTP POST requests to server
  // LCD and buzzer feedback based on server response
  // Error handling with buzzer and LCD messages
}

// Additional functions for HTTP requests and server communication
// getcount2(), getcount(), sendSensorDataToServer()

The code is structured to initialize the hardware components in the setup() function and to continuously check for RFID cards and send data to the server in the loop() function. It also includes error handling and user feedback through the LCD and buzzer. The actual HTTP request functions (getcount2(), getcount(), sendSensorDataToServer()) are implemented to communicate with a specific server endpoint and handle the server's response.