REDSTONEPEDIA › Circuits › Combination locks

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

4 dials · 99 blocks

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

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

4 dialsCombination 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 dial23 blocks
2 dials49 blocks
3 dials73 blocks
4 dials (this page)99 blocks

Try it

Tap a dial's tag in the view (DIAL 1 to DIAL 4) or the frame itself to turn it one step, 8 steps around; the CODE 1 to CODE 4 tags set the code the same way (on a wide screen, the Dial and Code buttons under the view do it too). The output turns on (open) only while every dial shows the same position as its 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 4 dials 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 8 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 dials are the item frames tagged DIAL 1 to DIAL 4, the code frames those tagged CODE 1 to CODE 4: 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 every dial shows the same position as its 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 1DIAL 2DIAL 3DIAL 4CODE 1CODE 2CODE 3CODE 4OUTticks0100200300400500600700800900100011001200130014001500160017001800190020002100220023002400250026002700280029003000310032003300340035003600370038003900400041004200430044004500460047004800490050005100520053005400550056005700580059006000610062006300640065006600670068006900700071007200730074007500760077007800790080008100820083008400850086008700880089009000910092009300940095009600970098009900100001010010200103001040010500106001070010800109001100011100112001130011400115001160011700118001190012000121001220012300124001250012600127001280012900130001310013200133001340013500136001370013800139001400014100142001430014400145001460014700148001490015000151001520015300154001550015600157001580015900160001610016200163001640016500166001670016800169001700017100172001730017400175001760017700178001790018000181001820018300184001850018600187001880018900190001910019200193001940019500196001970019800199002000020100202002030020400205002060020700208002090021000211002120021300214002150021600217002180021900220002210022200223002240022500226002270022800229002300023100232002330023400235002360023700238002390024000241002420024300244002450024600247002480024900250002510025200253002540025500256002570025800259002600026100262002630026400265002660026700268002690027000271002720027300274002750027600277002780027900280002810028200283002840028500286002870028800289002900029100292002930029400295002960029700298002990030000301003020030300304003050030600307003080030900310003110031200313003140031500316003170031800319003200032100322003230032400325003260032700328003290033000331003320033300334003350033600337003380033900340003410034200343003440034500346003470034800349003500035100352003530035400355003560035700358003590036000361003620036300364003650036600367003680036900370003710037200373003740037500376003770037800379003800038100382003830038400385003860038700388003890039000391003920039300394003950039600397003980039900400004010040200403004040040500406004070040800409004100041100412004130041400415004160041700418004190042000421004220042300424004250042600427004280042900430004310043200433004340043500436004370043800439004400044100442004430044400445004460044700448004490045000451004520045300454004550045600457004580045900460004610046200463004640046500466004670046800469004700047100472004730047400475004760047700478004790048000481004820048300484004850048600487004880048900490004910049200493004940049500496004970049800499005000050100502005030050400505005060050700508005090051000511005120051300514005150051600517005180051900520005210052200523005240052500526005270052800529005300053100532005330053400535005360053700538005390054000541005420054300544005450054600547005480054900550005510055200553005540055500556005570055800559005600056100562005630056400565005660056700568005690057000571005720057300574005750057600577005780057900580005810058200583005840058500586005870058800589005900059100592005930059400595005960059700598005990060000601006020060300604006050060600607006080060900610006110061200613006140061500616006170061800619006200062100622006230062400625006260062700628006290063000631006320063300634006350063600637006380063900640006410064200643006440064500646006470064800649006500065100652006530065400655006560065700658006590066000661006620066300664006650066600667006680066900670006710067200673006740067500676006770067800679006800068100682006830068400685006860068700688006890069000691006920069300694006950069600697006980069900700007010070200703007040070500706007070070800709007100071100712007130071400715007160071700718007190072000721007220072300724007250072600727007280072900730007310073200733007340073500736007370073800739007400074100742007430074400745007460074700748007490075000751007520075300754007550075600757007580075900760007610076200763007640076500766007670076800769007700077100772007730077400775007760077700778007790078000781007820078300784007850078600787007880078900790007910079200793007940079500796007970079800799008000080100802008030080400805008060080700808008090081000811008120081300814008150081600817008180081900820008210082200823008240082500826008270082800829008300083100832008330083400835008360083700838008390084000841008420084300844008450084600847008480084900850008510085200853008540085500856008570085800859008600086100862008630086400865008660086700868008690087000871008720087300874008750087600877008780087900880008810088200883008840088500886008870088800889008900089100892008930089400895008960089700898008990090000901009020090300904009050090600907009080090900910009110091200913009140091500916009170091800919009200092100922009230092400925009260092700928009290093000931009320093300934009350093600937009380093900940009410094200943009440094500946009470094800949009500095100952009530095400955009560095700958009590096000961009620096300964009650096600967009680096900970009710097200973009740097500976009770097800979009800098100982009830098400985009860098700988009890099000991009920099300994009950099600997009980099900100000100100100200100300100400100500100600100700100800100900101000101100101200101300101400101500101600101700101800101900102000102100102200102300102400102500102600102700102800102900103000103100103200103300103400103500103600103700103800103900104000104100104200104300104400104500104600104700104800104900105000105100105200105300105400105500105600105700105800105900106000106100106200106300106400106500106600106700106800106900107000107100107200107300107400107500107600107700107800107900108000108100108200108300108400108500108600108700108800108900109000109100109200109300109400109500109600109700109800109900110000110100110200110300110400110500110600110700110800110900111000111100111200111300111400111500111600111700111800111900112000112100112200112300112400112500112600112700112800112900113000113100113200113300113400113500113600113700113800113900114000114100114200114300114400114500114600114700114800114900115000115100115200115300115400115500115600115700115800115900116000116100116200116300116400116500116600116700116800116900117000117100117200117300117400117500117600117700117800117900118000118100118200118300118400118500118600118700118800118900119000119100119200119300119400119500119600119700119800119900120000120100120200120300120400120500120600120700120800120900121000121100121200121300121400121500121600121700121800121900122000122100122200122300122400122500122600122700122800122900123000123100123200123300123400123500123600123700123800123900124000124100124200124300124400124500124600124700124800124900125000125100125200125300125400125500125600125700125800125900126000126100126200126300126400126500126600126700126800126900127000127100127200127300127400127500127600127700127800127900128000128100128200128300128400128500128600128700128800128900129000129100129200129300129400129500129600129700129800129900130000130100130200130300130400130500130600130700130800130900131000131100131200131300131400131500131600131700131800131900132000132100132200132300132400132500132600132700132800132900133000133100133200133300133400133500133600133700133800133900134000134100134200134300134400134500134600134700134800134900135000135100135200135300135400135500135600135700135800135900136000136100136200136300136400136500136600136700136800136900137000137100137200137300137400137500137600137700137800137900138000138100138200138300138400138500138600138700138800138900139000139100139200139300139400139500139600139700139800139900140000140100140200140300140400140500140600140700140800140900141000141100141200141300141400141500141600141700141800141900142000142100142200142300142400142500142600142700142800142900143000143100143200143300143400143500143600143700143800143900144000144100144200144300144400144500144600144700144800144900145000145100145200145300145400145500145600145700145800145900146000146100146200146300146400146500146600146700146800146900147000147100147200147300147400147500147600147700147800147900148000148100148200148300148400148500148600148700148800148900149000149100149200149300149400149500149600149700149800149900150000150100150200150300150400150500150600150700150800150900151000151100151200151300151400151500151600151700151800151900152000152100152200152300152400152500152600152700152800152900153000153100153200153300153400153500153600153700153800153900154000154100154200154300154400154500154600154700154800154900155000155100155200155300155400155500155600155700155800155900156000156100156200156300156400156500156600156700156800156900157000157100157200157300157400157500157600157700157800157900158000158100158200158300158400158500158600158700158800158900159000159100159200159300159400159500159600159700159800159900160000160100160200160300160400160500160600160700160800160900161000161100161200161300161400161500161600161700161800161900162000162100162200162300162400162500162600162700162800162900163000163100163200163300163400163500163600163700163800163900164000164100164200164300164400164500164600164700164800164900165000165100165200165300165400165500165600165700165800165900166000166100166200166300166400166500166600166700166800166900167000167100167200167300167400167500167600167700167800167900168000168100168200168300168400168500168600168700168800168900169000169100169200169300169400169500169600169700169800169900170000170100170200170300170400170500170600170700170800170900171000171100171200171300171400171500171600171700171800171900172000172100172200172300172400172500172600172700172800172900173000173100173200173300173400173500173600173700173800173900174000174100174200174300174400174500174600174700174800174900175000175100175200175300175400175500175600175700175800175900176000176100176200176300176400176500176600176700176800176900177000177100177200177300177400177500177600177700177800177900178000178100178200178300178400178500178600178700178800178900179000179100179200179300179400179500179600179700179800179900180000180100180200180300180400180500180600180700180800180900181000181100181200181300181400181500181600181700181800181900182000182100182200182300182400182500182600182700182800182900183000183100183200183300183400183500183600183700183800183900184000184100184200184300184400184500184600184700184800184900185000185100185200185300185400185500185600185700185800185900186000186100186200186300186400186500186600186700186800186900187000187100187200187300187400187500187600187700187800187900188000188100188200188300188400188500188600188700188800188900189000189100189200189300189400189500189600189700189800189900190000190100190200190300190400190500190600190700190800190900191000191100191200191300191400191500191600191700191800191900192000192100192200192300192400192500192600192700192800192900193000193100193200193300193400193500193600193700193800193900194000194100194200194300194400194500194600194700194800194900195000195100195200195300195400195500195600195700195800195900196000196100196200196300196400196500196600196700196800196900197000197100197200197300197400197500197600197700197800197900198000198100198200198300198400198500198600198700198800198900199000199100199200199300199400199500199600199700199800199900200000200100200200200300200400200500200600200700200800200900201000201100201200201300201400201500201600201700201800201900202000202100202200202300202400202500202600202700202800202900203000203100203200203300203400203500203600203700203800203900204000204100204200204300204400204500204600204700204800204900205000205100205200205300205400205500205600205700205800205900206000206100206200206300206400206500206600206700206800206900207000207100207200207300207400207500207600207700207800207900208000208100208200208300208400208500208600208700208800208900209000209100209200209300209400209500209600209700209800209900210000210100210200210300210400210500210600210700210800210900211000211100211200211300211400211500211600211700211800211900212000212100212200212300212400212500212600212700212800212900213000213100213200213300213400213500213600213700213800213900214000214100214200214300214400214500214600214700214800214900215000215100215200215300215400215500215600215700215800215900216000216100216200216300216400216500216600216700216800216900217000217100217200217300217400217500217600217700217800217900218000218100218200218300218400218500218600218700218800218900219000219100219200219300219400219500219600219700219800219900220000220100220200220300220400220500220600220700220800220900221000221100221200221300221400221500221600221700221800221900222000222100222200222300222400222500222600222700222800222900223000223100223200223300223400223500223600223700223800223900224000224100224200224300224400224500224600224700224800224900225000225100225200225300225400225500225600225700225800225900226000226100226200226300226400226500226600226700226800226900227000227100227200227300227400227500227600227700227800227900228000228100228200228300228400228500228600228700228800228900229000229100229200229300229400229500229600229700229800229900230000230100230200230300230400230500230600230700230800230900231000231100231200231300231400231500231600231700231800231900232000232100232200232300232400232500232600232700232800232900233000233100233200233300233400233500233600233700233800233900234000234100234200234300234400234500234600234700234800234900235000235100235200235300235400235500235600235700235800235900236000236100236200236300236400236500236600236700236800236900237000237100237200237300237400237500237600237700237800237900238000238100238200238300238400238500238600238700238800238900239000239100239200239300239400239500239600239700239800239900240000240100240200240300240400240500240600240700240800240900241000241100241200241300241400241500241600241700241800241900242000242100242200242300242400242500242600242700242800242900243000243100243200243300243400243500243600243700243800243900244000244100244200244300244400244500244600244700244800244900245000245100245200245300245400245500245600245700245800245900246000246100246200246300246400246500246600246700246800246900247000247100247200247300247400247500247600247700247800247900248000248100248200248300248400248500248600248700248800248900249000249100249200249300249400249500249600249700249800249900250000250100250200250300250400250500250600250700250800250900251000251100251200251300251400251500251600251700251800251900252000252100252200252300252400252500252600252700252800252900253000253100253200253300253400253500253600253700253800253900254000254100254200254300254400254500254600254700254800254900255000255100255200255300255400255500255600255700255800255900256000256100256200256300256400256500256600256700256800256900257000257100257200257300257400257500257600257700257800257900258000258100258200258300258400258500258600258700258800258900259000259100259200259300259400259500259600259700259800259900260000260100260200260300260400260500260600260700260800260900261000261100261200261300261400261500261600261700261800261900262000262100262200262300262400262500262600262700262800262900263000263100263200263300263400263500263600263700263800263900264000264100264200264300264400264500264600264700264800264900265000265100265200265300265400265500265600265700265800265900266000266100266200266300266400266500266600266700266800266900267000267100267200267300267400267500267600267700267800267900268000268100268200268300268400268500268600268700268800268900269000269100269200269300269400269500269600269700269800269900270000270100270200270300270400270500270600270700270800270900271000271100271200271300271400271500271600271700271800271900272000272100272200272300272400272500272600272700272800272900273000273100273200273300273400273500273600273700273800273900274000274100274200274300274400274500274600274700274800274900275000275100275200275300275400275500275600275700275800275900276000276100276200276300276400276500276600276700276800276900277000277100277200277300277400277500277600277700277800277900278000278100278200278300278400278500278600278700278800278900279000279100279200279300279400279500279600279700279800279900280000280100280200280300280400280500280600280700280800280900281000281100281200281300281400281500281600281700281800281900282000282100282200282300282400282500282600282700282800282900283000283100283200283300283400283500283600283700283800283900284000284100284200284300284400284500284600284700284800284900285000285100285200285300285400285500285600285700285800285900286000286100286200286300286400286500286600286700286800286900287000287100287200287300287400287500287600287700287800287900288000288100288200288300288400288500288600288700288800288900289000289100289200289300289400289500289600289700289800289900290000290100290200290300290400290500290600290700290800290900291000291100291200291300291400291500291600291700291800291900292000292100292200292300292400292500292600292700292800292900293000293100293200293300293400293500293600293700293800293900294000294100294200294300294400294500294600294700294800294900295000295100295200295300295400295500295600295700295800295900296000296100296200296300296400296500296600296700296800296900297000297100297200297300297400297500297600297700297800297900298000298100298200298300298400298500298600298700298800298900299000299100299200299300299400299500299600299700299800299900300000300100300200300300300400300500300600300700300800300900301000301100301200301300301400301500301600301700301800301900302000302100302200302300302400302500302600302700302800302900303000303100303200303300303400303500303600303700303800303900304000304100304200304300304400304500304600304700304800304900305000305100305200305300305400305500305600305700305800305900306000306100306200306300306400306500306600306700306800306900307000307100307200307300307400307500307600307700307800307900308000308100308200308300308400308500308600308700308800308900309000309100309200309300309400309500309600309700309800309900310000310100310200310300310400310500310600310700310800310900311000311100311200311300311400311500311600311700311800311900312000312100312200312300312400312500312600312700312800312900313000313100313200313300313400313500313600313700313800313900314000314100314200314300314400314500314600314700314800314900315000315100315200315300315400315500315600315700315800315900316000316100316200316300316400316500316600316700316800316900317000317100317200317300317400317500317600317700317800317900318000318100318200318300318400318500318600318700318800318900319000319100319200319300319400319500319600319700319800319900320000320100320200320300320400320500320600320700320800320900321000321100321200321300321400321500321600321700321800321900322000322100322200322300322400322500322600322700322800322900323000323100323200323300323400323500323600323700323800323900324000324100324200324300324400324500324600324700324800324900325000325100325200325300325400325500325600325700325800325900326000326100326200326300326400326500326600326700326800326900327000327100327200327300327400327500327600327700

Swipe the diagram sideways: the whole sequence lasts 327849 ticks (4 h 33 min).

Step by step (4 lines)
dials 3516 code 3516 open after 6 ticks (0.3 s)
dials 4516 code 3516 shut after 8 ticks (0.4 s)
dials 6041 code 6041 open after 6 ticks (0.3 s)
dials 7141 code 6041 shut after 8 ticks (0.4 s)

Measurements

metricvaluewhat it means
dials4
combinationstried 8,192 (4,096 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 8 item frames; a frame turns through 8 positions, one right-click each. The 4 dials 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 placed99 (not counting the input levers or buttons the view adds)
Box5×3×13 (195 blocks of space)
Made of (the blocks that change state)comparator, redstone torch, redstone wire
Inputs / outputsD0 (item frame), D1 (item frame), D2 (item frame), D3 (item frame), K0 (item frame), K1 (item frame), K2 (item frame), K3 (item frame) / OUT
Design filelock4-hid

The design file

on GitHub

Design file (71 lines)
# Combination lock: 4 dials · 99 blocks
# https://vjeux.github.io/redstonepedia/circuits/lock/lock4-hid.html
name: lock4-hid
circuit: lock 4
port input.d0: -3 2 0 frame
port input.k0: 2 2 2 frame
port input.d1: -3 2 5 frame
port input.k1: 2 2 3 frame
port input.d2: -3 2 7 frame
port input.k2: 2 2 9 frame
port input.d3: -3 2 12 frame
port input.k3: 2 2 10 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}
entity: minecraft:item_frame -2.5 2.5 5.5 {Facing:4b,Item:{id:"minecraft:arrow",count:1},ItemRotation:0b}
entity: minecraft:item_frame 2.5 2.5 3.5 {Facing:5b,Item:{id:"minecraft:arrow",count:1},ItemRotation:5b}
entity: minecraft:item_frame -2.5 2.5 7.5 {Facing:4b,Item:{id:"minecraft:arrow",count:1},ItemRotation:0b}
entity: minecraft:item_frame 2.5 2.5 9.5 {Facing:5b,Item:{id:"minecraft:arrow",count:1},ItemRotation:1b}
entity: minecraft:item_frame -2.5 2.5 12.5 {Facing:4b,Item:{id:"minecraft:arrow",count:1},ItemRotation:0b}
entity: minecraft:item_frame 2.5 2.5 10.5 {Facing:5b,Item:{id:"minecraft:arrow",count:1},ItemRotation:6b}
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
  .....S
  .....S
  .....S
  .....S
  .....S
  .....S
  .....S
  .....S
  .....S
  .....S
  .....S
layer 1:
  ..SSAw
  ..SS.w
  ...S.w
  ...S.w
  ..SS.w
  ..SSAw
  .....w
  ..SSAw
  ..SS.w
  ...S.w
  ...S.w
  ..SS.w
  ..SSAw
layer 2:
  .STw
  ..wTSA
  ..SKS
  ..SKS
  ..wTSA
  .STw
  .
  .STw
  ..wTSA
  ..SKS
  ..SKS
  ..wTSA
  .STw