Redstone circuits/Logic

A logic gate can be thought of as a simple device that will return a number of outputs, determined by the pattern of inputs and rules that the logic gate follows. For example, if both inputs in an AND gate are in the 'true'/'on'/'powered'/'1' state, then the gate will return 'true'/'on'/'powered'/'1'. Much more in-depth information and a better explanation of this expansive topic is available on Wikipedia.

Below is a list of some of the basic gates with example images and MC Redstone Sim diagrams. There are many different ways to construct them other than those shown below, so use them as guidelines for creating one to fit your needs. Most circuits have multiple valid implementations, with various advantages and disadvantages between designs such as size, complexity, performance, maintenance overhead.

Keep in mind that :
 * tick is the delay between the events "Redstone torch receives power" and "Redstone torch turns off or on". (depending on its initial state);
 * repeaters can be set to 1,2,3,4 tick(s). One tick = 1/10 of a second.
 * The rapid pulser is too fast for repeaters.
 * Also keep in mind that you can use redstone repeaters on the 5-clock pulser, on the 'straight' redstone. If this circuit is going to work, you need to ONLY have the repeaters on the 'straight' redstone or replace some not block-torch gates with repeaters !!! in pairs !!!, up to as little as one not gate. If not in pairs, it will never change state. If that is done, the interval will be "NOT gate count"+"repeater total delay".



A map with these gates and other redstone help can be found here

Piston Circuits
Piston circuits are circuits featuring logic gates created with pistons that are in some cases smaller and more compact than traditional logic gates. Some circuits, such as a 0.5 tick on and 0.5 tick off clock, will need pistons.

Circuit Symbols
Each symbol represents one to three blocks (most often one or two), viewed from above. All descriptions are with reference to a "ground level", the level you are building your gate on.



From left to right:
 * 1) Air: air over air, i.e. two empty blocks, one above the other above ground level
 * 2) Block: air over a block (of any sort)
 * 3) Two Blocks: block over block, i.e. two solid blocks above ground level
 * 4) Redstone Wire: wire (with a block assumed below the wire, below ground level)
 * 5) Redstone Torch: air over Redstone torch (all torches are Redstone torches in circuits)
 * 6) Wire over Block
 * 7) Torch over Block
 * 8) Block over Wire (i.e.: layer 1 is wire; layer 2 is a block)
 * 9) Block over Torch
 * 10) Torch over Wire (i.e.: layer 1 is wire; layer 2 is a torch, attached to adjacent layer 2 block not shown)
 * 11) Bridge: wire on top of block, over wire (with the usual empty air block above the top wire, see Redstone schematics)
 * 12) Lever (aka Switch): air over switch
 * 13) Stone Button: air over button (button lasts 10 ticks)
 * 14) Pressure Plate: air over plate
 * 15) Door: 2-high
 * 16) Shadow
 * 17) Repeater: air over a repeater on any setting, also represents repeater on ground in vertical diagrams
 * 18) Repeater over Block
 * 19) Block over Repeater
 * 20) Dispenser
 * 21) Dispenser on top of a block
 * 22) A block on top of a dispenser
 * 23) Air over a sticky piston
 * 24) Air over a piston
 * 25) A sticky piston on top of a block of any kind
 * 26) A piston on top of a block of any kind
 * 27) A block of any kind on top of a sticky piston
 * 28) A block of any kind on top of a piston

NOT Gate (¬)
A device that inverts the input, as such it is also called an "Inverter" Gate. So if input is on/powered/1/true, then the output is off/unpowered/0/false and vice versa.

OR Gate (∨)
A device where the output is on when at least one of the inputs are on.

A simpler version of the OR gate is design  A : merely a wire connecting all inputs and outputs. However, this causes the inputs to become "compromised", so that they can only be used in this OR gate. If you need to use the inputs elsewhere, either torches (version  B ) or repeaters are necessary for isolation.

Version  C  can be expanded horizontally up to 14 inputs (limited by signal propagation distance on the "bus" wire) is isolated, and is one tick faster than B. However, it requires 3 Redstone to make each repeater.

Version  D  is designed for vertical use, such as in walls. Though its inputs are not necessarily isolated from its outputs, this can be easily fixed with a one-tick repeater immediately after the  B  input. This is the only version that can only take two inputs, but also the only version that does not occupy any horizontal space.

Version  E  utilizes the properties of light-transparent blocks, like half-slabs and glowstone. These send signals up, but not down. It is infinitely expandable, like design  C 

Note that design  B  is a simple inversion of a NOR gate.

NOR Gate (⊽)
A device where the output is off when at least one of the inputs are on. All logic gates can be made from either this gate or the NAND gate. In Minecraft, this is the basic logic gate, implemented by a torch. A torch can have as many as 4 mutually isolated inputs (design B), but 3 can fit comfortably (design A), and all are optional. A torch with 1 input is the NOT gate, and with no inputs is the TRUE gate (i.e. a power source). If more inputs than 4 are necessary, one must resort to the non-isolated OR gate with a NOT at the end (at expense of isolation), or multiple NOR gates, according to the formula A ⊽ B ⊽ C = A ⊽ ¬(B ∨ C) (at the expense of speed, due to the nested gates).

AND Gate (∧)


A device where the output is on when both inputs are on. This behaves in a manner equivalent to a Tri-state buffer, where input B acts like a switch, so that if it is off, input A is disconnected from the rest of the circuit. The discrepancy from real-life tri-state buffers lies in the fact that one cannot drive a low current in Minecraft. (See the Wikipedia article for details.)

The 3 input AND gate is a device where the output is on when all three inputs are on.

An example application would be building a locking mechanism for a door, requiring both the activating button and the lock (typically a lever) to be on.

Designs D, E and G are vertical circuits, shown from the side.

NAND Gate (⊼)
A device where the output is off when both inputs are on. Basically, it's an inverted AND gate, and achieves the exact opposite of a normal AND gate.

Design C is a vertical circuit, shown from the side.

XOR Gate (⊻)
XOR is a device which activates when the inputs are not the same, when only one is on. XOR is pronounced "zor" or "exor," a shortening of "exclusive or," because each input is mutually exclusive with the output. The output will be on only when exactly 1 of the inputs is on. Adding a NOT gate to the end will produce an XNOR gate, which activates when the inputs are equal to each other. A useful attribute is that an XOR or XNOR gate will always change its output when one of its inputs changes, allowing for 2 switches to be combined to open or close a door, or activate another device.

Design D is not useful unless you want the levers to be fixed to the circuit. Design F is the most widely used.

When using Design F it should be noted that a solid block must be placed over each of the two Redstone torches that are not attached to the side of a block, as shown in the diagram at right.

Design I can have its input repeaters coming in from either side or underneath (it depends on block powering), changing its size accordingly to fit tight spaces.

Binary Adder
A binary adder is a device that adds two binary digits together. A half adder has two inputs and one output, and a full adder has three inputs (one 'carry' input) and an output. See Tutorials/Advanced Redstone Circuits for more info.

XNOR Gate (≡)
In logic, this is more commonly referred to as "if and only if," "bi-conditional," or "iff" for short. It is a device which activates only when the inputs are equal to each other. In other words when either input changes, the output changes. This is achieved by inverting the output or one input of an XOR gate. An application of this in Minecraft would be to wire up two levers to the same door. Changing either input would then change the state of the door.

IMPLIES Gate (→)
A device which represents material implication or a conditional statement. Returns false only if the implication A → B is false. That is, if the antecedent A is true, but the consequent B is false. It is often read "if A then B." It is the logical equivalent of "B or NOT A".

This has the Same logic as (A<=B) Is A less than or equal to B (1 = Yes, 0 = No)

Design C has a speed of 2 ticks if output is 1, but 1 tick if the output is 0. If you must synchronize the output, consider placing a repeater in front of input A with a 1 tick delay.