Redstone circuits/Pulse

Components of redstone that operate on pulses, such as generators and monostable circuits.

Pulse Generators


A Pulse Generator 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 by adjusting or adding repeaters, as shown in A' and B'. (Recent changes in redstone behavior have made the repeaters mandatory -- designs A and B will no longer work.)

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.



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

Pulse Sustainer


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.

Monostable Circuits


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.

Zero-Crossing Detector
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.

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

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.

红石电路/脉冲元件