Redstone circuitry is a feature introduced in Alpha which allows for intricate Redstone wire based mechanisms to be created by players.
It's also possible to use pistons in Redstone circuits.
Please note: Due to a bug in the way redstone torches burnout some designs will not currently work.
- 1 Basic Mechanics
- 2 Logic Gates
- 3 Latches & Flip-Flops
- 3.1 RS NOR Latch & Input-Stabilizers
- 3.2 RS NAND Latch
- 3.3 D Flip-Flop & Gated D Latch
- 3.4 JK Flip-Flop & Latch
- 3.5 T Flip-Flop
- 3.6 Pulse Generators
- 3.7 Pulse Limiters
- 3.8 Pulse Sustainer
- 3.9 Monostable Circuits
- 3.10 Zero-Crossing Detector
- 3.11 Edge Detectors
- 4 Other Redstone Components
- 4.1 Repeater/Diode
- 4.2 Traditional Repeater/Diode
- 4.3 Instant Repeaters
- 4.4 Rail T Flip-Flop
- 4.5 Two-Way Repeater
- 4.6 The North/South Quirk
- 4.7 Delay Circuit
- 4.8 Clock Generators
- 4.9 Controllable Clock
- 4.10 Adjustable Redstone Blinker
- 4.11 ABBA Switch
- 4.12 Vertical Transmission
- 4.13 Multiplexer
- 4.14 Relay(Demultiplexer)
- 4.15 Shift Register
- 4.16 Random Number Generator/Randomizer
- 4.17 Pseudo-random Number Generator
- 4.18 Block Update Detector
- 4.19 Item Button
- 4.20 On/Off Switch
- 5 Mechanical to Redstone Conversion
- 6 Redstone to Liquid Kinetic Conversion
- 7 Detecting Pulse Length
- 8 Detecting Short Pulses
- 9 Triggered Repeater
- 10 Inverted Triggered Repeater
- 11 Glowstone, Stairs, and Slabs
- 12 Piston doors
- 13 Related pages
- 14 References
Redstone dust acts as a power conductor. A signal will travel through 15 redstone before dying out. To increase the range, place Redstone repeaters in the circuit. To place Redstone dust, right-click on a block while holding Redstone dust. You cannot place redstone on sides of blocks, but redstone wire will automatically connect to wiring one block lower than it. Note that Redstone can't be placed on glass. Also note that Redstone dust can't be placed on non solid blocks (e.g., leaves)
Some blocks in Minecraft may be powered or unpowered. Think of a "powered block" as any block or empty space (though not truly empty, an Air block can be powered) that is invisibly electrified but safe to touch.
Power may be transmitted from a powered block to one or more of the six directly adjacent blocks. To transmit power, a block must be one of the following:
- an active power source (a Redstone Torch),
- the block to which a switch is attached (that is, the block under a pressure plate or the block on which a lever or button is mounted),
- the block a switch is in,
- a block immediately following a Redstone Repeater.
- the block above a Redstone Torch
- an active power conductor (Redstone Wire that is immediately adjacent to a powered block).
One must be careful to note that a Redstone torch placed on the side of a block of dirt is actually part of the block next to the dirt, not part of the dirt block itself. Similarly, Redstone wire that is placed on top of a block of dirt is part of the block above the dirt. However, if the block on which the Redstone wire is placed becomes powered in any way, so does the Redstone wire.
Each actively powered block transmits power in several directions, depending on the contents of the block:
- A Redstone torch powers itself and the block directly above it, unless that block is air. Because of how Redstone wires work, this also activates adjacent power circuits or conduits(Redstone Wire).
- A pressure plate activates the block it is physically located in, as well as the block below (on which it is placed).
- A Detector Rail acts exactly the same as a pressure plate but will only be activated when a minecart of any kind rests on it.
- A Lever powers the block in which it is located and the block on which it is placed.
- A button powers the block in which it is located and the block on which it is placed.
- Redstone Wire powers itself, the block below it, or the block it is pointing to.
Redstone Wire & Signal Strength
Whether a block is weakly or normally (strongly) powered affects how Redstone wires interact with it. Blocks are strongly powered by Redstone power sources; torches (from below), repeaters, levers, pressure plates etc. If a block is powered only by Redstone wire then it is weakly powered. Redstone wire which is adjacent to, on top of, or below a block that is strongly powered will become active. It will not become active if that block is weakly powered. Redstone wire can be implemented into many useful designs such as sliding doors, wiring multiple things such as lanterns together, make timers, and many more.
A device, such as a door, a rail, a powered rail, a block of TNT, a piston, a sticky piston, a trapdoor, a redstone lamp, a dispenser, a note block or fence gate is activated when an adjacent block is powered. As a simple example, placing a Redstone torch next to a door will change the state of the door to on. Similarly, standing on a pressure plate immediately adjacent to a door will activate the door. However, standing on a pressure plate two blocks away from a door will not activate the door, because the power does not reach the block next to or under the door.
To power devices at a distance, the power must be conducted from the active power source to the device; Redstone wire is used for this purpose. As noted above, the Redstone wire is part of the block it is physically located in, not the block to which it is attached. Redstone wire, or dust, has two states: on (lit) and off (unlit).
The simplest way to activate Redstone wire is to put a Redstone torch or switch adjacent to the wire. It also works to have a torch or switch directly above the wire, attached to a wall.
A Redstone torch is itself a powered device; its default state is "on", but it will be turned off if it receives power from the block to which it is attached. This feature, along with the use of wire to transmit power in particular directions over distance, is the basis for the advanced Redstone devices and circuitry below.
Care must be taken to follow the power rules precisely, or one might see unexpected results. For example, consider a pressure plate. Activating the plate will power the block underneath the plate as well as the block in which the plate resides. Nevertheless, Redstone wire beneath this block will still be powered, because it is adjacent to the powered block above it. However, activating the plate will not turn off a Redstone torch placed beneath the powered block—in fact, placing a Redstone torch under the block under the pressure plate will power it continuously, effectively disabling the plate.
Specific Powered Devices
Certain devices act in specific ways, for example:
- If a block is powered, then a Redstone torch attached to it will deactivate.
- If a block is powered, then a door on top of it or adjacent to it will toggle its state from open to closed or vice versa. (The actual state will depend because doors were implemented unintuitively.)
- If a note block or a dispenser is powered, then it will play or shoot once, respectively.
- If a block is powered and rails are above it, then they will toggle shape (the player can still have the wiring power the rail directly).
- If a piston is powered, then it will activate.
Not only does it matter in some circuits if something gets powered, but also for how long something gets powered. The different Redstone power sources produce different signal durations. The four main sources produce signals according the following list:
- Redstone Torches - produce in its burning state an unlimited duration signal.
- Pressure Plates - produce signals for as long as they are activated.
- Levers - produce in their 'on' state unlimited duration signals.
- Buttons - produce a 10 tick (1 second) duration signal when pushed.
The duration of a signal can be changed by different circuits and is very important when different blocks need to interact with each other. A sticky piston, for example, needs one tick to push outward (should be changed to two ticks in 1.3.1; using a Pulse Limiter set to one redstone-tick the pistons still seem to push blocks though), but it seems to need a bit over a tick to attach again to something 1 block away from it. So it would not pull a block back if it only gets powered for 1 tick. If a block was standing apart from the piston, it would be pulled back if the sticky piston was only powered for one tick.
Problems with short signals Overall, very short signals seem to be prone to not correctly interact with the game world, as the update cycle on the blocks seems sometimes to lag behind. Rapidly changing signals seem to make it even worse. Pistons are very prone to make such problems visible, as they seem to react faster to power changes than their neighboring blocks seem to update.
Common errors to avoid
The following are common errors to avoid:
- Placing next to TNT.
- Placing next to Water.
- Trying to transmit power through a block that doesn't have any Redstone wire on it. While a generic block (dirt, sand, gravel, etc.) adjacent to the end of a wire can receive power, it will not transmit that power to wire on the other side, because it is not one of the blocks that can transmit power. If you have a block that you cannot move, send wire around it (including on top of it). Alternatively, you can put a repeater on the side transmitting power, as repeaters can send power through blocks (see below).
- Trying to transmit power through a block that is transparent or non-solid(e.g. Glass, Slabs, Stairs, Cake, etc.), as they will not allow redstone current to pass through.
- If a block has Redstone wire on top and a Redstone torch on the side, then the block above the torch must be either air, glowstone, glass, farmland or a half-tile (unless you know what you're doing). If you place any solid block above the torch, it will create a feedback loop and the torch will probably burn out.
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 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.
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:
- Air: air over air, i.e. two empty blocks, one above the other above ground level
- Block: air over a block (of any sort)
- Two Blocks: block over block, i.e. two solid blocks above ground level
- Redstone Wire: wire (with a block assumed below the wire, below ground level)
- Redstone Torch: air over Redstone torch (all torches are Redstone torches in circuits)
- Wire over Block
- Torch over Block
- Block over Wire (i.e.: layer 1 is wire; layer 2 is a block)
- Block over Torch
- Torch over Wire (i.e.: layer 1 is wire; layer 2 is a torch, attached to adjacent layer 2 block not shown)
- Bridge: wire on top of block, over wire (with the usual empty air block above the top wire, see Redstone schematics)
- Lever (aka Switch): air over switch
- Stone Button: air over button (button lasts 10 ticks)
- Pressure Plate: air over plate
- Door: 2-high
- Repeater: air over a repeater on any setting, also represents repeater on ground in vertical diagrams
- Repeater over Block
- Block over Repeater
- Dispenser on top of a block
- A block on top of a dispenser
- Air over a sticky piston
- Air over a piston
- A sticky piston on top of a block of any kind
- A piston on top of a block of any kind
- A block of any kind on top of a sticky piston
- 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.
|Size (width (x) x height (y) x length (z))||1x1x1||3x2x1||(2n-1)x1x2||3x3x1||1x2x(n-1 when > 2)|
|Redstone||1||1||(2n-1)||4||(n - 1)|
|Inputs isolated?||No||Yes||Yes||Only A (and B if using repeater)||yes|
|Output isolated?||No||Yes||Yes||Only from A (both if using repeater)||yes|
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.
|Input Isolated?||No||No||A only|
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.
|Glowstone, Stair, or Slab blocks||0||0||0||0||0||0||0||0||3|
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.
|Inputs isolated?||Only A||Only A||Yes||Only A|
Latches & Flip-Flops
Latches and flip-flops are effectively 1-bit memory cells. They allow circuits to store data and deliver it at a later time, rather than acting only on the inputs at the time they are given. Functions using these components can be built to give different outputs in subsequent executions even if the inputs don't change, and so circuits using them are referred to as "sequential logic". They allow for the design of counters, long-term clocks, and complex memory systems, which cannot be created with combinatorial logic gates alone.
The common feature at the heart of every Redstone latch or flip-flop is the RS NOR latch, built from two NOR gates whose inputs and outputs are connected in a loop (see below). The basic NOR latch's symmetry makes the choice of which state represents 'set' an arbitrary decision, at least until additional logic is attached to form more complex devices. Latches usually have two inputs, a 'set' input and a 'reset' input, used to control the value that is stored, while flip-flops tend to wrap additional logic around a latch to make it behave in different ways.
RS NOR Latch & Input-Stabilizers
A device where Q will stay on forever after input is received by S. Q can be turned off again by a signal received by R.
One useful feature of the RS NOR is that it can turn an impulse into a constant redstone signal, similar to a lever in the "On" position. This can be done with separate locations for the On and Off buttons/plates/trip wires and mixed signal length circuits, unlike a lever.
This is probably the smallest memory device that is possible to make in Minecraft. Note that Q̅ means the opposite of Q, e.g. when Q is on, Q̅ is off and vice-versa. This means that in certain cases, you can get rid of a NOT gate by simply picking the Q̅ output instead of putting a NOT gate after the Q output.
A very basic example of use would be making an alarm system in which a warning light would stay turned on after a pressure plate is pressed, until a reset button is hit. Or a train track switch with Q and Q̅ being detector rail.
In the truth table, S=1, R=1 is often referred to as forbidden, because it breaks the inverse relationship between Q and Q̅. Also, some designs where the input is not isolated from the output, such as B and D, will actually result in Q and Q̅ both apparently being 1 in this case. As soon as either S or R becomes 0, the output will be correct again. However, if S and R both become 0 on exactly the same tick, the resulting state could be either Q or Q̅, depending on quirks of game mechanics. In practice, this input state should be avoided because its output is undefined. In design E, S=1 and R=1 results in both Q=0 and Q̅=0.
Along with traditional Redstone designs, an RS-NOR latch can also be achieved with a Sticky Piston. If a repeater is connected into itself, and given power, the power is maintained until the circuit is disconnected. If a Sticky Piston is positioned with a block to cut off power, it can be connected to the R input and reset it. This method is much simpler than traditional Redstone designs, but takes up somewhat more space. A more compact version of this type of RS-NOR latch can be constructed as of Minecraft 1.0, taking up either a 2x5x2 space if the piston remains on the level of circuitry, or 2x3x4 space if it is placed vertically.
Note that designs H, J, and K only have a Q output, and no Q̅. Design H is vertically oriented and is shown from the side.
|0||0||Keep state||Keep state|
On another note, you can make an RS NOR Latch disable itself any number of ticks after the RS NOR Latch is true. Split the output redstone path into 2 parts and then place Repeaters on the second path. Lead the second path in to the input that will turn off the Latch. When you turn on the Latch, the redstone will turn off the Latch. This is good for timed parkour jumps.
Enable/Disable RS NOR latch
This can be made by having AND gates on the inputs, and connecting both AND gates to a third input, E. If E is true, the memory cell works as normal. If E is false, the memory cell will not change state.
This device will stabilize an input once received even after the input source stops. It is essentially a non-resettable RS-NOR Latch where a repeater powers itself. For example a stone button or pressure plate signal could be turned into a permanent power source with one push. This device can be turned into an RS NOR latch with the addition of two sequential NOT gates (torches) along the top row. When the second (right hand) torch is powered, the state returns to 0. This can also be achieved with a piston. They are useful for traps where the trapped player has to stand on a pressure plate or button as they can't be reset.
The simplest solution to reset this circuit is to attach a block to a sticky piston in and have it extended on a NOT gate right behind the repeater. Since blocks carry a redstone signal, the circuit will function until a shutoff wire is tripped and the piston retracts. This can also be placed on an oscillator so that instead of acting like a shutoff, it acts as a reset.
RS NAND Latch
Since NOR and NAND are the universal logic gates, a design for an RS NAND latch is just an RS NOR with inverters applied to the inputs and outputs. The RS NAND is logically equivalent to the RS NOR as the same inputs for R and S give the same outputs. This circuit is impractical in Minecraft because a single Redstone torch acts as a NOR gate.
When S and R are both off, Q and Q are on. When S is on, but R is off, Q will be on. When R is on, but S is off, Q will be on. When S and R are both on, it does not change Q and Q. They will be the same as they were before S and R were both turned on.
|1||1||Keep state||Keep state|
D Flip-Flop & Gated D Latch
A D flip-flop, or "data" flip-flop, sets the output to D only when its clock input transitions from OFF to ON (positive edge) or ON to OFF (negative edge). A flip flop is said to be an edge triggered device, while a gated latch is a level triggered device (triggered on either an OFF or ON clock/enable input). The basic level-triggering gated D latch (design A) sets the output to D as long as the clock is set to OFF, and ignores changes in D as long as the clock is ON. However, on a positive clock edge, if D is low, the output will pulse high for 1 tick, before latching low.
You can often turn a gated D latch into a D flip flop by including an edge trigger. Design B includes a positive edge trigger and it will set the output to D only when the clock goes from OFF to ON.
In these designs, the output is not isolated; this allows for asynchronous R and S inputs (which override the clock and force a certain output state). To get an isolated output, instead of using Q simply connect an inverter to Q.
Design C is a one block wide version of A, except for using a non-inverted clock. It sets the output to D as long as the clock is ON (turning the torch off). This design can be repeated in parallel every other block, giving it a much smaller footprint, equal to the minimum spacing of parallel data lines (when not using a "cable"). A clock signal can be distributed to all of them with a wire running perpendicularly under the data lines, allowing multiple flip-flops to share a single edge-trigger if desired. The output Q is most easily accessed in the reverse direction, toward the source of input. Q can be inverted or repeated to isolate the latch's Set line (the unisolated Q and Q wires can do double duty as R and S inputs, as in design A).
Design E provides a more compact version of A, while still affording the same ceiling requirement. E' allows the edge trigger to act on a high input. Design F holds its state while the clock is high, and switches to D when the clock falls low. The repeater serves to synchronize the signals that switch out the loop and switch in D. It must be set to 1 to match the effect of the torch.
Design G employs new repeater mechanics which were added to the game as of snapshot 12w42a. It holds its state while the clock is high, and is by far the most compact of the D flip-flop designs.
|Input isolated?||Yes||Yes||C Only||Yes||Yes||Yes||No||Yes|
BUD based D Flip-flop
Someone discovered a brand-new design of D flip-flop by applying the principle of Block Update Detector. This flip-flop is small so it can be used multiple times at large integrated redstone circuits. Note that when building, all block that's adjacent to the piston cannot be used as circuit components except flip-flop itself.
The lever in the screenshot shown is an example of D input. Redstone wire in the middle is trigger signal input. The trapdoor is just a part of the BUD so it can be replaced by a fence door, a redstone lamp, etc.
JK Flip-Flop & Latch
A JK flip-flop is another memory element which, like the D flip-flop, will only change its output state when the clock signal C changes from 0 to 1 xor 1 to 0 (edge-triggered, design A and B), or while it holds a certain value (level-triggered latch, design C). When the flip-flop is triggered, if the input J = 1 and the input K = 0, the output Q = 1. When J = 0 and K = 1, the output Q = 0. If both J and K are 0, then the JK flip-flop maintains its previous state. If both are 1, the output will complement itself — i.e., if Q = 1 before the clock trigger, Q = 0 afterwards. The below table summarizes these states — note that Q(t) is the new state after the trigger, while Q(t-1) represents the state before the trigger.
The JK flip-flop's complement function (when J and K are 1) is only meaningful with edge-triggered JK flip-flops, as it's an instantaneous trigger condition. With level-triggered flip-flops (e.g. design C), maintaining the clock signal at 1 for too long causes a race condition on the output. Although this race condition is not fast enough to cause the torches to burn out, it makes the complement function unreliable for level-triggered flip-flops.
Design E is a vertical JK Flip-Flop from the basis of design A. This circuit can be built together in series side-by-side by spacing the circuit one block apart and alternating the direction of the circuit (left-to-right, right-to-left, etc.). By adding an AND gate combining K and Q at the end of this circuit and outputting the result into the inputs J and K of the next gate you can get a binary counter. For optimal space saving you can pass input K through the block it hits by replacing the Redstone wire with a relay. Then you can just add additional Redstone wire on the other side to bring the input of K over to Q. There is also enough space to begin a vertical AND gate to where the result is just to the right of output Q.
T flip-flops are also known as "toggles." Whenever T changes from OFF to ON, the output will toggle its state. A useful way to use T flip-flops in Minecraft could for example be a button connected to the input. When you press the button the output toggles (a door opens or closes), and does not toggle back when the button pops out. (Design D does not have an incorporated edge trigger and will toggle multiple times unless the input is passed through one first.) It is also the core of all binary counters and clocks, as it functions as a "period doubler", turning two input pulses into one output pulse.
Design A has a large footprint, but is easy to build. It is essentially a JK flip-flop with the inputs for J and K removed so that it relies on the edge trigger (right side of the diagram) to keep it in the stable state and only allow a single operation per input.
Designs D and E are much taller than the others, but only a single block wide; both are shown from the side. D is level-triggered, which can save space when distributing one input pulse to multiple flip-flops. Design E has an edge trigger. The output Q is accessible in two locations; if Q is needed as well, an inverter can be connected to one of them.
The edge trigger makes the unit insensitive to the duration of the input pulse, thus it's easy to daisy-chain multiple units to create a binary counters or period-doublers for slow clocks.
These designs are based on the vertical gated D latch (design C) with the inverse output looped back to the input.
Design J is the smallest design of T Flip-Flop on this page and has an edge trigger. Depending on a combination of game mode (SMP or single player), orientation, and game version, the repeater delay may need to be adjusted to eliminate output flickers on state changes. In some situations, it will not work at all unless the repeater delays are adjusted. It has been reported that for proper operation in some cases, the repeaters have needed to be set to 2-1-4 or even 4-2-4.
Design K is a simplification made on the design J. The period of the looping part is increased to 3 ticks in order to match the length of pulses which adjusted by the edge trigger. It is likely to be a solution to the stability problem in design J.
Design M is a compact, mostly-vertical version that uses pistons. It is triggered by a falling edge, whereas the other designs are triggered by a rising edge.
With Beta 1.7.3 operation of the Sticky Pistons was changed. If a sticky piston is activated with a one-tick pulse, it will push or pull a block, but not push and pull it back. This makes it possible to build more compact T flip-flops. Z1 is the simplest design, with just one repeater. Z2 is the lowest one - only one block height, Z3 is a vertical design. Z4 has the smallest footprint (5x2x2). If it is to be triggered by a button or pressure plate, the first repeater and block ahead of it can be omitted by placing the button or plate on the next block (on level 2). Diagram Z5 is a vertical design with a small footprint Diagram L is larger and more complex, but provides both Q and Q. All of these designs include the necessary edge trigger. But keep in mind that it is currently not clear whether this behavior of the sticky pistons is considered a bug or not.
NOTE: Using design E you may require a delay in the connection between the edge trigger and flip-flop in order to maintain a high input long enough to toggle the flip-flop
Along with the 1.3 update, Dispensers can now shoot out/ suck in water source blocks. Combined with a Block Update Detector, it makes a simple T Flip Flop gate:
Simply insert a water bucket inside the Dispenser.
A pulse generator is a device that creates a pulsed output when the input changes. A pulse generator is required to clock flip-flops without a built-in edge trigger if the clock signal will be active for more than a moment (i.e., excluding Stone Buttons).
Design A will create a short pulse when the input turns off. By inverting the input as shown in B, the output will pulse when the input turns on. The length of the pulse can be increased with repeaters, as shown in A' and B'. This is an integral part of a T flip-flop, as it prevents the flip-flop changing more than once in a single operation. Designs A and B can be put together in parallel to represent both the increase of input A and the decrease of A as separate outputs, these can then be read to show when the input changes, regardless of its state.
A pulse generator which causes a short pulse of low power instead of high can be made by removing the final inverter in design B' and replacing it with a wire connection. This is the type used in designs A of the T and JK flip-flops (when J=1 and K=1) to briefly place these devices in the 'toggle' state, long enough for a single operation to take place.
Design C is the same as B', but in a vertical orientation. Design D can be used when a pulse generator is required to pulse both when the input turns off and when it turns on. It produces a six tick pulse, and requires approximately double the space required by design C.
This design is the only design of pulse generator able to start a rapid pulser . It creates a shorter than 1 tick pulse by using pistons.
A pulse limiter limits the length of a pulse. It is useful in sequential bit activation to prevent multiple bits from being activated by the same pulse. The construction of design A expects a default "on" input and by default gives an "on" output.
When the limiter receives an off input, it generates a pulse with a length equal to the delay of the right repeater plus the delay of the torch minus the left repeater (make sure that this yields a positive value) or the length of the initial pulse, whichever is shorter. For example: in the picture, the pulse is calculated as .4 + .1 - .1 = .3 or three ticks, assuming the activation pulse is >= 3 ticks. Be aware of the North/South quirk, as this can affect the delay of the torch. When the input is turned back on, the limiter will not emit a second pulse.
Design B expects and produces default "off" signals. The repeater must be set to at least a 3 tick delay, or the signal will not be sent.
Another solution (design C) for having a short pulse is using pistons instead of torches. When the input turns on, a signal will pass through until the piston activates and breaks the circuit. For a longer pulse, repeaters can be added to the upper branch.
A pulse sustainer is used to lengthen the duration of a pulse type input (such as a button or pressure plate). In design A, the pulse input opens a constant power source (Redstone torch) via a piston switch. After the signal is delayed by the Redstone repeaters, the circuit is closed once again via the other piston. Note that these are regular pistons, not sticky ones. The output signal can be taken from anywhere along the Redstone repeater circuit segment. Another more compact approach without pistons is shown as design B.
Both of these circuits must be used with caution. In design A, if the input pulse lasts long enough for the second piston to activate before the first has retracted, it will become stuck in the "on" state until fixed manually. Design B has the opposite problem: if the input turns off before the pulse has reached the last repeater, two separate pulses will be sent on the output instead of a single, longer one. A monostable circuit may be a safer solution.
A monostable circuit sends an output pulse of determined length when triggered by an input pulse. They can be triggered by either a rising or falling edge of a pulse or both. The term monostable refers to the fact that only one state of the circuit is stable, while the unstable state reverts to the stable state after a set period (a bistable circuit is a latch).
A device that turns itself off a short time after it has been activated. Design A consists of an RS NOR latch and delay hooked up to its reset. The trigger input activates the latch's SET input, and after a delay set by the repeaters, the RESET activates, turning the output off again. The delay (e.g. the length that the output is high) can be set to any value by adding repeaters into the chain.
As a pulse will often have a shorter duration as it passes through complex circuitry, monostable circuits are useful for re-lengthening the duration, as the output always lasts the same amount of time, regardless of input duration.
It can also be used to delay a signal by using its reset signal as output.
Design B is a more compact version fits into a (3x2x3) space. Very short pulse and repeater has to be set to one of the last two settings in order to work. Repeaters can be added to lengthen pulse.
Alternatively, design C, a (7x2x1) vertical device can be built to fit neatly against/into a wall. As in the other cases, the length of time that the output is high can be adjusted by adding or removing repeaters. This design lacks the RS NOR latch of other designs and will only be useful in constant-input circuits. For momentary circuits, this design will not lengthen an input signal like the other designs, just cut the signal early.
A compact yet simple 2x1xn device can also be built if you're constricted to long hallways with little room for width. However, due to the design, this only works with pulsed inputs and not with constant-input circuits. Unlike the previous designs, however, it can deal with 1-tick pulses. Design D1 shows the basic device that lengthens the incoming pulse by 1. Pulses can be lengthened more by adding repeaters and/or increasing their delay, as in D2. Unfortunately, this particular design only works properly if the incoming pulse is at least two ticks long. Design D3 shows how you can skirt around this problem, increasing the size to 3x2xn. It lengthens pulses by 7 and works with any length pulse. Note that the number of ticks the device lengthens the pulse by is equal to the sum of the delays on the repeaters in the design, not including the first one.
A device used to detect a change in a solid input signal, this is a variant of both high and low edge detectors as it detects both changes in signal and can be lengthened to create longer or shorter pulses for each. Can be combined with an ABBA circuit for moving mechanisms that advance through several states between "On" and "Off" where the middle states may only be visible for a moment.
These devices send a short pulse when they have a rising or falling edge as their input. A rising edge is when a signal changes from low (0) to high (1) and falling is the opposite, high to low. You may find you need larger delays for the Redstone Repeaters that have the longer delay. You can also use no repeater for the shorter delay, and use Redstone dust instead, but you must have a block over this piece of wire instead.
A 1-wide edge detector can be made with pistons. Design A is a rising edge detector; design C, a falling edge detector; both with an output pulse of 2 ticks. Design B is a zero crossing detector, activating on both rising, and falling edges. It does however, only output a single tick pulse output. This can be combated by adding a 2-tick repeater to the output, producing a 2-tick pulse, same as the other two.
Other Redstone Components
see Piston circuits
- See the Redstone Repeater article for full details.
As of Minecraft Beta version 1.3, a Redstone Repeater block can be crafted from 3 stone, two Redstone torches and one Redstone dust. It can be used to compactly extend the running length of a wire beyond 15 blocks, while applying a configurable delay of between 1 to 4 ticks.
Using two Redstone torches in series can effectively extend your running wire length past the 15-block limitation. As of 1.0.2 (the July 6th 2010 update), there must be a strip of wire between the two Redstone torches. Repeaters make it possible to send long-distance signals around the map, but in the process, slow down the speed of transfer. To reduce delays, you can stretch out the repeater so that some areas of the wire are consistently in the opposite state, but as long as the number of Redstone torches, or, effectively, NOT Gates is even, the signal will be correct. In more advanced circuits, repeaters can be used as a semi-conductors to isolate inputs or outputs.
- Duel-Edge Instant Repeater.png
Example of an instant repeater
- Instant repeater.png
circuit diagram (rotated)
Pistons allow for new Redstone interactions including the ability to cutoff and reestablish signals by physically altering the solid blocks in a Redstone circuit.
A block being pushed or pulled will immediately act like glass; ceasing to conduct or to inhibit Redstone signals; This can be used to design devices which have perfect time efficiency.
Rail T Flip-Flop
The Rail T flip-flop is a T flip-flop which uses rails and Redstone. It is slower than traditional Redstone-only circuits, but this may be desirable in certain situations.
The wooden squares at the rail corners are pressure plates that will switch the conventional RS-NOR latch at the bottom.
This circuit acts as a two-way repeater, essentially serving as an elongated strip of Redstone. Unlike normal repeaters, which only work in one direction, this circuit allows a signal to be sent through it from either side. It does not have a traditional input or output, but rather two spots which serve as both input and output, depending on what is attached to them. Whenever either one of them is receiving power, the other one is also receiving power. Whenever one of them is off, both are off.
Also, this circuit even tells you the direction the signal is flowing. Of the two torches which appear unlit in the diagram, whenever the circuit is powered, one will be lit. It will be the only lit torch in the circuit, and it will face the direction the power is moving. Thus, if there is an input from A, the bottom-right torch will be lit. In short, the primary purpose of this circuit is to simulate the function of Redstone wire without restricting signal direction like a repeater, but it also happens to indicate which direction the signal is flowing.
CodeCrafted has come out with a 4*2*3 2-way repeater.
The North/South Quirk
Use at your own risk.
A specific arrangement of torches which would normally be expected to behave identically to a traditional 2-torch repeater, causing a 2-tick delay in signal transmission, instead causes only a 1-tick delay. (See figure 1.) When constructed with the torches facing east and west, this arrangement causes the expected 2-tick delay, but when facing north and south, the second (top) torch changes state at the same time as the first, after only a single tick.
The quirk can cause unexpected bugs in complicated circuit designs when not accounted for, but it does have several practical uses. For example,
double doors require opposite power states (fixed), but inverting one signal delays that door's response by 1 tick. Prior to Beta 1.3 and the introduction of the Redstone Repeater, the only known way to perfectly synchronize them was with this 1-tick repeater. Another application is in creating a clock circuit (see below) with an even pulse width and period.
Finally, as a generalization of the double-door use, the North/South Quirk can be used to obtain two signals which are always inversely related without the additional 1-tick delay a NOT gate normally causes in the second signal. (See figure 2.) This can be especially useful in circuits where precise timing is important, such as signal processing that relies on the transition of an input from high to low and low to high (on to off and back), for example by sending each of the inverse signals through separate edge detectors (see pulse generators below) and then O-Ring their outputs.
Sometimes it is desirable to induce a delay in your Redstone circuitry. Delay circuits are the traditional way to achieve this goal in a compact manner. However, in Beta 1.3 the single-block Redstone Repeater was introduced, which can be set to a 1, 2, 3 or 4 torch delay, effectively rendering these delay circuits obsolete. The historical circuits are shown here for completeness, and will still work should you choose to build one.
These two delay circuits utilize torches heavily in favor of compactness, but in doing so the builder must be aware of the North/South Quirk. For maximum signal delay, construct these designs so that the stacked torches face east and west. For a fine-tuned delay, adjust the design to rotate one of the alternating-torch stacks to face north and south, or add an additional stack in that orientation.
Design A gives a 4 tick delay, while design B gives a 3 tick delay.
Clock generators are devices where the output is toggling on/off constantly. The simplest stable clock generator is the 5-clock (designs B and C). Using this method, 1-clocks and 3-clocks are possible to make but they will "burn out" because of their speed, which makes them unstable. Redundancy can be used to maintain a 1-clock, even as the torches burn out; the result is the so-called "Rapid Pulser" (designs A and F). Slower clocks are made by making the chain of inverters longer (designs B' and C' show how such an extension process can be achieved). or, you could just use a repeater set to 3 or 4.
Using a different method, a 4-clock can be made (design D). A 4-clock is the fastest clock which will not overload the torches.
A 4-clock with a regular on/off pulse width is also possible as seen in design E. This design uses five torches, but can be constructed so that it has a pulse width of 4 ticks by employing the North/South Quirk. It is important that the orientation of this design (or at least the portion containing the stacked torches) be along the north/south axis.
The customary name x-clock is derived from half of the period length, which is also usually the pulse width. For example, design B (a 5-clock) will produce the sequence
...11111000001111100000... on the output.
Designs F and G are examples of possible vertical configurations.
Design H is an unusual, stable 1-tick piston clock. For it to work, the block the piston moves must be placed last. The piston will extend and retract very quickly. The output wire appears to stay off because it's changing state faster than the game visually updates. Attaching a piston or other device to the output will show that it is working.
With the addition of Redstone Repeaters in the Beta 1.3 update, clock generators can be simplified to a single block, one Redstone torch and from one to any number of repeaters chained together, as shown in design A. The repeater delay must be at least two ticks, or the torch will burn out.
Another type of clock can be made with only Redstone Repeaters, as in design B. There are no torches to burn out, so they can run at very high speed (such as the 1-clock at left). However, unlike torch-based clocks, they do not start running on their own and must be triggered by hand or with a pulse generator.
Pistons can be used to create new types of clocks with a modifiable pulse delay without the use of pulse generators. This allows other pistons to be clocked in a fashion that only leaves the arm extended for the time required to push an adjacent block, as shown in design A.
Design B requires two sticky pistons, but may be more stable. It is also easily controlled by just set one side Redstone high to stop it from running. The repeaters can be infinitely extended (up to practical limits such as space) to have very long delay clock.
Design C only needs one sticky piston, but at least one of repeaters must be set to 2 or more ticks. If both are set to 1 tick, the torch will burn out. The output signal can be taken from any part of the circuit. This design can also be controlled; a high input on the toggle line will stop the clock.
Design D is the simplest, requiring only a sticky piston and redstone wire, and is also controllable. It runs as long as the toggle line is on, and turns off when the toggle line is off. Repeaters can be added to increase its delay.
Minecart clocks are simple, easy to build and modify, but are somewhat unreliable. Minecart clocks are made by creating a small circular track of minecart rails with one or more minecart booster and detector rail, and running an empty minecart through the loop. The cart is propelled endlessly by the boosters and generates a Redstone signal as it passes over the detector rail. Minecart Clocks are, unlike piston clocks, completely silent, and can be extended or shortened easily by adding and removing track to adjust the delay between signals. Perhaps the biggest disadvantage to using a minecart clock is the fact that it is easily disrupted by the player or mobs, or the fact that it requires more space to be constructed in. Finally, the necessity of gold in the construction of the booster rails may be a limiting factor to players without access to it. In snapshot 12w38b however, C418 gave minecarts their own sounds that intensify depending on their current velocity. An example of how to create a really stable minecart clock is shown in the video below.
These clocks utilize growth of cacti to generate pulses, and generate five minute pulses roughly every 25 minutes (i.e. it turns on every half hour or so). Though the pulses are irregular, making it unsuitable for clocks or computers, the long span makes this clock type highly suitable for reed farms, melon farms, and pumpkin farms. To build, have a 3X3 ring of Redstone wire, and just above that have a 3X3 square plate of any solid ender-proof block, and a 3X3 ring of wooden pressure plates with a sand block in the middle. Place a cactus on the sand block, and place another cactus on this cactus, before putting a solid ender-proof block next to the higher cactus. Keep this clock well lit, so Endermen cannot take the cactus and mobs cannot trigger the clock. Have a shroud around the clock to prevent mobs from falling into the clock. To halve the timespan, hook up two of these clocks to an OR gate. To multiply the timespan, hook this clock to a suitable counter. Hooking two of these clocks to an AND gate gets a clock that cycles roughly every 15 hours.
Half-Day Minecart Clock
An advanced Rail T Flip-Flop is a critical component in the Half-Day Clock, as it relies on the item decay code to send power to booster rails and trigger two separate mine-cart pressure plates. The Half-Day timer always toggles state after 5 minutes even with large amounts of lag, making it the most accurate clock currently in Minecraft.
Boat clock is a clock which toggles on and off in about 9 seconds with minimal lag. This uses a boat in between a piston and pressure plate below and a cobweb above. When a boat falls onto the pressure plate, it activates a piston, pushing the boat into a cobweb which slows its fall down.
Factorial stacking of clocks
Clocks with different periods may be connected to an AND gate in order to generate larger periods with the least resources possible. One way to make a ONE MINUTE CLOCK (600 ticks) would be to use 150 repeaters. Or you could connect two clocks with the periods of 24 and 25 ticks (that's 13 repeaters) to an AND gate.
Note that if your clock's ON state is longer than 1 tick, you'll have to place a Long Pulse Detector at the end of your clock, to ignore imperfect syncs.
Controllable clocks are a combination of a 5 Clock and an AND or a NAND gate. The output ends at the first inverter of the clock, and one of the AND inputs is the output of the 5th inverter of the clock.
By adding an inverter instead of a repeater at any point in an average clock and wiring a lever to the main block of this inverter, a clock that can be toggled on and off can be created. It is important to either use 3 or more repeaters (or delay if less are used), as it seems to burn out otherwise.
It is also possible to create a compact toggle-able clock by means of a button (or other Redstone pulse) using 2 modified pulse limiters (as shown) in series. A rising edge on the toggle line will turn the clock on or off. You may have to modify the repeater(s) in the first pulse limiter to give more delay and therefore a longer pulse, and more reliable shut-off. A signal received on the output line can also toggle the state of the clock, so it should be isolated in any circuits it connects to.
By using a piston to complete a circuit, and taking advantage of how redstone travels through a moving block, a compact toggleable clock can be created with an output as short as 1 tick.
By increasing the delay of the 2 left-most repeaters, clocks of other speeds can be achieved.
A simple control can be created by using a Repeater Clock with a sticky piston to block the output.
This device creates energy in an irregular sequence. It is a variant of the "Rapid Pulser" design shown above, except that each torch pulses in an irregular pseudo-random pattern as each torch coming on turns the other three (and itself) off, and occasionally burning out before being reset by a block update after several seconds, during which time other torches blink.
You can build this device by placing a block with one Redstone torch on every side. Place some Redstone on top of the block, place a new block on top of each torch, and then wire it up to different circuits.
I is redstone dust/wire
0 is redstone torch on side of block
E is redstone repeater
X is any block
[__] is air
How to make one:
0X I I
I I E I
The time between the blinks can be changed by using the redstone repeater.
Or more preferably:
The repeater should aim away from the torch. Optionally you can add more repeaters to lengthen the length of the blink, and a switch may be added to the side of the random block to turn toggle the blinker on and off.
Multiplicative Clocks or Extreme Delay Circuits
By utilizing two repeater banks with different delay lengths and an AND gate, one can generate extremely long delays from an input signal to an output signal with a relatively compact design and lowered resource cost. The resulting delay corresponds to the least common multiple (LCM) of the two banks.
- [In redstone ticks not game ticks] Ex1. If bank 1 has a delay of 24 ticks (6 repeaters on max) and bank 2 has a delay of 25 ticks (6 repeaters on max and 1 on min) the resulting output will be 600 ticks or 1 minute. 600 is the LCM of 24 and 25. This uses 13 repeaters but would require 150 repeaters on max delay to achieve the same result. This makes it about ~1150% as efficient on resources and space in this scenario.
The larger the LCM, the larger the resource and space efficiency gain. This efficiency gain can be modeled by 100 * n1 * n2 / (n1+n2+4-(n1+n2)MOD(4))
Many piston creations require them to fire sequentially in one order, and close in the opposite. Such as in secret piston doors, the circuits for them can often be huge. ABBA switch is named so as the compact circuit is designed to turn on output A, then B, and later turn off output B, then A. Design A is a typical ABBA switch. Design B is a vertical variation; one disadvantage is that the time between the outputs' activation/deactivation cannot be adjusted.
The switch can also be extended to add outputs C, D, and so on. However doing so lengthens the circuit time that much more, as power must reach the opposite end of the ABBA Switch before any output reaction takes place. The settings of the repeaters can also be increased, purposely increasing the timing of any length of switch.
Another use for ABBA switches is for other objects that move or simulate movement, such as mods that aren't similar to the piston. For example, using The Apathetic's Toggle Block mod, reversible motion simulation is possible, such as castle gates and garage doors. Moldy912 uses a much older custom design that is less compact, but just as functional and extendable.
A 1 Wide compact design can be seen in this video. Faster, cheaper and overall better than the old design. Delay can be added since the design uses 2 repeaters, both at 1 tick. 
Sometimes it's necessary or desirable to transmit a Redstone state vertically (e.g. to have a central control or status for several circuits from a single observation point.) To transmit a state vertically, a 2x2 spiral of blocks with Redstone can be used to transmit power in either direction, and the spiral is internally navigable (i.e. one can climb or descend within the tower).
If repeaters are necessary, there is a 1x1 design (A) for transmitting a state upward, and a 1x2 design (B) for transmitting a state downward. For this to be effective you must not finish the top torch on, only off will switch the current when needed. Internal navigability of these designs inside a 2x2 tower interior can be maintained using ladders.
Another equally fast alternative for downwards transmission is slightly larger (3x1) and incorporates repeaters instead of torches (design C). The advantage to this design is the output can be easily extracted at any height without inversion. It is not, however, as easily navigable.
There currently exists a way of 1x1 downward vertical transmission, an example of which is shown in this video You can add a pulse length transmission by adding a Dual Edge Detector at the beginning and a T-Flip-Flop at the end.
Note: That particular design involves rails being in mid-air for 2 tick each while an off-pulse is being transmitted. That is an invalid state for a rail block and therefore leads to it popping out and destroying the signal path in situations that include so far (as of 1.3.1):
- game/chunk reload
- directly adjacent blocks that lead to the rail updating itself (redstone powder etc.)
- any other directly adjacent block updates
- redstone updates that are 2 blocks away in a straight, non-diagonal line
Keep in mind that for those situations to actually break a rail, they have to occur while the off-pulse is being sent and during the 2 tick in which the rail in question is in mid-air.
As of version 1.2, it is possible to put Redstone on top of glowstone, allowing for a method of instant vertical transmission. By using this method it is possible to send the signal up to 13 blocks instantaneously.
However, note that in 1.2, Redstone on top of glowstone will power wire upwards, but not downwards. That is, a glowstone block on a flat surface with Redstone Wire on top will appear to connect to redstone wire one block below, but a power source from above will not propagate in that direction, downwards. This quirk allows for instant diodes as well as other unusual behavior. It is currently unknown if this is intentional or a bug that may be fixed in the future.
As of version 1.3 it is possible to place redstone on other transparent tiles (Upside Down Slabs and Stairs), which functions exactly the same as glowstone. There is a small purely visual difference, in that the redstone will "connect" to the other redstone changing into a strait line (or L, T, or +) while going through to the next block up, while glowstone will remain looking like a single unconnected segment.
A multiplexer (MUX) is a device that selects one of two or more inputs and outputs the selected input. This multiplexer can be chained together, allowing for 3 or more bit multiplexing.
In this design, the inputs are A and B, with C being the control.
Since pistons have been introduced in Minecraft version BETA 1.7, many redstone contraptions can be made more compact and efficient. This is the same with the multiplexer. The design in the second image reacts exactly as quick as the older version, but only requires a space as little as 3x3x2 (X Y Z) if the inputs in the example are re-routed to be more compact.
Large Version: http://i1221.photobucket.com/albums/dd478/AJFayer/Relay.jpg
Medium Version: http://i1221.photobucket.com/albums/dd478/AJFayer/RelayM.jpg
A variation on the multiplexer.
The relay allows you to have one input be sent to two different outputs that you can switch between. It consists of two AND gates, and an RS NOR latch. The relay defaults to one output, and by setting the latch you can change to the secondary output. Unlike just an RS NOR latch, which outputs a constant signal from one output or the other, the relay allows you to send a non-constant signal, which allows you to send no signal, or to send a signal to either output. It is useful for locks, and other applications where you want a non-constant signal to go one output until a triggering event occurs. Unlike a real world relay, it doesn't require constant power to keep it sending to the secondary output. It also requires power to reset to the primary output.
An example of when you would want a relay. A lock that requires you to push multiple buttons in the correct order. A relay allows you the ability to have one button be used multiple times in the sequence by having the relay send the signal to different parts of the unlocking mechanism at different times. You could also make a multi-digit, binary combination lock that requires multiple numbers to be entered using switches. You can use four switches to enter a four digit number and a fifth switch to check the entered number. The fifth switch can flip relays to all the other switches allowing you to use the same switches to set the second number.
-A relay is built by linking two AND gates with an RS NOR latch sending its two outputs to either AND gate. Then split a single input to the other AND gate inputs. Trigger the latch to change outputs.
The vertical design has a footprint of 8x5x1. The glowstone is required to properly isolate the input between the two AND gates. The lever switches between outputs and the button activates the selected output.
There is another small configuration for a relay that is closer in shape and size to the multiplexer. This allows for easier integration with multiplexer circuits.
A is the input, B is the selector. C and D are the outputs
Note that B is compromised, and a relay should be used if it is not otherwise isolated.
Shift Registers are a cascade of D Flip-Flops, or JK Flip Flops sharing the same clock, which has the output of any one but the last flip-flop connected to the "data" input of the next one in the chain, resulting in a circuit that shifts by one position, when enabled to do so by a transition of the clock input.
Logical Shift Right or Left: In a logical shift, the bits that are shifted out are discarded, and zeros are shifted in (on either end). This inserts bits with value 0 instead of copying in the sign bit. Hence the logical shift is suitable for unsigned binary numbers.
Rotate Shift: Another form of shift is the circular shift or bit rotation. In this operation, the bits are "rotated" as if the left and right ends of the register were joined. The value that is shifted in on the right during a left-shift is whatever value was shifted out on the left, and vice-versa
Arithmetic Shift Right or Left: An arithmetic shift left is identical to a logical shift left. In an arithmetic shift right, however, instead of shifting in zeros on the left, the leftmost bit is duplicated. This allows signed twos-complement binary numbers to be divided by powers of two even if the numbers are negative (the equivalent left shift allows binary numbers to be multiplied by powers of two and works whether the numbers are signed or unsigned).
Random Number Generator/Randomizer
A random number generator is a device that can give numbers to the user without him or her noticing any sort of pattern in them. Here is a simple tutorial explaining how to make a randomizer:
There also is a way to use the random delay of Redstone torches to turn back on after they have been burned out. If you combine more of these torches and check which one was the first to recover, you have yourself a random 'number'.
you can also make a compact time based randomizer by adding a clock to lots of rs NOR latches. it will only have the same outcome twice in a row if you perfectly time when you press the buttons.
A short-term randomizer consists of a bat inside a Minecart. Place rails in a loop. Placing Detector Rails at random points along the rail will yield completely random outputs and pulse durations. However, using too many rails can cause some outputs to be triggered more often than others. This circuit is powered by the bat, as bats can move Minecarts slowly. The cons of this circuit are that you must remain nearby, to avoid the despawning of the bat, and that it can't have many outputs. Furthermore, for the odds of each number to be equal, there can only be two outputs.
Pseudo-random Number Generator
A linear feedback shift register is a circuit that generates pseudo-random numbers. Here's an Example of a 16 Bit LFSR.
The bit positions that affect the next state are called the TAPS. [16,14,13,11]. The rightmost bit of the LFSR is called the output bit. The taps are XOR'd sequentially with the output bit and then fed back into the leftmost bit. The sequence of bits in the rightmost position is called the output stream. The sequence of numbers generated by an LFSR can be considered a binary numeral system just as valid as Gray code or the natural binary code.
Block Update Detector
The Block Update Detector switch, or BUD, detects any time an adjacent block receives an update. An update is anything that changes that block's state: block placed, destroyed, door opened, repeater delay changed, cake eaten, grass growing, snow falling, furnace used (or turns off), and so on (chests opened and crafting tables used do not cause updates, sleeping in a bed does).
BUD switches take advantage of a quirk where pistons can receive power, but not updates, from blocks adjacent to the space the piston head occupies when extended. That is: blocks adjacent to the extended state and not adjacent to the retracted state provide power to extend the piston, but as they are not adjacent to the retracted state do not cause the piston to update when that power state changes.
BUDs have been used for all kinds of things, from traps to detecting daylight to locking mechanisms on hidden doors. Before 12w07a, sponge could be placed or destroyed to cause block updates up to 2 blocks away (+1 block over adjacent).
Alternatively, there is a Redstone-only version (pictured right).
(Confirmed that as of update 1.3.2 this Redstone-only BUD no longer works. Removing the redstone now causes an immediate block update and the repeater turns off).
This circuit may be used to power/unpower a circuit when a block is updated next to a repeater. It relies on a glitch that causes repeaters and torches to not update if the block that powers them loses its power source, resulting in a repeater that remains on with no power (or a torch that is off). When a block adjacent to the repeater is updated, the game corrects the repeater and it moves to an off state, allowing a trap or other circuit to operate.
It is crucial that the Redstone dust adjacent to the block the torch is attached to, or the repeater is receiving power from, be removed first, or the loss of power (by removing the torch) will cause a Redstone update the propagate normally.
There are many models of auto resetting BUDs. This is done by having the firing of the BUD switch somehow cause the BUD switch to restore the pre-fired state often when fired it cuts the power to the piston, allowing it to retract. This is done either by extra circuitry or in the example below by the properties of blocks themselves.
Thanks to official release version (1.0), now we can modify the standard wooden pressure plate to act like a button in relation to dropped items. In previous non-development versions there was no way to automatically clear a fallen item from a pressure plate - the pressure plate stayed "ON" until the item disappeared by itself (after 5 minutes) or it was collected by a player. So all those secret buttons activated by dropping an item into a pit were semi-automatic, because you had to manually retrieve the dropped item to deactivate it. Now you can create a fully automatic item button by placing a pressure plate on a fence (that now has a collision box just about the size of the fence itself): when item is dropped on the side of a pressure plate (but not on the center) it will pass through the plate activating it only for a split second (just like a standard button works).
To be sure that the item will be dropped on the side of a pressure plate, feed it to the plate using a water slope instead of placing the drop shaft directly above a plate. Also, a fence connects itself to the solid blocks - fence bars can interfere with falling items. So be sure that you place a non-solid block (like glass) on the side of the fence that is directly below the water slope. And to be completely confident that the item won't land on the fence after dropping from the water slope (though, even with minimal length of slope at 2 blocks I've never encountered this) keep the water level near the pressure plate as low as possible. See the diagram for the final arrangement.
Starting with official release version 1.3, we will be able to make more stable circuits using the new tripwire.
NOTE: This is the same thing as a T-flip flop.
This makes a switch that has a constant output that changes with every input pulse of any length. Note that the piston is on the upper layer, above most of the wiring.
Slightly unreliable for very long pulses; when the input is on, the piston will toggle every time the block below the piston arm is updated.
Mechanical to Redstone Conversion
Making use of a quirk involving the update function on blocks near a water or lava source, it is possible to convert the "mechanical" energy of updating a nearby block into a Redstone signal. To do this, create a water or lava rig that will shift when the desired block updates (for more info, read this thread [broken]). Then position a Redstone torch or powder trail so that the water/lava will wash/burn the torch or powder. Do this in such a way that the missing Redstone component will change the input signal of your circuit.
Once this setup has been rigged, the next time an update function is called in an adjacent block to the water/lava source, it will trigger your mechanism. Update functions include: an adjacent block is placed by a user, gravel or sand falls into an adjacent block, grass grows, wheat grows, an adjacent block receives power, an item resting on an adjacent block changes state (such as a door being opened), or Redstone ore is stepped on, destroyed, or right clicked.
This setup can only trigger once before needing to be manually reset.
See also: BUD switches which are more versatile.
Redstone to Liquid Kinetic Conversion
It is possible to use the same quirk described in the Mechanical to Electrical Conversion section to make water or lava flow as desired. In order to do this, simply follow the instructions in this thread[broken] and run a Redstone wire to the block adjacent to the water/lava source. Whenever the Redstone wire toggles state, the water/lava source will update. If arranged properly, this can be used to redirect water or lava whenever the desired input is given via Redstone circuit.
Alternatively, as of Beta 1.7, pistons provide multiple-use liquid control. The piston plate in its extended position blocks fluids from any direction, as does a block attached to the end of a sticky piston. It is far easier to use a piston (or multiple pistons) to control fluid flow using Redstone circuitry, especially since they do not need to be manually reset.
Detecting Pulse Length
Sometimes it is useful to be able to detect the length of an impulse generated by a Monostable Circuit. To do this, we use an AND gate with Redstone repeaters attached. These will only allow the signal to pass through if it has a signal length longer than the delay of the repeaters. This has many uses, such as special combination locks, which require you to hold down the button. It can also be used to detect Morse code, based on the principle that a dot will not make it through the gate but a dash will.
Detecting Short Pulses
The compressed short pulse detector (right) uses, not including input and output wiring, a space of 3x4x2. The repeater B is the timing control. Any signal from A that is less than the repeater B+1 ticks in length will pass through, giving a possible range of 2 to 5 ticks. Any signal that makes it through will not change in tick length, so pulse sustainers or monostable circuits may be required on very short pulses.
A triggered repeater is a repeating circuit that can be triggered on or off (see diagram A). A Triggered Repeater is made with a Lever leading into a vertical Monostable (6 ticks for the underlying repeaters) circuit. This first Monostable circuit is then led into a following Monostable circuit (also with 6 tick repeaters) followed by 3 repeaters, each set with a tick of 2. These 3 repeaters are then led back into the second Monostable circuit, and also into a third Monostable circuit (again with the underlying repeaters at 6 ticks). This third Monostable circuit will then lead into the first Monostable circuit. The lever can then be switched to on, causing the repeaters to repeat a signal in a loop. Once the lever is switched to off, the repeaters will then cease. This is useful for arranging traps that will repeat while a signal is on while the lever activates a separate device, and to have the traps off, while undoing another device. (An example is a draw bridge that will continuously fire arrows will the bridge is open, and cease firing while the bridge is closed.) If the Monostable circuits are not set to 6 each, and the repeating circuit's repeaters are not set to 2 ticks each, the entire circuit will turn off. Dimensions 3 wide, 14 long, and 2 high.
Inverted Triggered Repeater
A Triggered repeater that will only repeat when the input is off (see diagram B, above). This setup is far more compact than a regular Triggered Repeater; it has a width of only 2 blocks, and a length of only 8 blocks, allowing it to fit into shorter and more narrow spaces. However, it's also higher with a height of 3. The setup for this circuit also requires a monostable circuit just like the one used in the regular, however, the on top of the block the second torch is placed, has a repeater with 1 tick, instead of a Redstone wire. After the torch, place 1 wire, followed by a repeater set to 1 tick. (Two ticks also works, however, the circuit could cease functioning sooner). Three wires are then set making a 180 degree turn to either side, the second wire must be one block below the other blocks, with the third wire adjacent to the repeater. The second wire of these three, is the first wire for a second monostable circuit, making it one below the monostable circuit that is adjacent, removing any wires from criss-crossing between the two. This is a regular monostable circuit with only the 6 tick repeaters on the lower level. The end will then flow back to the beginning.
- NOTE* Inverted Triggered Repeaters WILL cease functioning after several minutes. The exact time is unknown, however, the circuit will continue for an estimated 15–30 minutes. (Not as reliable as Triggered Repeaters)
Glowstone, Stairs, and Slabs
Placing redstone dust atop these blocks has many uses, as the signal cannot go down from them. See the main article for detals.
- Redstone Wire
- Redstone Ore
- Redstone Dust
- Redstone Torch
- Advanced Redstone Circuits
- Piston Circuits
- Basic Logic Gates