REDSTONEPEDIA › Circuits › Combination locks

Combination lock: item frames as dials, opens only at the code

1 dial · 23 blocks

Its output turns on only while its dial (an item frame, 8 positions) is turned to the same position as its code frame, on the other side of the machine; set the code by turning the code frame, and keep that side out of sight.

made of comparator, redstone torch, redstone wire · fits in 5×3×3

1 dialCombination lock3D view loading (or not available in this browser)

Every number of dials 4

The best design for each number of dials: pick one to see it.

number of dialsblocksnumbers
1 dial (this page)23 blocks
2 dials49 blocks
3 dials73 blocks
4 dials99 blocks

Try it

Tap the dial's tag in the view (DIAL 1) or the frame itself to turn it one step, 8 steps around; the CODE 1 tag sets the code the same way (on a wide screen, the Dial 1 and Code 1 buttons under the view do it too). The output turns on (open) only while the dial shows the same position as the code frame. In the game, right-click a frame to turn it. To open a door with it, run redstone dust from its output (where the view shows the lamp) to the door.

How this design does it: The 1 dial hang on the front (west) face; the code frames hang on the back (east) face, facing away, so a player at the dials sees only the dials and the output, never the code.

Build it

Download .litematic Download the design as text

The .litematic opens in Litematica (Minecraft 26.3): every block of the design in one region. The text file is the same build written as plain text, block by block.

Its 2 item frames must each hold an item (arrows in the download; any item works): building it by hand, put one in each frame. A right-click turns a frame's item one step of 8.

Blocks used: comparator item frame redstone torch redstone wire stone

Details: how it works, measurements and properties

In depth

turns its output on only while every item-frame dial shows the same position as its own code frame; set the code by turning the code frames

How to try it

The dial is the item frame tagged DIAL 1, the code frame the one tagged CODE 1: tap a tag, or its button under the view, to turn that frame one step (8 steps around). The output, tagged OUT, turns on only while the dial shows the same position as the code frame. Drag to look around, pinch or scroll to zoom.

Inputs and output over time

The inputs follow this schedule (the 3D view's demo plays the same). Lime: an input is on; orange: the output is on (taller = a stronger signal, 1 to 15). Time runs left to right in game ticks (20 ticks = 1 s).

DIAL 1CODE 1OUTticks050100150200250300350400450500550600650700750

Swipe the diagram sideways: the whole sequence lasts 773 ticks (38.65 s).

Step by step (3 lines)
dials 3 code 3 open after 6 ticks (0.3 s)
dials 4 code 3 shut after 8 ticks (0.4 s)
dials 6 code 6 open after 6 ticks (0.3 s)

Measurements

metricvaluewhat it means
dials1
combinationstried 16 (8 per code, 2 codes)
opens within6 ticks (0.3 s)
closes within8 ticks (0.4 s)

Notes from its designer

Put any item in each of the 2 item frames; a frame turns through 8 positions, one right-click each. The 1 dial hang on the front (west) face; the code frames hang on the back (east) face, facing away, so a player at the dials sees only the dials and the output, never the code. Set the code from behind by turning the code frames, then turn the dials to match them: the torch at the north end, under the bus, lights (open) only when every dial shows the same position as its code frame, and never for a moment while you turn. Wire a piston door or an iron door to that torch. Inside, per dial: a comparator behind the code frame's block reads the code and powers a block beside the code dust, so the dust carries the code at full value; the dial's comparator passes the dial's value only if it is at least the code (else a torch under its dust lights), and a second comparator passes the code only if it is at least the dial's value (else a torch on its block lights). One dust line under all the torches joins every mismatch into the block under its north end, which turns the output torch off (opens within 6 ticks, closes within 8). A dial takes 3 rows; dials pair up back to back, with one empty row between pairs.

Properties

StudyCombination locks
KindCombination lock: item frames as dials, opens only at the code
Blocks placed23 (not counting the input levers or buttons the view adds)
Box5×3×3 (45 blocks of space)
Made of (the blocks that change state)comparator, redstone torch, redstone wire
Inputs / outputsD0 (item frame), K0 (item frame) / OUT
Design filelock1-hid

The design file

on GitHub

Design file (29 lines)
# Combination lock: 1 dial · 23 blocks
# https://vjeux.github.io/redstonepedia/circuits/lock/lock1-hid.html
name: lock1-hid
circuit: lock 1
port input.d0: -3 2 0 frame
port input.k0: 2 2 2 frame
port output: 1 0 0
entity: minecraft:item_frame -2.5 2.5 0.5 {Facing:4b,Item:{id:"minecraft:arrow",count:1},ItemRotation:0b}
entity: minecraft:item_frame 2.5 2.5 2.5 {Facing:5b,Item:{id:"minecraft:arrow",count:1},ItemRotation:3b}
origin: -3 0 0
palette:
  S minecraft:stone
  w minecraft:redstone_wire
  T minecraft:comparator[facing=west,mode=compare,powered=false]
  K minecraft:comparator[facing=east,mode=compare,powered=false]
  A minecraft:redstone_wall_torch[facing=east,lit=true]
  O minecraft:redstone_wall_torch[facing=west,lit=true]
layer 0:
  ....OS
  .....S
  .
layer 1:
  ..SSAw
  ..SS.w
  ...S
layer 2:
  .STw
  ..wTSA
  ..SKS