Redstone circuits/Pulse

Here we have several groups of circuits with related purposes. They all produce an output pulse in response to a rising or falling edge, but they have different emphases and tradeoffs. In rough order of pulse length, they include Edge Detectors, Pulse Generators, and Monostable Circuits. In later sections, we have circuits designed specifically to lengthen or shorten pulses, or pass pulses according to a minimum or maximum length.

Edge Detectors
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. A "zero-crossing" detector responds to both edges. Many other circuits have implicit edge detectors, but some don't, and these can be used to feed them pulses.

For design A the Repeaters can be adjusted to give a signal lasting 1 or 2 ticks, for B this is 1 to 3 ticks. Circuit C can be adjusted to create longer or shorter pulses separately for rising and falling edges.

All three sorts of edge detector can be made more compact and 1-wide with pistons. In all three of these designs, the piston is atop a solid block.

Design D is a rising edge detector; design F, a falling edge detector; both with an output pulse of 2 ticks. Design E is a zero crossing detector, activating on both rising and falling edges. However, it only produces a single-tick pulse output. This can be moderated by adding a 2-tick repeater to the output, producing a 2-tick pulse, same as the other two.

Pulse Generators
A Pulse Generator creates a pulse 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). This is an integral part of a T flip-flop, as it prevents the flip-flop changing more than once in a single operation.

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 by adjusting the repeater, or even adding a second repeater on the side loop.

Designs A and B can be put together in parallel to report both the input's turning on, and off, as separate outputs. These can then be read to show when the input changes, regardless of its state.

Design C is the same as B, but in a vertical orientation.

Design D responds both when the input turns off and when it turns on ("dual-edge"). It produces a six tick pulse, and requires approximately double the space required by design C, not to mention many more repeaters.

Design E was noted as "fixed for 1.5". All repeaters are required, and it can go up to an 8-tick pulse.

Monostable Circuits
A monostable circuit sends an output pulse of determined length when triggered by an input pulse. Another way to describe it is as a device which turns itself off a specific time after it has been activated. 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). As a pulse will often lose duration as it passes through complex circuitry, monostable circuits are useful for re-lengthening the duration; the output always lasts the same amount of time, regardless of input duration.

Design A consists of an RS NOR latch with a 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 (how long the output is high) can be made as long as desired, by adding more repeaters, or even a long-period timer such as a water clock.

Design B is a more compact version that fits into a (3x2x3) space. However, as shown, it produces a very short pulse (1 or 2 ticks). The duration is 2 less than the repeater delay, and said delay must be set to 3 or 4 for the circuit to work. Repeaters can be added to lengthen the output pulse, at the cost of increasing the size.

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, which lengthens the incoming pulse by the delay on the second repeater. Pulses can be lengthened more by adding repeaters and/or increasing their delay, as in D2. Unfortunately, this version only works properly if the incoming pulse is at least two ticks long. Design D3 shows how to allow for 1-tick input pulses, at the cost of increasing the size to 3 wide. For all three variations, the number of ticks to lengthen the pulse by is equal to the sum of the delays on the repeaters not including the first one at the input. The dots by D2 and D3 indicate the repeating units to extend further.

Pulse Limiters
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. Designs A and C can create 1 tick pulses, but design B can create a minimum of a 2 tick pulse.

Design A limits "on" pulses in a circuit that's normally "off". It can produce pulses of 2 or 3 ticks long (2 less than the repeater delay). The repeater must be set to at least a 3 tick delay, or the signal will not be sent.

Design B limits "off" pulses in a circuit that's expected to be "on" (both input and output). It can create pulses of any length down to 1 tick. When the input turns off the circuit generates an off-pulse of length equal to whichever is shorter: the input pulse, or the delay of the right repeater minus the delay of the left repeater, plus 1 tick for the torch. (Make sure that this yields a positive value!). For example: in the picture, the pulse is calculated as 4-1+1 = 4 or four ticks, assuming the activation pulse is at least that long. 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 C uses pistons instead of torches, allowing it to produce "on" pulses as short as 1 tick. 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.

Pulse Sustainers
A pulse sustainer is used to lengthen the duration of a pulse input. Here we have two specialized examples, each with its own weakness.

In design D, the pulse input uses a piston to close the redstone torch's circuit. After the signal is delayed by the Redstone repeaters, the circuit is opened 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. (If taken after some or all of the repeaters, the output pulse will be delayed.)

Variation: To be more compact horizontally (at the price of digging into the level below), the power torch can be placed directly underneath the mobile block's ON position. Alternatively, wire can be run underneath the mobile block's OFF position, and the repeater loop continued from there at ground level (so the piston unblocks the circuit rather than closing it).

Design E is a potentially more compact approach without pistons. The pulse will be extended by the difference between the two path delays.

Both of these circuits are simple but must be used with caution -- a monostable circuit may be a safer solution. In design D, 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 E 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.

Length Detectors
Sometimes it is useful to be able to detect the length of an pulse generated by another circuit, and specifically whether it is longer or shorter than a given value. This has many uses, such as special combination locks (where you have to hold down the button), or detecting Morse code.

To test for a long pulse, we use an AND gate with Redstone repeaters attached (F). These will only allow the signal to pass through if it has a signal length longer than the delay of the repeaters. Design G does the same with a piston AND gate. Note that a pulse that does get through will be shortened by the delay amount, possibly down to 1 tick!

The short pulse detector H uses, not including input and output wiring, a space of 3x4x3. The repeater D is the timing control. Any signal from input that is less than the D+1 ticks in length will pass through, giving a range of 2 to 5 ticks for the filter. Any signal that makes it through will not change in length.