# Analog redstone signal amplifier/multiplier?

Is there a redstone circuit that could alter redstone signal strength by multiplying it by a constant factor? For example, my circuit produces signal in range 1-8 strength, and I'd like to get 2-16 signal strength on output.

-
Answerers, please make sure to state for which version of Minecraft your solution works, if applicable. – dlras2 Jul 10 '13 at 17:52
@Dan Why? Signal strength didn't exist before 1.5, and how it works hasn't changed since. – SevenSidedDie Jul 10 '13 at 17:54
@SevenSidedDie Sorry - OP specified 1.6.2, and we decided it was the burden of the answer, not the asker, to specify versions. I guess it's less applicable in this specific case. – dlras2 Jul 10 '13 at 18:01
@Dan: Actually, I believe my solution would have worked before 1.5.... – SF. Jul 10 '13 at 18:03
@SF. I have not done much redstone programming, and none since the large update, so I can't comment on versioning. If you have a solution, tho, please post it! – dlras2 Jul 10 '13 at 18:05

Looking at the problem mathematically: The basic analog operation we have is `a - b`, and the values must be between 0 and 15. How can we produce `2·a` using that?

``````2·a = a + a                    no multiplication, but addition
= a - (-a)                 no addition, but uses negative numbers
= 8 + a - (8 - a)          in range, but has a + operation
= 8 - (-a) - (8 - a)       almost there...
= 15 - (7 - a) - (8 - a)   this can be redstone!
``````

Note that we are finally using 15 and 7, not 16 and 8, because there is no signal strength 16. The output for input 8 will be 15, not 16, because `(7 - a)` can only go down to 0 rather than -1.

This is a “physical” implementation of the above formula. The two furnaces are used as signal sources, containing 64+32 and 64+24 items each, causing the comparators to their left (set to subtraction mode) to have input signals of 8 and 7 respectively (which is which doesn't matter). The torch at the bottom provides the constant 15, and the two comparators on the left side subtract the two intermediate results from 15 to produce the final output on the top left.

The middle right comparator is not actually necessary; it just simplifies seeing where the input to the circuit is and what the signal strength at that point is. It does nothing but repeat the signal (it doesn't interact with the furnaces). Thus, this circuit can be built with only 4 comparators.

Note that since the output comes from two subtractions in sequence, when the input changes, the output will change in two equally-sized steps. This could be good if you want a smooth change (e.g. if the input goes from 2 to 3 the output will go through 4, 5, 6) but bad if you're looking for only “correct” outputs (e.g. only even-numbered ones).

The circuit can be compacted by one more block as follows, requiring an additional comparator (which merely repeats the signal, because the input to its right is always weaker and it is not in subtraction mode).

(Another possible compacting is to bring the top and bottom rows right next to each other; this would require feeding the input signal to the two input comparators separately, which might happen to be convenient for some 3D build. Note that you can compensate for signal losses by changing the furnace fill, if your original input's lowest value is above 0.)

These circuits were built and tested in Minecraft 1.6.2 and should work back to version 1.5, but not before 1.5 as comparators did not exist then.

This was an interesting problem to work on and I found what I think is an elegant solution — thanks for asking!

-
Elegant solution, used this in a minecart station track selector. Thank you. – spex Feb 16 '14 at 10:41

My solution entirely fails on the compactness and cost front, with 15 repeaters, over a stack of loose redstone and 16x10 size (at least, entirely flat.)...

Pick input signal with repeaters at specific distance from the source (thus only repeaters too far for weak signal won't pick it, and pass it to repeaters located a specific distance from the target.

The advantage is this "lookup table" approach allows for any arbitrary, non-linear input-output mapping by placing the output repeaters a desired distance from the output. Still, something simpler would be much desired.

-
I have a feeling this is the easiest without going into more esoteric redstone mechanics. I'm sure a more compact solution could be developed with hoppers, droppers, dispensers, comparators, and/or repeater latches, but those types of designs often fall out of trial and error. – MBraedley Jul 11 '13 at 12:55
@MBraedley: The primary problem is that there is not a single output device currently that is directly affected by signal strength (except the comparator, which I don't know how to use here) so no matter what output you use, the input side will likely be a ladder of devices attached block-by-block to the input line. – SF. Jul 11 '13 at 13:08

This solution is made considerably more compact by taking advantage of the redstone comparator's ability to act as an output source of the same signal strength that it receives as input.

-