0% found this document useful (0 votes)
77 views11 pages

Digital Logic Design: Key Press System

Project Report on Digital Logic Design

Uploaded by

N.m. Razon
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views11 pages

Digital Logic Design: Key Press System

Project Report on Digital Logic Design

Uploaded by

N.m. Razon
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Project Report

Course Title: Digital Logic Design


Courser Code: EEE205
Section: 01

Submitted By: Group 01


1. Md. Sazzadur Rahman ID: 2022-3-80-041
2. Faisal Hasan ID: 2022-2-80-007
3. Niaz Morshed Razon ID: 2022-2-80-008

Submitted To:
Dr. Mohammad Ryyan Khan
Associate Professor
Department of Electrical and Electronic Engineering

31 May 2024
th

1
Part-A

Problem Statement:

o We have a single push button (key) that users can press.


o The duration of the key press varies each time.
o We want to synchronize this user input with the system for further analysis.

Objective: Convert the variable-length user key press (Ain) into a single-cycle pulse (AP) that
aligns with the system clock.

Approach:

o We’ll use a positive edge-triggered synchronous system as an example.


o When the user presses the key, we want to generate a single-cycle pulse (AP) that
indicates the key press.
o The pulse should be synchronized with the rising edge of the clock signal.

Solution:

To solve this problem, we can used two D flip-flop to capture the rising edge of the clock. When
the user presses the key (Ain), we’ll sample its state (pressed or not) at the rising edge of the clock.
If the key is pressed at that moment, we set the output (AP) to high (1) for one clock cycle.
Otherwise, the output remains low (0).

State Diagram:

▪ State 0: No key press (AP = 0).


▪ State 1 (Key Press Detected): Key press detected (AP = 1).
▪ Transition: On the rising edge of the clock, transition from State 0 to State
1 if Ain is high (key pressed).

2
Figure-1: State Diagram

state table.
Present state Input Next state Output
Q1(t) Q2(t) W Q1(t+1) Q2(t+1) Z

0 0 0 0 0 0

0 0 1 0 1 0

0 1 0 1 0 1

0 1 1 1 1 1

1 0 0 0 0 0

1 0 1 0 1 0

1 1 0 1 0 0

1 1 1 1 1 0

3
State equation.
Q1(t+1) = Q2(t)
Q2(t+1) = W(t)

Z = ̅̅̅̅̅̅̅
Q1(t) Q2(t)

Circuit diagram.

Figure-2: State Table (Part-A)

Implementation:

o Used D flip-flop to capture the rising edge of the clock.


o Connect Ain to the D input of the flip-flop.
o Connect the Q output of the flip-flop to AP.

Summary: We’ve designed a simple synchronization system that converts variable-length key
presses into single-cycle pulses. The system ensures that the pulse aligns with the clock edge.

Circuit And Result Pictures:

4
Figure-3: Constructed Circuit

5
Figure-4: Output Result

Part-B
Design of a 4-Key Security System

Introduction
In this project, we will design a security system that uses four keys (α, β, γ, δ) and provides feedback for
correct and incorrect entries. The system includes a level-to-pulse converter for each key and has a reset
functionality controlled by an administrator.

Objective:
To design a security system that:
1. Activates upon the correct entry of a predefined password using four keys.

6
2. Provides feedback via two output signals: FC1 for correct entries and FW1 for incorrect entries.
3. Can be reset by an administrator, turning off FC1 and FW1.

Components:1
1. Keys (α, β, γ, δ): Push-button inputs that represent the password keys.
2. Output Signals: FC1 (indicates correct entry) and FW1 (indicates wrong entry).
3. Reset Button: Used to reset the system.
4. Logic Gates: AND, OR, NOT gates for processing inputs.
5. Flip-Flops: D-type flip-flops to store the system state.
6. Level-to-Pulse Converter: Converts the steady input from keys to pulses.
7. LEDs: Indicate the system status for FC1 and FW1.

Design Explanation:
In this project, we designed a security system with four keys (α, β, γ, δ) that requires users to enter a preset
password to gain access. The system verifies the input sequence and provides feedback via two output
signals: FC1, which lights up when the correct password is entered, and FW1, which lights up when an
incorrect password is entered. Additionally, the system features a reset button that clears the current state
and turns off both output signals.

We utilized D-type flip-flops (D-FF) in our design because they are ideal for implementing state machines
due to their simplicity and reliability in storing binary state information. D-FFs capture and hold the input
state on the rising edge of a clock signal, ensuring that the system transitions between states only when
specific conditions are met. This characteristic is crucial for our sequential logic design, where the system
must accurately follow the sequence of key presses.

Each key is connected to a level-to-pulse converter, which ensures that a key press is registered as a single
pulse, preventing multiple entries from a single press. The state machine transitions through states S0 to S4
as the correct sequence of keys is pressed. The state transitions are controlled by combinational logic
implemented using AND, OR, and NOT gates, which check the inputs and current state to determine the
next state.

The state table defines the behavior of the system, specifying the conditions under which the system
transitions from one state to another and the corresponding outputs. When the correct sequence (α → β →
γ → δ) is entered, the system reaches state S4, turning on the FC1 signal. Any deviation from the correct
sequence activates the FW1 signal, indicating an incorrect entry.

7
The system is reset by pressing the reset button, which clears the states of all D-FFs, returning the system
to the initial state (S0) and turning off both FC1 and FW1. This design ensures a robust and reliable security
system that can be easily reset and reconfigured as needed. The project demonstrates the effective use of
digital logic and sequential circuit design to implement a practical security solution.

Design Methodology:
We will use a state machine approach to handle the sequence of key presses and determine the correctness
of the password entered. The design involves the following steps:
1. Define the States and Transitions:
- States: S0 (Idle), S1 (after α), S2 (after β), S3 (after γ), S4 (after δ, correct entry), and incorrect state.
- Transitions: Defined based on the input sequence and reset functionality.
2. State Table:
The state table captures the transitions based on the inputs and reset signal.

State Table:

Current Next FC1


α β γ δ Reset
State State (Correct) FW1
(Wrong)
S0 1 0 0 0 0 S1 0 0

S1 0 1 0 0 0 S2 0 0

S2 0 0 1 0 0 S3 0 0

S3 0 0 0 1 0 S4 1 0

Any x x x x 1 S0 0 0

Incorrect x x x x 0 - 0 1

Calculation Steps and Explanations


1. Define Password and Inputs
- Preset password: "α, β, γ, δ"

8
- Each key and reset button is a digital input that can be HIGH (1) or LOW (0).

2. State Machine Design:


- We use D-type flip-flops to store the current state of the system.
- The output of each state is determined by the combination of current inputs and previous state.
- We will need five states (S0, S1, S2, S3, S4) plus an implicit incorrect state.

3. State Transitions:
- From S0: If α is pressed, transition to S1. Any other input keeps the system in S0.
- From S1: If β is pressed, transition to S2. Any other input moves to the incorrect state.
- From S2: If γ is pressed, transition to S3. Any other input moves to the incorrect state.
- From S3: If δ is pressed, transition to S4 (correct entry). Any other input moves to the incorrect state.
- From S4 (Correct Entry): System stays in S4 until reset.
- Reset: Any state transitions to S0 when reset is pressed.

4. Output Logic:
- FC1: Turns on when the system transitions to S4 and stays on until reset.
- FW1: Turns on if any incorrect sequence is detected and stays on until reset.

Circuit Design

1. Input Handling:
- Use digital debouncing circuits or logic toggles for each key (α, β, γ, δ) to ensure clean pulse
generation.

2. State Machine Implementation:


- Flip-Flops: Use D-type flip-flops to store states.
- Logic Gates:
- Use AND gates to detect specific sequences.
- Use OR gates to handle incorrect sequences and reset functionality.

9
3. Reset Logic:
- Connect the reset button to the reset inputs of all flip-flops.
- Ensure that pressing the reset button clears FC1 and FW1 and returns the system to S0.

Proteus Simulation:

Figure-5: Porteous Circuit Simulation

Here’s a high-level conceptual representation of the circuit in Proteus:

1. Level-to-Pulse Conversion:
- Each key (α, β, γ, δ) connects to a debounce circuit.
- Outputs are fed into the state machine logic.

2. State Machine Logic:


- Flip-Flops: Connect flip-flops to store the state.
- Logic Gates: Use AND, OR, and NOT gates to manage transitions and detect the correct sequence.

10
- State Transitions:
- S0 to S1 on α pulse
- S1 to S2 on β pulse
- S2 to S3 on γ pulse
- S3 to S4 on δ pulse
- Incorrect Sequence Detection: Use OR gates to handle any incorrect input and activate FW1.

3. Output Indicators:
- FC1: Connect to an LED to indicate a correct entry (S4).
- FW1: Connect to an LED to indicate a wrong entry.

4. Reset Mechanism:
- The reset button connects to the reset inputs of flip-flops.
- Ensure the reset functionality clears the state and turns off FC1 and FW1.

Conclusion:
This report details the design and implementation of a 4-key security system, including a state machine for
password checking, correct and incorrect entry indicators, and a reset function. The state table and
calculations ensure a thorough understanding of the system’s behavior. The Proteus simulation file, along
with the Arduino example code, demonstrates the system's operation, providing a comprehensive solution
for the given problem.

11

Common questions

Powered by AI

The state machine controls the sequence of key presses and determines the correctness of the password entered. It transitions through states S0 to S4 based on the correct sequence of key presses (α → β → γ → δ). Each key press moves the system to the next state: S0 to S1 on α, S1 to S2 on β, and so on. If an incorrect sequence is entered, the system transitions to an incorrect state, activating the FW1 signal. When the correct entry reaches state S4, FC1 is activated. The state machine ensures that transitions occur only when specific conditions are met, using D-type flip-flops to store state, and logic gates (AND, OR, NOT) to implement these transitions .

The state equations for the synchronization system are Q1(t+1) = Q2(t), Q2(t+1) = W(t), and Z = Q1(t) ̅̅̅̅̅̅̅ Q2(t). These equations indicate the relationship between the current and next states of the flip-flops. Q1(t+1) = Q2(t) captures the propagation of the system state. Q2(t+1) = W(t) reflects that Q2 updates based on the input W(t) at the rising clock edge. Z = Q1(t) ̅̅̅̅̅̅̅ Q2(t) determines the output Z, representing the detection of a key press, as derived from the conditions of the two flip-flops' states. Together, they ensure correct operation by synchronizing input detections with the clock .

The level-to-pulse converter ensures that a key press is registered as a single pulse. This prevents multiple entries from being registered from a single key press, which is crucial for accurately capturing the input sequence for password validation. The converter transforms the steady input from keys into discrete pulses that can be processed by the state machine to advance through the states correctly. This functionality is implemented for each key (α, β, γ, δ) in the system .

The Proteus simulation plays a crucial role in the project development process by providing a visual and interactive environment for testing the circuit design before physical implementation. It allows designers to verify the circuit's logic, ensure the correct function of the state machine, and identify potential issues in the design. Through simulation, components like debouncing circuits, timing, and signal transitions can be examined in detail, ensuring that the design meets the intended specifications. This step reduces the likelihood of errors in the final hardware and saves time by allowing adjustments to be made early in the design process .

Using a state machine design enhances the security and reliability of the system by ensuring that each state transition occurs only after a valid key press sequence, thereby preventing unauthorized access through random key presses. The design forces the system through a linear progression of states tied to the correct password sequence (α → β → γ → δ). This method also provides predictability and repeatability to the system operations, minimizing the risk of incorrect entries being accepted as valid due to timing errors or other electronic noise. Additionally, the use of D-type flip-flops provides precise timing control and memory for each state, ensuring reliable operation .

Logic gates play a key role in controlling the state transitions and managing outputs based on input sequences. AND gates are used to detect specific sequences of key presses, ensuring that the transitions only occur under the correct conditions. OR gates handle incorrect sequences, activating the FW1 signal when an error is detected, and manage the reset functionality by collecting multiple inputs to reset the system. NOT gates are used to invert signals as part of the logic operations needed for accurate system functioning. These gates work together to process inputs and control the advancements and resets of system states .

The reset functionality allows the system to return to the initial state (S0) and clears any active output signals. When the reset button is pressed, it connects to the reset inputs of all flip-flops, ensuring that FC1 and FW1 are turned off and the system is ready to accept a new sequence of key presses. This functionality is crucial for maintaining the system's integrity, allowing administrators to clear the current state and output indicators, thus preparing the system for a fresh password entry without manual intervention in case of incorrect inputs or for security purposes .

The system uses two D flip-flops to capture the rising edge of the clock. When the user presses the key (Ain), the state of the key press is sampled at the rising edge of the clock. If the key is pressed at that moment, the output (AP) is set to high (1) for one clock cycle. The state transitions from State 0 (No key press, AP = 0) to State 1 (Key press detected, AP = 1) on the rising edge of the clock when Ain is high, thus generating a single-cycle pulse synchronized with the clock .

D-Flip-Flops are preferred in the security system's design due to their simplicity and reliability in storing binary state information. They capture and hold the input state on the rising edge of a clock signal, which ensures the system transitions between states only when specific conditions are met. This characteristic is particularly important for implementing state machines in sequential logic designs, such as the password-based security system, where precise state transitions are critical. D-Flip-Flops provide a clear mechanism for managing state transitions based on predefined sequences and inputs .

Implementing debounce logic circuits can be challenging due to the mechanical nature of switches, which may cause multiple unwanted transitions or 'bouncing' when pressed. This can lead to incorrect pulse registrations, affecting the state machine operations. To address these challenges, digital debouncing techniques like implementing RC filter circuits or using Schmitt triggers might be required. Software debouncing, where software filters out the bounces, can also be used. These methods help ensure clean transitions by filtering out noise and stabilizing the key press signal before it is processed by the state machine .

You might also like