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.
A power source for the circuit.
A small display for outputting information to the user.
Used to switch high current loads with a low current control signal from the ESP32.
A passive two-terminal electrical component that implements electrical resistance as a circuit element.
A microcontroller with Wi-Fi capabilities for controlling the circuit and communicating with external devices.
A fingerprint sensor module for biometric input.
Provides a stable 12V power source for the circuit.
An electromechanical lock controlled by the circuit.
An RFID reader/writer module for contactless communication using radio frequency.
A component that allows current to flow in one direction, used for reverse polarity protection.
A simple switch mechanism for control of a circuit.
+
to 12V power supply +
-
to 12V power supply -
GND
to ESP32 GND
VCC
to ESP32 3V3
SCL
to ESP32 D22
SDA
to ESP32 D21
BASE
to Resistor pin1
COLLECTOR
to Diode anode
and 12V Solenoid Lock -
EMITTER
to 12V power supply -
pin1
to TIP120 BASE
pin2
to ESP32 D15
3V3
to OLED VCC
, r307 VCC
, and RFID-RC522 VCC (3.3V)
GND
to 12V power supply -
, TIP120 EMITTER
, r307 GND
, RFID-RC522 GND
, and OLED GND
D15
to Resistor pin2
D4
to RFID-RC522 RST
RX2
to r307 RX
TX2
to r307 TX
D5
to RFID-RC522 SDA
D18
to RFID-RC522 SCK
D19
to RFID-RC522 MISO
D21
to OLED SDA
D22
to OLED SCL
D23
to RFID-RC522 MOSI
VCC
to ESP32 3V3
RX
to ESP32 RX2
TX
to ESP32 TX2
GND
to ESP32 GND
+
to Diode cathode
and 12V Solenoid Lock +
-
to ESP32 GND
and TIP120 EMITTER
+
to Diode cathode
and 12V power supply +
-
to TIP120 COLLECTOR
VCC (3.3V)
to ESP32 3V3
RST
to ESP32 D4
GND
to ESP32 GND
IRQ
(Not connected)MISO
to ESP32 D19
MOSI
to ESP32 D23
SCK
to ESP32 D18
SDA
to ESP32 D5
anode
to TIP120 COLLECTOR
and 12V Solenoid Lock -
cathode
to 12V power supply +
and 12V Solenoid Lock +
Pin 3 (out)
(Not connected)Pin 4 (out)
(Not connected)Pin 1 (in)
(Not connected)Pin 2 (in)
(Not connected)#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.