DLD PBL
DLD PBL
Problem Statement
Your task is to design and implement a digital combina on lock system for securing high-value assets in a single
room. The system should include a keypad for entering the combina on and a mechanism to open the lock
when the correct combina on is entered.
Task:
How can you represent the binary signals generated by the keypad bu ons A, B, C, and D?
Design a circuit that converts the bu on presses into corresponding binary signals.
Explain the purpose of the shi register in the combina on verifica on process.
What type of comparator would be suitable for comparing the entered combina on with the correct
combina on?
What Mechanism you will use for locking and unlocking?
Draw a block diagram illustra ng how the keypad input, combina on verifica on, and lock
mechanism components are connected.
Create truth tables for the keypad input, combina on verifica on, and lock mechanism components.
Iden fy the condi ons under which the lock mechanism will be unlocked.
Simulate the digital combina on lock system using a digital logic simula on tool.
Validate the func onality by entering different combina ons and observing the output.
KNOWLEDGE PROFILE ADDRESSED
S.No WK Attribute
2. K3 To design the logic of the given problem statement using basic logic gates,
comparators, shift registers etc., you need to have a solid foundation in
electrical engineering fundamentals
3. K4 Engineering knowledge related to Logic Designing is required for problem
solving
4. K5 The ability to design and implement Digital Combination Lock requires a
strong understanding of engineering design principles, including problem-
solving skills, creativity, and innovation.
Problem Statement:
Our task is to design and implement a digital combina on lock system for securing high-value assets in a
single room. The system should include a keypad for entering the combina on and a mechanism to open the
lock when the correct combina on is entered.
Solution Overview
Block Diagram
LED
3x4 Keypad Arduino Mega
Buzzer
Internal Circuit
3x4 Keypad:
Arduino:
Truth Table
Keypad Input/
Button Pressed Binary Signal
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
0 1010
* 1011
# 1100
Combination Verification
Entered Combination Correct Combination Match
0010 0100 No
0101 0101 Yes
0110 0011 No
0011 0011 Yes
Lock Mechanism
System State Lock State
Locked Closed
Unlocked Open
Code Explanation:
1. Library Inclusion:
#include <Keypad.h>
This line includes the Keypad library, which allows you to interface with a keypad easily.
2. Constants and Variables:
const int ROW_NUM = 4; // Four rows const int COLUMN_NUM = 3; // Three columns
These constants define the number of rows and columns in your keypad.
const int LED_PIN = 13; // Pin for the LED const int BUZZER_PIN = 10; // Pin for the buzzer
These constants define the pin numbers for the LED and the buzzer.
bool isLocked = true; char enteredCode[5]; // Array to store entered code int codeIndex = 0; // Index for
the entered code
These variables are used to keep track of the lock state, store the entered code, and track the index of the
entered code.
3. Setup:
enteredCode[codeIndex++] = key;
This line stores the pressed key in the enteredCode array and increments codeIndex.
Serial.print("*");
This prints an asterisk to the serial monitor to provide feedback for each key press.
if (codeIndex == 4) { ... }
When 4 digits are entered, it checks the code.
6. Checking the Code:
bool checkCode(const char* code, const char* entered) { return strcmp(code, entered) == 0; }
This func on compares the entered code with the correct code and returns true if they match.
8. Unlock Func on: