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.) However, doing so in narrow spaces can be non-trivial -- there are several ways, but each has their own limits and drawbacks.

Redstone stairs and ladder
For fairly short distances, a 2&times;2 spiral of blocks with Redstone can be used to transmit power in either direction, and the spiral is internally navigable -- that is, one can climb or descend the stairs, even if they're enclosed in a tower. This method is instantaneous, but quickly runs into the redstone signal-length limit, so you will need to switch in another method at intervals, to introduce repeaters or even torch pairs.

For upward transmission only, you can also put redstone on a 1&times;2 "staircase" of glowstone, or of upside-down slabs/staircases. All of these are transparent blocks, so the level above does not block diagonal transmission. However, despite the apparent connection, power and signal will not go down these stairs. There is a small purely visual difference, in that with slabs or stairs, the redstone will visibly "connect" to the redstone on the next block up, while dust on glowstone will remain as an unconnected "dot".

transmission]]

Torch and repeater ladders
If greater distance or narrower confines are necessary, there is a 1x1 design A for transmitting a state upward, and a 1x2 design B for transmitting a state downward. Note that every other torch will have the signal inverted, which can complicate output a bit. You can take a non-inverted signal by wire at any block underneath any non-inverted torch. For the block underneath an inverted torch, you can put a torch on the block's side as shown. Both A and B can be combined with staircases to restrengthen the signal -- even inside a 2x2 tower interior, you can use a few ladders to climb past them so the tower is still navigable.

Design C for downwards transmission is slightly larger (3x1) and uses repeaters instead of torches. The advantage to this design is the output can be easily extracted at any height without inversion. On the other hand, it's more expensive and not as easy to navigate as B.

Exotic Downward Transmission
There currently exists a rather exotic method of 1x1 downward vertical transmission, an example of which is shown in this video. This requires stacking a repeating unit of (from top down): a sticky piston, a minecart, a detector rail, and a redstone lamp. You also need to arrange brief low-pulse signalling by adding a Dual Edge Detector at the beginning and a T-Flip-Flop at the end. Furthermore, this 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, so the rail can "pop" and cut the signal path, in any of several situations: For any of these 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.
 * 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

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 multiple bit multiplexing.

For these designs, the inputs are labelled A and B. C is the "control" input: whether A or B passes through depends on whether C is powered or not.

Design A represents an old-style multiplexer based on torches. As with many other circuits, repeaters and pistons have produced far simpler and more compact multiplexers. Design B reacts as quickly as the older version, but only requires as little as 3&times;1;&times;4 cells. Design C represents a vertical option.

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:

The relay is more-or-less the reverse of the multiplexer. It allows you to have one input be sent to two different outputs, that you can switch between. The traditional way to build a relay is with two AND gates bound by a control line and its inverse, often coming from an RS latch]. A more modern version can simply reverse the modern (piston) multiplexer.)

The relay defaults to one output, and by setting the latch you can change to the secondary output. Unlike a plain RS latch, the relay allows you to send a non-constant signal, including none at all. It is useful for locks, and other applications where you want a non-constant signal to go one output until a trigger switches it to another.

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.

红石电路/其它