Tutorials/Advanced redstone circuits

Advanced electronic mechanisms are mechanisms that deal with more complicated Redstone circuitry. For simpler mechanisms, see Tutorials/Mechanisms, Tutorials/Traps, and Redstone.

Order Insensitive Combination Locks
A door that opens when a certain combination of buttons/levers are on. (Note: A moderate understanding of logic gates is needed for this device.)

RSNOR Combo Lock
Connect a series of buttons to the S-input of RS Latches. Feed the Q or Q (choose which one for each latch to set the combination) outputs of the RS Latches into a series of AND gates, and connect the final output to an iron door. Finally, connect a single button to all the R-inputs of the RS Latches. The combination is configured by using either Q or Q for each button (Q means that the button would need to be pressed, Q don't press) Example:



With the automated reset it causes the correct combo to cause a pulse instead of a "always on" until reset.

Example
How to (pdf) work the logic for an combo lock out. And implementation (youtube) in minecraft.

AND Combo Lock
The AND based combo lock uses switches and NOT gate inverters instead of the RSNOR latches in the previous design. This makes for a simpler design but becomes less dynamic in complicated systems and it also lacks an automated reset. The AND design is configured by adding inverters to the switches. Example:

OR Combo Lock
The OR combo lock is actually a AND combo lock without unnecessary repeaters, override lever and last inverter. Output is off when the code is correct.

Due to its compact size and fast response time, this combination lock is also ideal for use as an address decoder in the construction of addressable memory (RAM)

Design A. Code is set by torches on inputs (1001):



You can expand on this by creating a new level ontop of the first and using the same principle as the first level, keep creating them.

Design B. Code is set by inverters in the blue area (001001):



N - number of inputs. K - number of 1's in code.

Order-sensitive RSNOR Combo Lock
A door that opens when buttons are pressed in certain order.

(Note: A moderate understanding of logic gates is needed for this device.)

Make a series of buttons, and connect only one to an RSNOR latch. Then connect both the RSNOR latch and a second button to an AND Gate, which feeds to another RSNOR latch. Do this continually until you have either filled all of the buttons or are satisfied with the lock. Connect the final RSNOR latch to a separate AND Gate with a signal from an enter button. Feed that to the output RSNOR latch. Then connect any of the left-over buttons to the enter button and send reset signals to all of the RSNOR latches. A pressure plate next to a door can reset the door.

Binary to Decimal (Demultiplexer)
A series of gates that convert a 3bit binary input from inputs into a decimal output from 0-7. Useful in many ways as they are compact 5x5x3 at the largest.

These can be linked in a series from one input source but it is recommended to place an inverter before each input into the circuit to keep them isolated from interacting with the other circuits since some drive a combination of High and Low current.

Need clarification but some of these may also work as Tri State buffers or as close as possible with redstone depending on your setup.

Computation
Using logic gates, we can arrange them to make binary calculations, like in a computer. When using the gates below, mind the inputs and outputs. You may be wondering why there are so many inverted signals being used instead of the regular signal. The adders below use XNOR gates rather than XOR gates because they are more compact. As a result, IMPLIES gates must be used instead of an AND gate, which also happen to be more compact. Therefore for the most compact adder, inverse signals must be used. These adders are too complex to be easily deciphered with 2 layers per square, so each single layer has been drawn separately to ease the building process.

Half Adder


Gates: XNOR, IMPLIES

Torches: 12

Redstone: 7

Blocks: 19

Size: 5X4X4

This adder will take 2 bits and add them together. The resulting bit will be the output of S (sum). If both bits are 1, there will be a carry over, and C will become 1 ( C will become 0). This half adder can be modified to create a non inverted C output, but this configuration is used so that it can be implemented as the start of a chain of full adders.

an alternate option for an Half Adder:



Gates: AND 2x, OR, INVERT

Torches: 6

Redstone: 19

Blocks: 10

Size: 8x6x3

Like the previous mentioned half adder, it take 2 bits as input, outputs C(arry) and the S(um).

Full Adder (1 Bit Adder)
AS A FOREWARNING THIS DESIGN IS WRONG! It uses an OR instead of an AND to combine the two half adders.



Gates: XNOR (2), IMPLIES, NOT, OR, AND

Torches: 16

Redstone: 32

Blocks: 48

Size: 6X12X5 Ceiling to floor, including I/O spaces.

This adder will take 2 bits and a carried over bit (actually C, rather than C, a value held in the redstone in the bottom left corner on layer 1) and add them all together, producing a sum (S) bit and a carry (actually C rather than C).

4 Bit Adder


'''Note! The least significant digit ("ones" digit) is on the left of the diagram so that the progression from half adder to the full adders can be seen more clearly. Reverse the diagram if you want a conventional left to right input.'''

Gates: XNOR (7), IMPLIES (4), NOT (4), OR (3), AND (3)

Torches: 56

Redstone: 108

Blocks: 164

Size: 23X12X5

This adder will take 2, 4 bit numbers (A and B) and add them together, producing a sum (S) bit for each bit added and a carry (C) for the whole sum. The sum bits are in the same order as the input bits, which on the diagram means that the leftmost S output is the least significant digit of the answer. This is just an example of a string of adders; adders can be strung in this way to add bigger numbers as well.

An alternate 4-bit adder using the alternate full and half adders.



Alternate Full Adder


Source: "red stuff" logic gates

Carry input and output are aligned to easily connect many of these modules in series.

Torches: 14

Redstone wire: 15

Size: 5x6x3

Related pages

 * Redstone
 * Redstone (wire)
 * Redstone (ore)
 * Redstone (dust)
 * Redstone Torch
 * Redstone circuits
 * Mechanisms
 * Traps