2
\$\begingroup\$

Imagine you are giving a gift to someone, but you want them to solve your question and enter your secrete password.

You want the password to be entered in order and if touch any other will fail. For example if you want enter "dog", then we can use:

enter image description here

*from "make: electronics"

the user have to press button E,F,G,H in sequence without touching button B,C,D to get output from the last logic gate.

But what about when you want him enter a password like "hook"? (with 2 same letter)

*In the current circuit if you push "hok" instead of "hook" it will also work.

but we only want the user press "hook"

I designed a circuit, but seems missing something:

enter image description here

anyone have any idea?

\$\endgroup\$
  • 6
    \$\begingroup\$ You need at minimum a state machine. In any realistic implementation you use an MCU. \$\endgroup\$ – Chris Stratton Nov 14 '19 at 17:29
3
\$\begingroup\$

You'd need a machine that walks from "locked, no entry" through "all letters so far right, at the Nth letter" to "unlocked" (or returns to the original state if any entered letter wasn't right for the position you are), with only pre-defined state transitions.

We call such a machine a finite state machine (FSM).

Your FSM is a relatively complex one, so it's a hassle to design in discrete logic.

It's, however, only a few lines of computer code. (Computers really are just very complex FSMs that we can make behave like any FSM.)

Thus, the logical and time-economical way forward here is learning how to use a microcontroller and how to write software for it; luckily, projects like Arduino make that both easy and relatively affordable.

\$\endgroup\$
2
\$\begingroup\$

If you were resigned to doing this without a microcontroller you would want a binary counter (like 74ls93 http://www.ti.com/lit/ds/symlink/sn74ls93.pdf) which would do the following:

  • counts up from 0 to 4 for each correct character entered in 'hook' with binary outputs Oa Ob Oc Od
  • reset to 0 for any incorrect character entered

Logic on the output of your counter would only unlock if it reached the count of the highest correct letter. e.g. counter has reached 4 so your AND gate across the counter outputs would finally unlock because you have !Oa !Ob Oc !Od.

Logic on your buttons would have to check the current counter output and either increment the counter if current output matches the expected character or reset if not a match.

The 'o' in your hook example would check if the counter read 1 OR 2 across the outputs:

Oa !Ob !Oc !Od OR !Oa Ob !Oc !Od

I would start by designing for a simple case of pressing 1 letter correctly and expand from there

\$\endgroup\$
1
\$\begingroup\$

Thanks for suggestions!

Now i have successfully built the circuit part for "o" for my answer "hook"

Because this case I just need 2 "O" so I just used a simple counter. enter image description here

Let's imagine I write "o" on the top button, and the below button will be any other letter,the user will get output from the AND gate (which we could power the next AND gate or a little motor) only if they enter 2 "o" without touching the other button

And i Used 4026 chip with 7408 chip created it, and it worked:

enter image description here

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.