User:HaydenBobMutthew/Analog circuit

An analog circuit or signal strength circuit is a redstone circuit which operates on signal strength.

Introduction
An analog or signal strength encoding in Minecraft (a.k.a. hexadecimal wire or simply hex wire) is a transmission which outputs the same analog it receives as input. Because power levels can vary from 0 to 15, an analog transmission can convey 16 states in a single wire.

Analog source
An analog source provides a specific signal strength to a circuit.


 * Container Analog Source


 * 1×2×2 (4 block volume)
 * 1-wide, flat, silent
 * circuit delay: 1 tick


 * A container and a redstone comparator can produce a signal strength dependent on how full the container is. This source is useful for unchanging analog sources within a circuit.


 * Variations: A solid opaque block can be placed between the container and the comparator. If the block is powered to analog 15, the comparator will output 15 instead of measuring the container, providing a fast way to switch signal strengths between two values.


 * The chest can be replaced with any other container, as well as other blocks which can produce a signal from a comparator. Cakes, cauldrons and composters can be useful as they provide visual feedback of the analog they'll produce from a comparator. Droppers can be good choices because their block entity isn't ticked (like furnaces) and they aren't rendered as entities (like chests or trapped chests).


 * Lever-Dust Analog Source


 * 2×15×2 (60 block volume)
 * flat, instant, silent
 * circuit delay: none


 * Turning on one lever will produce the corresponding signal strength at the output. This analog source is useful for quickly changing the signal strength to test circuits.


 * Variations: The levers can be moved to attach to the blocks supporting the redstone dust. The levers can be replaced with buttons for a temporary signal, or any other power component.


 * Item Frame Analog Source


 * 1×3×2 (6 block volume)
 * 1-wide, flat, silent
 * circuit delay: 1 tick


 * An item frame containing an item can be used to provide a specific signal strength or a player-adjustable signal strength between 1 and 8.


 * Frame-Lever Analog Source


 * 4×4×3 (48 block volume)
 * flat, silent
 * circuit delay: 2 ticks (changing between 0-7 and 8-15) or 3 ticks (changing value by 1)


 * Outputs a player-adjustable signal strength from 0 to 15. The item frame chooses a value from 0 to 7 and the lever chooses whether to add 8 to the output. A turned-off lever add 8 to the output and a turned-on lever add 0 to the output.


 * Variations: As long as the block under the lever is powered to strength 15, it can be powered by any method, allowing the lever to be moved to a more convenient location. The torch can be replaced by a full container if inconvenient.


 * Earliest Known Publication: March 26, 2015


 * 4×6×3 (72 block volume)
 * flat, silent
 * circuit delay: 2 ticks


 * Outputs a player-adjustable signal strength from 0 to 15. The item frame chooses a value from 0 to 7 and the lever chooses whether to add 8 to the output. The lever on design 1 is inverted while design 2 is not. Compared to Apocryphan's design, it is more user-friendly and synchronised.


 * Variations: The torch can be replaced by a full container if inconvenient.

Analog transmission
An analog transmission circuit is a transmission which outputs the same signal strength it receives as input. Because power levels can vary from 0 to 15, an analog transmission can convey 16 states in a single wire.


 * Analog Comparator Wire


 * flat, silent
 * circuit delay: 1 tick per 4 blocks


 * The simplest analog wire is a line of redstone comparators. However, like repeaters, comparators can draw a signal from an opaque block and push a signal into an opaque block, thus it is usually more efficient in resources and in signal delay to place comparators every four blocks. Hence, it is the best option for short distances and tricky turns.


 * The signal strength of an analog comparator wire (ACW) can be reduced or suppressed at some point along its length by feeding another signal into one of the comparators in subtraction mode. The signal can be overridden by feeding a stronger signal into one of the opaque blocks.


 * Because the redstone dust is not adjacent to any power or transmission components, only opaque blocks, it will not configure itself to point in any particular direction. This will cause the dust to also power any opaque blocks or mechanism components to the side of the analog wire. Transmission components should not be placed adjacent to the wire's dust because that would cause the dust to configure itself in a way where it doesn't power the rest of the analog wire.


 * Earliest Known Publication: January 9, 2013


 * Analog Repeater Wire


 * flat, silent
 * circuit delay: 1 tick per 14 blocks


 * Signal strength can also be retained by using repeaters to repeat every possible signal strength at the correct distance from the output to convey the correct signal strength. It is the fastest option for long distances.


 * A single segment of analog repeater wire (ARW) consists of exactly 15 repeaters connecting an input line to an output line. To connect multiple segments together without additional comparators, the segments must be arranged so that the output dust of the last repeater is the same as the input dust of the next segment (i.e., block B of the previous segment is block A of the next segment). This causes the segments to overlap in distance by one block and causes each segment to be offset to the side from the previous segment by two blocks.


 * Variations: To keep the segments in-line, or to turn against the direction the repeaters are facing, raise the final repeater by one block and drop the next segment underneath it.


 * Another option is to use a comparator and an opaque block between the segments, and alternate the direction the repeaters are facing. This keeps the height to 2 blocks but increases the circuit delay to 2 ticks per 17 block.


 * Earliest Known Publication: November 21, 2012


 * Analog Subtraction Wire


 * flat, silent
 * circuit delay: 1 tick per (18-N) blocks (see below for N)


 * If fewer than 15 states need to be transmitted (for example, output from a item frame, composter or cauldron), it may be more efficient to encode those N states in the higher levels of signal strength, and then repeatedly subtract the transmitted value from 15 after (17-N) dust, an even number of times. However, it is complicated and infrequently useful.


 * Variations: The chests can be replaced with any other full container. The chests can also be replaced with regular power components (redstone torches, powered levers, etc.) if the redstone dust next to them is raised or lowered by one block, or if the subtraction comparator and its power source are moved so that the redstone dust runs straight into the comparator's side with the comparator perpendicular to the line still facing into the same block.


 * Earliest Known Publication: January 26, 2013


 * Tap-Anywhere Analog Comparator Wire


 * flat, silent
 * circuit delay: 1 tick per 2 blocks + 2 ticks always

The tap-anywhere ACW is helpful with 1-tileable devices, both all requiring the same input, or collecting output from them (e.g. readout from a memory bank), sustaining the strongest of the inputs all the way "downstream" from it, on all the outputs.

Vertical analog transmission
The vertical options for analog transmission are similar to the horizontal options.


 * Vertical ACW


 * silent
 * circuit delay: 1 tick per 1 vertical block (up), 1 tick per 2 vertical blocks (down)


 * A redstone comparator can power a block with dust on it, and that dust can power another comparator at its level, etc. Vertical ACW travels two blocks sideways for every 1 block moved upwards (or three blocks with an additional block between the dust and the comparator), but can also be bent at each block into a 3×3 "circular staircase".


 * The downwards variant can go two blocks down for two block sideways. It can be curved into the 3×3 staircase as well.


 * Vertical ARW
 * silent
 * circuit delay: 1 tick per 14 vertical blocks


 * Vertical ARW is an analog repeater wire built on redstone ladders. It only transmits signals upwards and only in segments of 14 vertical blocks (use vertical ACW to close any gaps). Like horizontal ARW, the last dust of the previous segment must be the first dust of the next segment unless a short run of vertical ACW is used to connect the two segments.
 * Horizontal ARW built on a 3-wide staircase can be used to transmit analog redstone signal diagonally downwards.

Vertical ASW basically just consists of redstone staircases or ladders with occasional breaks for subtraction.

Analog operation
An analog operation circuit is a circuit which operates on signal strength, such as arithmetic and comparison.

Analog Subtractor
It uses the subtraction mode of the comparator. Note that this subtractor actually outputs max(A-B,0), due to the fact that signal strength cannot be lower than 0.

Analog Inverter
An analog inverter is a circuit that inverts the signal strength, for example a signal with the strength of 6 will be changed to 9, and a full strength signal will be 0. This can be achieved by placing a redstone block or redstone torch at the back of a redstone comparator and the input signal will be at the side of the comparator, and the output signal will be at front of the comparator, or by making an analog repeater wire, but instead of the wire in front of the repeater, place a block with a redstone torch attached to the front. place a wire in front of every torch, and the bottom-left redstone dust is the output. Note that the analog inverter works as a 4-bit bitwise NOT operation.

Analog Adder

 * Design 1


 * 6×2×3 (36 block volume)
 * flat, silent
 * circuit delay: 3 ticks


 * Design 2


 * 4×2×4 (32 block volume)
 * flat, silent
 * circuit delay: 4 ticks


 * Earliest Known Publication: December 17, 2015

These adders is based on subtractors and use the fact that A+B=15-(15-A-B). Note that this adder actually outputs min(A+B,15), due to the fact that signal strength cannot be higher than 15.

Analog Maximum

 * Design 1


 * 3×2×4 (24 block volume)
 * flat, silent
 * circuit delay: 1 tick


 * Design 2


 * 1×3×1 (3 block volume)
 * silent
 * circuit delay: 1 tick

This circuit outputs the largest value of all inputs. It is based on the fact that when two or three inputs transmit into a solid block, the block contains the largest value of the inputs. Note that it can be used as an OR gate.

Analog Minimum
This circuit outputs the smallest value of all inputs. It is based on the analog maximum circuit and the fact that min(x,y)=a-max(a-x,a-y), where a=15 in this case. Note that it can be used as an AND gate.


 * Design 1


 * 5×2×4 (40 block volume)
 * silent
 * circuit delay: 3 tick


 * Design 2


 * 5×3×3 (24 block volume)
 * silent
 * circuit delay: 2 ticks

Analog modulo

 * 5×3×3 (45 block volume)
 * circuit delay: 4 ticks

Since A must be between 0 and 15 and B is greater or equal to 8, when A is greater or equal to B, the comparator next to the piston turns on and thus activates the piston and connects the subtraction wire, hence subtracts A by B, i.e. A modulo B. On the other hand, if A is lesser than B, the comparator next to the piston turns off and thus deactivates the piston and disconnects the subtraction wire, hence outputting A.

A is equal to B (A=B)

 * Seiterarch's design
 * 9×2×5 (90 block volume)
 * silent
 * circuit delay: 4 ticks


 * Earliest Known Publication: January 9, 2013


 * AWEDYSSY's design


 * 4×4×6 (144 block volume)
 * flat, silent
 * circuit delay: 2 ticks
 * Earliest Known Publication: April 23, 2014


 * 1-Detector

A 1-detector only outputs a signal when the input has a signal strength of 1. This is useful for detecting when an input signal strength has just barely turned on, or – when preceeded by a redstone dust run-out or comparator in subtraction mode – for detecting any specific signal strength except 0.


 * Subtraction 1-Detector


 * 2×3×2 (12 block volume)
 * flat, silent
 * circuit delay: 2 ticks


 * Earliest Known Publication: April 23, 2014


 * SiberianHat's 1-Detector


 * 1×4×3 (12 block volume)
 * 1-wide, silent
 * circuit delay: 2 ticks (1 to 2+ or 2+ to 1 transition) or 3 ticks (0 to 1 or 1 to 0 transition)


 * Earliest Known Publication: October 14, 2014


 * Abjunction 1-Detector


 * 1×5×4 (20 block volume)
 * 1-wide, silent
 * circuit delay: 3 ticks.

Although not tileable, when stacked side-by-side, this circuit can be used to create an analog-to-one-active decoder.

Variations: Two variations are not stackable, but have a shorter circuit delay:


 * Moved-Block 1-Detector


 * 1×3×4 (12 block volume)
 * 1-wide
 * circuit delay: instant (1 to 2+ transition), 1 tick (0 to 1 or 1 to 0 transition), or 1.5 ticks (2+ to 1 transition).

Note: No longer works as of Java Edition 20w18a.

Although not tileable, when stacked side-by-side, this circuit can be used to create an analog-to-one-active decoder.

A is greater or equal to B (A≥B)

 * 2×3×1 (6 block volume)
 * flat, silent
 * circuit delay: 1 tick


 * Earliest Known Publication: January 9, 2013

This design directly use the comparison mode of the comparator that if A is greater or equal to B then it will output A, otherwise turns off the output.

A is greater than B (A>B)

 * 3×5×1 (15 block volume)
 * flat
 * circuit delay: 2 ticks
 * Earliest Known Publication: January 9, 2013

When A is lesser or equal to B, the left comparator turns on and activates the sticky piston, thus disabling the output. When A is greater than B, the left comparator turns off and outputs A.

A is lesser or equal to B (A≤B)

 * 3×5×1 (15 block volume)
 * flat
 * circuit delay: 2 ticks
 * Earliest Known Publication: January 9, 2013

When A is lesser or equal to B, the left comparator turns on and activates the sticky piston, thus enabling the output and outputs A. When A is greater than B, the left comparator turns off and disabling the output.

A is lesser than B (A<B)

 * 3×4×1 (12 block volume)
 * flat, silent
 * circuit delay: 3 ticks
 * Earliest Known Publication: January 9, 2013

When A is greater or equal to B, the the subtractor turns off the output. When a is lesser than B, the subtractor outputs B - A.

X is between A and B inclusive (A≤X≤B)

 * RedstoneParadox's Design


 * 6×4×1 (24 block volume)
 * flat, silent
 * circuit delay: 4 ticks
 * Earliest Known Publication: August 2, 2017

When X is greater or equal to A, then the torch at the left will turn off. When X is smaller or equal to B, the redstone line at the right will turn on. If both conditions are met, then the output torch will turn on.

Variations: To change "lesser or equal to" to "lesser than" at the left or the right, set the comparator to subtraction mode at the respective sides.


 * Munin295's Design


 * 6×4×1 (24 block volume)
 * flat, silent
 * circuit delay: 3 ticks
 * Earliest Known Publication: Munin295's page

Analog conditional arithmetic

 * Subtract A by B if A is greater or equal to than B


 * 5×5×3 (75 block volume)
 * silent
 * circuit delay: 4 ticks

When A is greater or equal to B, the comparator next to the piston turns on and thus activates the piston and connects the subtraction wire, hence subtracts A by B. On the other hand, if A is lesser than B, the comparator next to the piston turns off and thus deactivates the piston and disconnects the subtraction wire, hence outputting A.

Note: When B is greater or equal to 8, this works as A modulo B. To change "greater or equal to" to "greater", set the comparator to subtraction mode next to the piston.

Analog generator
An analog generator is a circuit that generates analog signals, usually with repeating pattern.


 * Regular Analog Clock


 * 3&times;N&times;2, flat, silent
 * clock period: 16 ticks per comparator


 * This clock produces a regular change in signal strength: each output value, from 15 to 0, last for the same duration (1 tick per comparator). It is the analog equivalent of a redstone clock circuit.


 * A useful variation is to move the torch back one spot (removing one repeater, and increasing another to 2 ticks to compensate) so that the first comparator only gets powered to power level 14. This produces a clock period of 15 ticks per comparator, which is more useful for producing periods measured in seconds (for example, 30 seconds would be 20 comparators).


 * Analog Triangle Wave Generator


 * ?&times;?&times;?, flat, silent
 * clock period: ? ticks
 * Earliest Known Publication: February 6, 2013

This analog triangle wave generator generates signal strengths that oscillates between 0 and 14.


 * Analog Sawtooth Wave Generator
 * Analog Decreasing Sawtooth Wave Generator


 * 4&times;3&times;1, flat, silent
 * clock period: 30 ticks
 * Earliest Known Publication: February 6, 2013


 * This analog sawtooth wave generator generates signal strengths that decreases from 14 to 0 then back to 14 and repeat the process.


 * Analog Increasing Sawtooth Wave Generator


 * 5&times;4&times;1, flat, silent
 * clock period: 56 ticks
 * Earliest Known Publication: February 6, 2013


 * This analog sawtooth wave generator generates signal strengths that increases from 0 to 14 then back to 0 and repeat the process.

Analog capacitor and memory
An analog capacitor is capable of holding signal strength, and is the Minecraft-counterpart of a real life capacitor. An analog capacitor that turns off immediately when reset is known as analog memory, which is a memory circuit that is capable of holding signal strength.


 * RS Latch Capacitor


 * 4×5×2 (40 block volume)
 * flat, silent
 * circuit delay: 2 ticks


 * This latch will maintain the highest signal level that arrived from input S if R is off, and fade (reduce memorized analog) by strength of R every two redstone ticks. For maximum strength (15) signals it behaves like any other RS latch, but it can also memorize intermediate signal levels, and since 2-tick pulses on R will subtract their strength from its memorized state, it makes a nice element of counter or countdown circuits.

Analog memory
An analog RS latch or capacitor is the analog version of RS latch. As with ordinary RS latches, there is often an optional "inverse output" Q̅. (Having both Q and Q̅ is called "dual outputs"). When a signal comes into S, Q is set on and stays on until a signal comes into R, upon which Q is reset to "off". If a stronger signal comes into S, the output Q will update to match S. Q̅ indicates the inversion of Q. Where a Q̅ output is available, the player can often save an analog inverter by using it instead of Q.
 * RS Latch


 * RS Latch


 * 4×5×2 (40 block volume)
 * flat, silent
 * circuit delay: 2 ticks

An analog D latch or capacitor is the analog version of D latch.
 * D Latch


 * D Latch


 * 6×4×2 (48 block volume)
 * flat, silent
 * circuit delay: 2 ticks


 * Earliest Known Publication: May 19, 2013


 * D Latch (Low level)


 * 6×4×2 (48 block volume)
 * flat, silent
 * circuit delay: 3 ticks


 * Earliest Known Publication: May 26, 2018


 * Properinglish19's Capacitor (RS Latch)


 * 4×5×2 (40 block volume)
 * flat, silent
 * circuit delay: 2 ticks


 * Earliest Known Publication: January 4, 2013 (basic concept) and January 6, 2013 (subtraction refinement)

Analog random-access memory
An analog random-access memory (RAM) is the analog counterpart of random-access memory. Similar to RAM cells in real life, they are also connected to three busses, data bus, control bus and the address bus. A single RAM cell consists of 3 inputs, which is data (D), read (R) and write (W).


 * BatchRedstoners' Design


 * 8×3×2 (48 blocks)
 * silent
 * circuit delay: 3 ticks (write) or 2 ticks (read)


 * Earliest Known Publication: May 26, 2013


 * When the write line is activated, the redstone torch turns off and enables the redstone comparator after the data input, thus changing the signal strength of the circuit after that comparator. ...


 * Properinglish19's Design


 * 7×6×2 (84 blocks)
 * silent
 * circuit delay: 4 ticks (write) or 2 ticks (read)


 * Earliest Known Publication: January 9, 2013

Miscellaneous analog memory circuits

 * Analog Up/Down Counter


 * 2×7×2 (28 blocks)
 * flat, silent
 * circuit delay: 4 ticks (up) or 6 ticks (down)


 * Earliest Known Publication: October 5, 2013


 * The counter can be reset to 0 or 15 by powering either redstone dust for 4 ticks.


 * If the inputs don't need to be at the same height as the output, the outer blocks can be removed and the droppers activated by powering the blocks underneath them. If the input pulse is less than 4 ticks, the droppers can be powered directly.

Analog encoder
An analog encoder converts other encodings to analog encoding type.

Binary-to-analog encoder
An binary-to-analog encoder (a.k.a. B2A encoder) converts from binary encoding to analog encoding.


 * Comparator B2A Encoder


 * 13×5×2 (168 block volume)
 * flat, silent
 * circuit delay: 4 ticks

Analog decoder
An analog decoder converts an analog encoding to another encoding type.

Analog-to-binary decoder
An analog-to-binary decoder (a.k.a. A2B decoder) converts an analog encoding into a binary encoding.


 * Fast A2B Decoder
 * 12×15×4 (720 block volume)
 * circuit delay: 2 ticks


 * This circuit first decodes the analog input into a nearly-one-cold output (see below), and then encodes that to a binary output.


 * Binary encoding has the property that going from an even value to the next odd value changes only one binary line: the 1-bit. The first section takes advantage of this fact to use the even one-cold output lines to encode the binary output lines for the next odd value as well as their own binary lines. This allows the odd output lines to control only the 1-bit line. The first section also removes the lower repeaters that would suppress the one-cold output lines for values 8, 12, and 14, because the binary output lines they control don't change for greater values (for example, once the input has reached 8, the 8-bit line should be on for all greater values), simplifying the one-cold to binary encoding for higher values.


 * Earliest Known Publication: January 30, 2014


 * Compact A2B Decoder


 * 4×14×2 (112 block volume), flat, silent
 * circuit delay: 10 ticks


 * This decoder is slow and its outputs aren't lined up nicely (though it doesn't take too much more space to line them up), but its compactness allows it to be built in bases or other places where space is tight.


 * The outputs change state one after the other while the computations work their way through the circuit, so it may make sense to suppress the outputs until the calculation has completed.

Analog-to-unary decoder
An analog-to-unary decoder (a.k.a. A2U decoder) converts an analog encoding (analog) into a unary encoding (N lines on).


 * Single-spaced A2U Decoder


 * 1×N×2


 * Double-spaced A2U Decoder


 * Earliest Known Publication: March 21, 2013

Analog to one-active decoder
An analog-to-one-active decoder (a.k.a. A2O decoder) converts an analog encoding into either a one-hot encoding (Nth line on) or one-cold encoding (Nth line off). An analog-to-one-hot encoding decoder is also known as a redcoder or a selector.

All of the decoders below are shown decoding to one-cold encoding, but can easily be changed to one-hot encoding. While one-hot encoding is useful for activating adjacent redstone mechanisms (lamps, dispensers, pistons, etc.), one-cold encoding can often be useful if there are subsequent logic circuits.


 * ACW Opposed-Power A2O Decoder


 * 3×16×3 (144 block volume)
 * silent
 * circuit delay: 3 ticks
 * Earliest Known Publication: March 17, 2013

Powers a line of 16 redstone dust with a power level equal to the input analog power level from one side, and (15 - input) from the other, leaving only a single dust unpowered.

The decoder transmits the input's power level to both sides simultaneously by taking the input in the middle of the circuit and using the same number of comparators getting to either side (using analog comparator wire), including subtracting it from 15 on one side.

Variations: To change the output from one-cold to one-hot, add torches to the output blocks (adding 1 tick to the circuit delay).

The output can be shortened to display fewer values by reducing the number of items in the subtraction comparator's input container (when shortening the comparator lines, make sure each dust has a comparator before or after it so it doesn't power an adjacent output block, as is purposefully done with the 0 output block).


 * ARW Opposed-Power A2O Decoder


 * 6×16×2 (192 block volume)
 * flat, silent
 * circuit delay: 2 ticks
 * Earliest Known Publication: June 7, 2013

The ARW decoder transmits the input's power level to both sides simultaneously by using a single segment of analog repeater wire.

Variations: To change the output from one-cold to one-hot, add torches to the blocks the output dust is on (adding 1 tick to the circuit delay).


 * Abjunction A2O Decoder


 * 4×16×4 (256 block volume)
 * silent
 * circuit delay: 2 ticks

Note: No longer works as of Java Edition 20w18a.

Splits the input signal into two lines of redstone dust, with one line at one less power than the other, and compares the power level of the two lines at each potential input to see where the input's power level drops to 0.

The abjunction ("A AND NOT B") is the final block at each output which combines the negation of its own value's power with the power of the next value (so will only be cold if its own value is powered but the next is not).

Variations: To change the output from one-cold to one-hot, add torches to the output blocks (adding 1 tick to the circuit delay).


 * Java Edition 20w18a+-Compatible Abjunction A2O Decoder


 * 6×16×4 (384 block volume)
 * silent
 * circuit delay: 3 ticks
 * Earliest Known Publication: April 29, 2020

Note: Cannot decode signal strength 0 (off signals).

Variations: To change the output from one-cold to one-hot, raise the output blocks by one block.


 * Opposed-Power Item Frame Decoder


 * 3×12×2 (72 block volume), not including item frame input
 * flat, silent
 * circuit delay: 2 ticks
 * Earliest Known Publication: January 14, 2014

Powers a line of 8 redstone dust with a power level equal to (input - 1) from one side, and (8 - input) from the other, leaving only a single dust unpowered for a one-cold output.

Because the bottom comparator is in comparison mode, it will never be affected by the dust at its side.

Variations: To change the output from one-cold to one-hot, add torches to blocks the output dust is on (adding 1 tick to the circuit delay).

Analog multiplexer
An analog multiplexer is a device that selects between several analog signals and forwards it to a single output.


 * Analog 2-to-1 multiplexer

In a 2-to-1 multiplexer, when S is off, the output will be A and when S is on, the output will be B.