Redstone circuits/Miscellaneous

The North/South Quirk
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.

Delay Circuit


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.

Adjustable Redstone Blinker
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 I I E I

The time between the blinks can be changed by using the redstone repeater.

Or more preferably:

0X EI I I

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. --- --- 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))
 * [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.

ABBA Switch
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. 

Vertical Transmission
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.

Multiplexer
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.



Relay(Demultiplexer)
Large Version: http://i1221.photobucket.com/albums/dd478/AJFayer/Relay.jpg

Medium Version: http://i1221.photobucket.com/albums/dd478/AJFayer/RelayM.jpg

Small Version:

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.

Vertical Version:

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 Register
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.

A tutorial on a 16 Bit Shift Register

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).

Some examples:



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.



Item Button
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, more stable circuits using the new tripwire are able to be achieved.