User:MentalMouse42/Sandbox/Other Circuits

Here we discuss several "tricks of the trade" and redstone circuits.

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 before the introduction of redstone repeaters, it had several practical uses. Even now, if you are using the torches anyway, this trick can be used to synchronize circuits that are 1 tick apart, or conversely delay one side of a circuit. Another application is in creating a clock circuit (see below) with an even pulse width and period.

The North/South Quirk can still 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. Formerly this was done with a series of torches, but, in Beta 1.3 the single-block Redstone Repeater was introduced, which 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.

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. The upper two rows can simply be repeated for additional outputs C, D, etc.. The settings of the repeaters can also be increased, to increase the delay between turning successive switches on or off. However doing either of these lengthens the total time that much more, and to maintain the proper order, the activating pulse must light the entire circuit before turning off.

A 1 Wide compact design (C and D) can be seen in this video. This design is faster and cheaper than the previous vertical ABBA. Delay can be added at the repeaters, and the design can easily be extended to more inputs by repeating the last two columns. The delay for an output can be extended even farther than 4 ticks by duplicating a repeater column, at the cost of some unevenness in timing. Again, the power must hold long enough to light the entire circuit, or the ordering will fail.

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.

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.

Starting with official release version 1.5, substituting a hopper for the lava disposer will retain the item instead of destroying it. This, in conjunction with other components, can be used to create automatic payment systems, or success gates which can shut off a system when an outside source has caused the desired outcome (cane harvesting, etc) to become impossible.

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.

红石电路/其它