# Need Help With a Digital Combination Lock

#### Tony Vega

Joined Dec 4, 2015
5
I am currently at the end of my first Digital Logic class and need some help getting started on an assignment in which we are to create a digital combination door lock.

This class is online and we don't exactly have a textbook or any other resources at our disposal. I have tried to do this without asking for help, but I not having much luck. I searched for any resources that could help and haven't really found anything useful. So this is pretty much my last hope, seeing as I am not getting much help from my instructor either. We were given the choice to do this is Verilog or Logisim and I chose the latter, being that we spent more time with it this semester.

I need three inputs (pushbuttons) labeled A,B, & C. The hardcoded passcode will be A,B,C in that order. After the third letter is entered, if the combination is not correct then there should be a “Clear” input that will clear the attempt and permit the user to try again. After 3 incorrect attempts, input will be disabled until the circuit is reset.

It sounds simple in theory, but every time I try and get started by drawing up a diagram, I get lost. I know I would need to use D-Flip-flop or JK-Flip-flip in addition to three pushbuttons but other than that, I don't know what to do. I hate asking for help without having more done, but I can't really seem to even get started. Any help or suggestions would be greatly appreciated. We have been pretty much left to fend for ourselves with minimal resources all semester.

#### JohnInTX

Joined Jun 26, 2012
4,773
Mod edit: Moved to Homework Help.
Post your work so far with a schematic, block diagram, etc. so we can tale a look.
Welcome to AAC!

#### MrCarlos

Joined Jan 2, 2010
400
Hello Tony Vega

Sorry if I answer with questions.
This 3-letter code (A, B, C) are single bit or each letter represents a binary code; for instance:
A = 0001
B = 0010
C = 0011

A good choice is to use Flip-Flop's type D; but there must be something to 'remember' which button is pressed first, which second and which in third to verify that the sequence (A, B, C) was the right to open the door.

To verify whether the combination of the correct sequence was, a comparator can be used, eg 74LS85 IC called the magnitude comparator.

Also, your design, need to have an counter to verify that three attempts have already been made to open the door.

#### WBahn

Joined Mar 31, 2012
29,133
I am currently at the end of my first Digital Logic class and need some help getting started on an assignment in which we are to create a digital combination door lock.

This class is online and we don't exactly have a textbook or any other resources at our disposal. I have tried to do this without asking for help, but I not having much luck. I searched for any resources that could help and haven't really found anything useful. So this is pretty much my last hope, seeing as I am not getting much help from my instructor either. We were given the choice to do this is Verilog or Logisim and I chose the latter, being that we spent more time with it this semester.

I need three inputs (pushbuttons) labeled A,B, & C. The hardcoded passcode will be A,B,C in that order. After the third letter is entered, if the combination is not correct then there should be a “Clear” input that will clear the attempt and permit the user to try again. After 3 incorrect attempts, input will be disabled until the circuit is reset.

It sounds simple in theory, but every time I try and get started by drawing up a diagram, I get lost. I know I would need to use D-Flip-flop or JK-Flip-flip in addition to three pushbuttons but other than that, I don't know what to do. I hate asking for help without having more done, but I can't really seem to even get started. Any help or suggestions would be greatly appreciated. We have been pretty much left to fend for ourselves with minimal resources all semester.
The first thing to ask yourself is what your inputs and outputs need to be and what information your system needs to keep track of.

You talk about needing three inputs (A, B, and C) and you talk about needing a "Clear" input, and you talk about the system disabling itself until it is Reset.

So your description clearly indicates five inputs. Yet when you talk about your solution you only mention needing some flip flops in addition to three push buttons. What happened to the other two inputs you described?

Ask yourself how you would do it yourself. You are the system and I am the person trying to enter the correct combination. At any given time I tell you which button I have just pressed. What do YOU need to keep track of in order to determine whether I have entered the right passcode and whether I have run out of attempts?

#### Tony Vega

Joined Dec 4, 2015
5
Hello Tony Vega

Sorry if I answer with questions.
This 3-letter code (A, B, C) are single bit or each letter represents a binary code; for instance:
A = 0001
B = 0010
C = 0011

A good choice is to use Flip-Flop's type D; but there must be something to 'remember' which button is pressed first, which second and which in third to verify that the sequence (A, B, C) was the right to open the door.

To verify whether the combination of the correct sequence was, a comparator can be used, eg 74LS85 IC called the magnitude comparator.

Also, your design, need to have an counter to verify that three attempts have already been made to open the door.
The A,B,C code is actually just supposed to be 1 bit push button with a corresponding label (A,B, and C). I believe I am making some progress, but still not quite there yet. This is what I have so far... Please don't laugh too hard. This was basically a combination of what I thought it should do and trial and error. Thank you again!

#### Attachments

• 39.2 KB Views: 60

#### Tony Vega

Joined Dec 4, 2015
5
Mod edit: Moved to Homework Help.
Post your work so far with a schematic, block diagram, etc. so we can tale a look.
Welcome to AAC!
Thank you JohnInTX,
here is what I have so far. It is very crude and basically trial and error.But, it's all I have right now.

#### Attachments

• 39.2 KB Views: 47

#### Tony Vega

Joined Dec 4, 2015
5
The first thing to ask yourself is what your inputs and outputs need to be and what information your system needs to keep track of.

You talk about needing three inputs (A, B, and C) and you talk about needing a "Clear" input, and you talk about the system disabling itself until it is Reset.

So your description clearly indicates five inputs. Yet when you talk about your solution you only mention needing some flip flops in addition to three push buttons. What happened to the other two inputs you described?

Ask yourself how you would do it yourself. You are the system and I am the person trying to enter the correct combination. At any given time I tell you which button I have just pressed. What do YOU need to keep track of in order to determine whether I have entered the right passcode and whether I have run out of attempts?
Hello WBahn, thanks for your reply. Okay so I do have 5 inputs, kind of left those out. I have an idea of how to clear the input but now I am just trying to figure out how I would disable input until reset. But I was not sure if the disable would be an input.

As far as what I would need to keep track of, it would be which button was pressed first, second, and third, as well as how many attempts have been made. I beginning to get some ideas here! Okay, so that is really it. Not much that I would need to keep track of, just having trouble implementing it. But that actually helped a lot, thank you!

#### MrCarlos

Joined Jan 2, 2010
400
Hello Tony Vega
The circuit we can look at the image that you enclose seems to work as you expect.
That is, if the buttons have been pressed in the correct sequence the light called 'Open' will light.
But if the sequence is not correct the light does not turn ON.
Here we have to clarify something: how long stays ON that light ?.
You can add a device so that when the door is closed the whole system is restored.
Or a timing circuit to restore the entire system after some time.
To count the attempts to open requires a Counter; when you get three failed attempts the circuit must be inhibited.
This can be achieved by adding a three-input OR gate.
The inputs would be connected to the A, B, C.
It's output we can call 'Three Buttons Pressed' which would be connected to the input Clock of the counter.
When the three buttons were pressed, we have a binary number 11. Which would be connected to a two-input AND gate naming it's output as 'Attempts counter'. This output of the AND gate is connect to another counter to count precisely the attempts to open.
When you get this other binary three (11), use other 2 inputs AND gate to generate the signal that we could call 'Inhibit'.
But again: how long will remain inhibited the system ?
These are ideas that could serve you to continue your project.

#### Tony Vega

Joined Dec 4, 2015
5
I got it to work as needed and got a 100%! Thanks guys! You are awesome, I appreciate the insight and help
This is what I did...

Joined Dec 27, 2015
8
hey, can you send me your project?

#### WBahn

Joined Mar 31, 2012
29,133
hey, can you send me your project?
Why? Are you in need of someone else's work to turn in and take credit for?

Joined Dec 27, 2015
8
Why? Are you in need of someone else's work to turn in and take credit for?
no, my homework is something is similar to this, so it can help me

#### WBahn

Joined Mar 31, 2012
29,133
no, my homework is something is similar to this, so it can help me
What you need to do is post YOUR best attempt to solve YOUR actual homework problem. Then we will be in much better position to assist you.

#### iampatverg

Joined Oct 12, 2016
4
what was the circuit or IC used for the counting of only 3 attempts for error code?

#### iampatverg

Joined Oct 12, 2016
4
Hello Tony Vega
The circuit we can look at the image that you enclose seems to work as you expect.
That is, if the buttons have been pressed in the correct sequence the light called 'Open' will light.
But if the sequence is not correct the light does not turn ON.
Here we have to clarify something: how long stays ON that light ?.
You can add a device so that when the door is closed the whole system is restored.
Or a timing circuit to restore the entire system after some time.
To count the attempts to open requires a Counter; when you get three failed attempts the circuit must be inhibited.
This can be achieved by adding a three-input OR gate.
The inputs would be connected to the A, B, C.
It's output we can call 'Three Buttons Pressed' which would be connected to the input Clock of the counter.
When the three buttons were pressed, we have a binary number 11. Which would be connected to a two-input AND gate naming it's output as 'Attempts counter'. This output of the AND gate is connect to another counter to count precisely the attempts to open.
When you get this other binary three (11), use other 2 inputs AND gate to generate the signal that we could call 'Inhibit'.
But again: how long will remain inhibited the system ?
These are ideas that could serve you to continue your project.

Sir, what kind of IC can I use to achieve a down counter for 3 error code attempts?

#### MrCarlos

Joined Jan 2, 2010
400
Hello iampatverg
There are not a counter specifically to be used for this purpose.
It may be anyone can count, say, up to 4.
For example 74LS192 IC.

#### iampatverg

Joined Oct 12, 2016
4
Hello iampatverg
There are not a counter specifically to be used for this purpose.
It may be anyone can count, say, up to 4.
For example 74LS192 IC.

where did he connect his saved password?

#### MrCarlos

Joined Jan 2, 2010
400
Hola iampatverg

We could say that:
There is not any saved password.
I do not understand what you mean with the word: "connected"
You probably meant "stored" or "saved"

Actually in order to generate the "Open" signal it is necessary to press the buttons in a certain sequence.
The correct sequence is A, B, C. If the buttons are pressed in another sequence, the
"Open" signal will not be generated.

#### iampatverg

Joined Oct 12, 2016
4
Hola iampatverg

We could say that:
There is not any saved password.
I do not understand what you mean with the word: "connected"
You probably meant "stored" or "saved"

Actually in order to generate the "Open" signal it is necessary to press the buttons in a certain sequence.
The correct sequence is A, B, C. If the buttons are pressed in another sequence, the
"Open" signal will not be generated.
Hola iampatverg

We could say that:
There is not any saved password.
I do not understand what you mean with the word: "connected"
You probably meant "stored" or "saved"

Actually in order to generate the "Open" signal it is necessary to press the buttons in a certain sequence.
The correct sequence is A, B, C. If the buttons are pressed in another sequence, the
"Open" signal will not be generated.

What type of D flip flop do I have to use? is it CMOS?

#### MrCarlos

Joined Jan 2, 2010
400
hello iampatverg

Any Flip Flop type D can be used.
I think the CMOS family would be better for immunity to electromagnetic noise, low power consumption Etc.

In the following link you can find the datasheets asking for description: “Flip Flop type D
http://www.alldatasheet.com/