Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
The Importance and Utility of Digital Door Locks
Digital door locks have become increasingly popular in recent years due to their convenience, security, and versatility. Unlike traditional locks that require physical keys, digital door locks use electronic components and software to control access to a door. This technology offers numerous benefits, such as keyless entry, remote access control, and the ability to track and monitor entry activity. Additionally, digital door locks can be integrated into home automation systems, enhancing overall security and convenience.
Projeto: Creating a Digital Door Lock using Arduino
In this project, we will create a digital door lock using an Arduino board. The objective is to design a system that allows authorized individuals to unlock a door using a password or RFID card, while also providing the ability to remotely control and monitor the lock status.
The functionalities of the digital door lock will include:
Lista de componentes:
Exemplos:
Example 1: Password-Based Unlocking
#include <Keypad.h>
const int ROWS = 4; // Number of rows in the keypad
const int COLS = 4; // Number of columns in the keypad
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; // Connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; // Connect to the column pinouts of the keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
const String password = "1234"; // Set the password
void setup() {
Serial.begin(9600);
}
void loop() {
char key = keypad.getKey();
if (key) {
if (key == '#') {
if (checkPassword()) {
// Unlock the door
unlockDoor();
} else {
// Display incorrect password message
Serial.println("Incorrect password. Try again.");
}
}
}
}
bool checkPassword() {
String enteredPassword = "";
char key;
while ((key = keypad.getKey()) != '#') {
if (key) {
enteredPassword += key;
}
}
return enteredPassword == password;
}
void unlockDoor() {
// Code to unlock the door using a servo motor
}
Example 2: RFID Card-Based Unlocking
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
void setup() {
Serial.begin(9600);
SPI.begin(); // Initialize SPI bus
mfrc522.PCD_Init(); // Initialize MFRC522
}
void loop() {
// Look for new RFID cards
if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {
// Check if the card UID matches an authorized card
if (isAuthorizedCard()) {
// Unlock the door
unlockDoor();
} else {
// Display unauthorized access message
Serial.println("Unauthorized access detected.");
}
mfrc522.PICC_HaltA(); // Halt PICC
mfrc522.PCD_StopCrypto1(); // Stop encryption on PCD
}
}
bool isAuthorizedCard() {
// Code to check if the card UID is authorized
}
void unlockDoor() {
// Code to unlock the door using a servo motor
}