# Need help understanding this simple Keypad Lock

#### kkim0228

Joined Apr 7, 2012
2
Hi,

This is my first post in the forum. I don't have a significant background knowledge on circuits but need to understand the attached circuit diagram. I didn't have anyone to turn to, so after much frustration trying to understand it by myself and googling around, I arrived here to ask for help from you all. Thank you in advance.

The circuit is a simple keypad lock that uses 3 AND logic gates and opens upon punching the code ABC in that order. What I don't understand is the role of the resistors. Are they needed to prevent a current overflow? R5 probably serves that function. But it isn't immediately clear what other four resistors do. Do R1-4 all serve the same purpose or not? Are they needed for the "memory" function of the loop (i.e. the circuit has to remember that the key "A" was pressed even when the key is no longer being pressed down)?

In other words, what would happen if the resistors were not there?

#### Attachments

• 98.3 KB Views: 50

#### mlog

Joined Feb 11, 2012
276
R5 limits the current through the LED.

As for R2-R4, let me ask you a question. Looking at U1A, what can affect the input pin 2 of U1A?

As for R1, what do you think would happen if it wasn't there? What would happen to the +5 volt power supply if R1 was zero ohms?

#### kkim0228

Joined Apr 7, 2012
2
As for R1, I see that without R1, the current will short from the top +5V to ground on the left when SR (reset switch) is pressed.

When SR is not pressed (lock in action), pin 1 is +5V. Upon pressing S1, pin 2 becomes +5V so U1A output is a "yes". I do not know what kind of output (voltage or current) will pin 3 carry, but eventually all the pins of U1A (1, 2, and 3) should be at +5V (but no current flow after reaching the static state). That means pin 4 is also +5V. Pressing S2 will trigger the next cascade at U1B and so on.

Now, what does R2 do? What harm would there be without R2 (or R3 or R4)? I honestly don't know.

R5 limits the current through the LED.

As for R2-R4, let me ask you a question. Looking at U1A, what can affect the input pin 2 of U1A?

As for R1, what do you think would happen if it wasn't there? What would happen to the +5 volt power supply if R1 was zero ohms?

#### WBahn

Joined Mar 31, 2012
26,398
While this is a cute little circuit for exploring some concepts, it is actually a pretty poor circuit that (most likely) doesn't even meet its intended spec.

The questions asked by mlog are good, so I will try not to step on them too much. But there are a few points that it may be unreasonable for you to see on your own.

With regard to R1, consider the question asked by mlog when switch SR is being held down.

Now consider what the voltage at the input would be when the switch is not being held down if R1 wasn't there at all. Specifically, you would have a floating input to a logic gate. Most logic families do not deal with this situation well (a few do), so it is best to always ensure that no input is ever left floating. Now, since it is probably safe to assume that this is all new to you, there are a couple of points that people that have seen stuff like this simply assume but that you have no reason to. In particular, you can assume that the value of R1 is chosen so that the voltage drop across it is small whenever the only current flowing in it is due to a logic gate input. As a result, it "pulls up" the input to a logic HI if one end is connected to the input and the other end is connected to the positive logic supply (as it is in this case) or to a part of the circuit that is presently at a similar voltage. It accomplishes this if no stronger signal source (like a low resistance path to ground when a switch is pressed, for example) overrides it.

Likewise, it "pulls down" the input to a logic LO if one end is connected to the input and the other end is connected to the negative logic supply (which is 'ground' in most cases) or to a part of the circuit that is presently at a similar voltage. Again, it accomplishes this if no stronger signal source (like a low resistance path to the positive logic supply when a switch is pressed, for example) overrides it.

You are very much on the right track in your thinking about the memory function associated with the presence of these resistors.

Once you think you understand it, consider what would happen if the person presses the sequence ACBAC. Should it open in this instance based on your understanding of how it should behave? Will it open in this instance based on your understanding of how it DOES behave?