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

Wi-Fi Controlled ESP32-Based Smart Lock with RFID and OLED Display

View and Edit Project In Cirkit DesignerImage of Wi-Fi Controlled ESP32-Based Smart Lock with RFID and OLED Display

Circuit Documentation

Summary of the Circuit

The circuit in question appears to be a smart lock system that can be controlled via Wi-Fi. It uses an ESP32 Devkit V1 microcontroller to manage the communication and control logic. The system includes an OLED display for user interface, an RFID-RC522 module for access control, and a r307 fingerprint sensor for biometric verification. A TIP120 Darlington Transistor is used to drive a 12V Solenoid Lock, which acts as the physical locking mechanism. The circuit is powered by a 12V power supply, and a diode is used to protect against reverse polarity. A pushbutton is also included, possibly for manual control.

Component List

Battery 12V

A power source for the circuit.

OLED 1.3"

A small display for outputting information to the user.

TIP120 Hi-Current Darlington Transistor

Used to switch high current loads with a low current control signal from the ESP32.

Resistor

A passive two-terminal electrical component that implements electrical resistance as a circuit element.

ESP32 Devkit V1

A microcontroller with Wi-Fi capabilities for controlling the circuit and communicating with external devices.

r307

A fingerprint sensor module for biometric input.

12V Power Supply

Provides a stable 12V power source for the circuit.

12V Solenoid Lock

An electromechanical lock controlled by the circuit.

RFID-RC522

An RFID reader/writer module for contactless communication using radio frequency.

Diode

A component that allows current to flow in one direction, used for reverse polarity protection.

Pushbutton

A simple switch mechanism for control of a circuit.

Wiring Details

Battery 12V

OLED 1.3"

TIP120 Hi-Current Darlington Transistor

Resistor

ESP32 Devkit V1

r307

12V Power Supply

12V Solenoid Lock

RFID-RC522

Diode

Pushbutton

Documented Code

#include <WiFi.h>
#include <WebServer.h>

const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";

WebServer server(80);

// Define GPIO pin for the relay
const int relayPin = 15;

void setup() {
  Serial.begin(115200);
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH);  // Lock is initially locked

  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }

  Serial.println("Connected to WiFi");

  // Setup server routes
  server.on("/unlock", handleUnlock);
  server.begin();
  Serial.println("HTTP server started");
}

void handleUnlock() {
  digitalWrite(relayPin, LOW);  // Unlock the door
  delay(5000);  // Keep it unlocked for 5 seconds
  digitalWrite(relayPin, HIGH); // Lock again
  server.send(200, "text/plain", "Door unlocked");
}

void loop() {
  server.handleClient();
}

This code is designed to run on the ESP32 Devkit V1 microcontroller. It sets up a Wi-Fi connection and a web server that listens for an /unlock route. When this route is accessed, the ESP32 activates the relay connected to relayPin (GPIO 15), unlocking the door for 5 seconds before locking it again.