• Switch 1.4: New patch released Jan 18, details are here. Read the full release details here. Report bugs here.

3x3 Combination Lock

Khaios

Duke Fishron
Hello Terrarians!
@ZeroGravitas encouraged me to post this to T-Mec, so here you go!
An expandable 3x3 combination lock. I'm an amateur at logic, so I fully expect there to be more compact and simplified versions. This is just my first attempt ^.^


I apologize now if I over-complicate this in my explanation. I know very little terminology (what little I know, I gathered from Google), and I'm very much so an amateur at this. The explanation is how I see it in my head, but if you'd like me to try and explain it differently, I can certainly try!
3x3 Combination Lock.jpg


The Keypad is laid out similar to most keyboard NumPads (where one is the bottom left corner, and nine is the upper right corner). The decoder is numbered 1-9 from left to right.

As you can see in the video and the above image, I used spear traps lined with teal pressure plates to create pulsers. I tried different pulser designs, but I kept running into loop or crossed wire issues, and eventually settled on this. Those pulsers are combined with AND gates to create the decoder.

The green wire in the decoder sends the signal to unlock, while the yellow wire is a reset line. The decoder will either contain an AND gate connected to a yellow wire (incorrect entry) or an AND gate connected to a green wire (correct entry). A correct entry will never be connected to the yellow (reset) line, and vise-versa.

Since everytime a spear trap in the decoder fires, a delay is created, the green line travels slower than the reset line. The spear traps to the left of the decoder delay the reset line, fixing that issue.

To the right of the decoder is the RS NOR Latch array. If a correct input enters the array (green wire) and the latch below has already been unlocked, then that latch will unlock. This can be identified by the AND gate activating. For the first latch, obviously the only requirement will be a correct input. Incorrect inputs will for previously unlocked latches to reset to their locked position.

When the next latch up unlocks, a reset line will run through the latches below, relocking them. This isn't an issue, as the top-most AND gate will remain active.

Once all four latches have been unlocked, the array will send an output signal through the outer most red (in this case activating the door).

To close the door and reset the lock, simply press any digit on the numpad (the final digit in the sequence will not reset the lock, however).

Decoder.jpg

This is the lock's decoder, the area where the code is programmed into the lock. From left to right (as labelled on the bottom near the signs) are the numbers 1-9 which are linked to the number pad below. Everytime you press a number on the keypad, a signal is sent straight up the corresponding line.

From bottom to top, the decoder is broken into four portions. Each of the four rows will have one number that is part of the lock's code. These are circled black. As you can see, the black circles show the AND gates (green boxes) are connected to green wire. This green wire marks that number as part of the code sequence. Every other AND gate on that row will be connected to a yellow wire. The yellow wire is a reset line, which resets the lock every time a wrong number is entered on the keypad. So, in this example, if you look at all of the green wires, you can see that the code is currently 4-8-5-3.

Changing the code is relatively simple. First, use wire cutters to disconnect the green wire from the AND gates in the circled areas. Connect yellow wire to those gates. Once this is done, the lock no longer has a code stored. To create a new code, choose the numbers that you desire. For this example, let's say 6-1-6-4. The first number in the sequence is 6, so find the number six at the bottom, and follow the line upwards, until you reach the first part of the sequence. Use wire cutters to remove the yellow wire connect to that AND gate, and replace it with green wire. The second number in the sequence is 1. Follow the line up from the 1 sign until you reach the second row of the sequence. Replace the yellow wire with green. Follow this pattern until all four digits have been coded.

WARNING:
The lock utilizes teal pressure plates. Please refrain from shooting projectiles, and dismiss your vanity pets and minions. If one of the pressure plates is accidentally tripped, you may inadvertently break the lock.

Note:
Make sure there is only one green wire connected to an AND get per sequence row. If you have more than one number connected, then your lock is much easier to bypass.

You can use the same number multiple times, so if you really wanted to, your combination can be 1-1-1-1.
Download Link
 
Last edited:

DicemanX

Brain of Cthulhu
Nice work Khaios! Welcome to the T-MEC forums :).

What's really nice about this 1.3.1 update is that it actually offers a ton of flexibility - there are so many ways of constructing various mechanisms. I was also working on a combination mechanism earlier today (having constructed hoik-based ones twice prior) which is radically different from the mechanism you presented. I'll put up a post in another thread once I get the chance ;).
 

Khaios

Duke Fishron
Nice work Khaios! Welcome to the T-MEC forums :).

What's really nice about this 1.3.1 update is that it actually offers a ton of flexibility - there are so many ways of constructing various mechanisms. I was also working on a combination mechanism earlier today (having constructed hoik-based ones twice prior) which is radically different from the mechanism you presented. I'll put up a post in another thread once I get the chance ;).
I look forward to seeing it!
 

inomanoms

Eye of Cthulhu
@ Khaios. Just loving this build... I knew you were a builder, but an engineer too?

I was wondering how fast this mechanism works, so I had a look at @ Zerogravitas' trap cheat sheet. Spears travel @ "30 (8 pixel/tick)", but since the spear tip spawns two tiles away from the block, the runs through the decoder are a per tick activation!

Interesting to see the activation delays to the latch array. Obviously, you will have problems the more numbers you have. The spears are only so long. I would be tempted to use hoiktronics at this point, but a logic gate based delayed relay (@DicemanX) could be made? I imagine?

We now know that gates are activation sources, or "triggers" as Yoraizor describes them in his tutorial posts. Pulses pass from gate to gate on a tick per tick basis. Interesting to see that propagation delay and synchronization are as important as before.
 

Khaios

Duke Fishron
@ Khaios. Just loving this build... I knew you were a builder, but an engineer too?

I was wondering how fast this mechanism works, so I had a look at @ Zerogravitas' trap cheat sheet. Spears travel @ "30 (8 pixel/tick)", but since the spear tip spawns two tiles away from the block, the runs through the decoder are a per tick activation!

Interesting to see the activation delays to the latch array. Obviously, you will have problems the more numbers you have. The spears are only so long. I would be tempted to use hoiktronics at this point, but a logic gate based delayed relay (@DicemanX) could be made? I imagine?

We now know that gates are activation sources, or "triggers" as Yoraizor describes them in his tutorial posts. Pulses pass from gate to gate on a tick per tick basis. Interesting to see that propagation delay and synchronization are as important as before.

That's very interesting to know, indeed!

As for expanding the lock, I have four here, but I could easily stretch it to...maybe 12(?) before running out of spear room. Personally, since I plan on using this in an adventure map, I won't need more than a 6-8 digit password. But, if you did want to expand beyond that, I think the most simplistic route would be to axe my pulser design, and come up with one that doesn't require traps. Baring that, I'd agree with you that hoiks might be the best solution.

Oh, and I wouldn't call myself an engineer. Let's say....enthusiast?
 

DicemanX

Brain of Cthulhu
I look forward to seeing it!

If you're curious about the mechanism I used, here's a quick preview.

At the heart of all combination locks is the need to progress a signal based on the correct input order. Here's one way it can be done very simply (4-digit code is illustrated, but we can have any length):

CvkJl20.png
4mAcxWp.png



The four switches need to be pulled in order from left to right in order for the final dart trap in the sequence to fire (or open a door if this is a combination lock). Pulling a switch automatically resets it as well thanks to the AND gate with a single bulb atop each 2 lamp + AND gate. To make this into a combination lock, all that's needed is to hook up every switch to a counter mechanism that tracks how many times the switches have been pulled. The counter will automatically reset the system after the 4th pull, guaranteeing that the only way for the final dart trap to fire and open the door is to input the precise sequence of numbers.

In this design you can have any combination, including one with repeating digits. The dart traps are necessary to create diodes, because there's no way to reset the gates and still maintain signal progression.

When I make my post, I'll show an example of a 7-digit code using this approach. What I'm really interested in, however, is how to program the code ;).
 

Khaios

Duke Fishron
*Le Snip*
I'm loving this design! Far more compact and simplistic than mine!
I am curious, though, as I'm having trouble seeing it. You said this design can use repeated digits in a combination. How would that be achieved? Through the counter?

None-the-less, this is great! I knew someone would create a better system, I just wanted to see what I could come up with on my own ^.^ Thanks for sharing your ingenuity!
 

Khaios

Duke Fishron
Yeah. That's just the latch shown.
Hmmm. I guess the only "benefit" of my lock (and correct me if I'm wrong) is that there is no need reset the counter between combination attempts...not that it's worth the size difference. I'd take the smaller one over a very minor convenience ;D hehe
 

DicemanX

Brain of Cthulhu
I'm loving this design! Far more compact and simplistic than mine!
I am curious, though, as I'm having trouble seeing it. You said this design can use repeated digits in a combination. How would that be achieved? Through the counter?

You can hook up multiple inputs to the same switch, provided that you have an odd number of connections to the topmost AND gates (you can create a dummy connection to always make sure you have an odd number). For instance, lets suppose that every one of those red wires from the switches was hooked up to the same switch in my example. That would mean you'd have to pull the same switch 4 times to get the 4th trap to fire. However, you'd also need to add a 5th dummy AND gate for this to work. The reason you need an odd number is because you need to make sure the AND gates get shut off after each pull. This can only happen if you pass the same color wire through an odd number of them.

This, incidentally, would also function as a counter mechanism ;). It's really nice when you can use one mechanism to achieve multiple objectives!
[doublepost=1464052825,1464052700][/doublepost]
Hmmm. I guess the only "benefit" of my lock (and correct me if I'm wrong) is that there is no need reset the counter between combination attempts...not that it's worth the size difference. I'd take the smaller one over a very minor convenience ;D hehe

Your mechanism is still of great interest. It's a bit too early to say what the best ways are of building certain machines, because we still have much to explore on a micro level. At this stage all designs are welcomed, because they could create interesting off-shoots. You have some really clever mechanisms in your design!
 

Khaios

Duke Fishron
Thanks for all the info! It's really helpful ;D
I'll keep it in mind as I continue to mess around with logic.
I look forward to what you can squeeze out of this update, though. Very exciting prospects, given your previous work!
 

Khaios

Duke Fishron
A few people have asked how to reprogram the lock's code, so I have added a spoiler to the original post with directions on how to change the code.
 
Top Bottom