If you want a linearly-spaced set of resistances, you can use a ladder of logarithmically-spaced resistors and short out different combinations, as described here.
Is there a way to get a logarithmically-spaced set of resistances?
Simplest case:
If you have 2 SPST switches, there are 4 different states they can be in (off-off, on-off, off-on, on-on).
Is there a way to connect these switches with (any arrangement of) resistors, such that the total resistance between two nodes of the 4 states is {1, 10, 100, 1000}? In other words, a digitally-controlled logarithmic rheostat. The states don't have to be in any particular order.
If this is possible, can it be extended to larger numbers of switches (8 values from 3 switches, 16 from 4, etc.)?
Best Answer
I enjoy little combinatorial puzzles, and 'what if' questions, and trying to wring the maximum usefulness out of constrained situations. So while I expect my 'solutions' are not exactly what you're looking for, they may provoke some thought, and possibly further experiment.
If series switches as in a conventional 1, 2, 4, 8 resistor box don't work, how about a parallel arrangement? Like these configurations?
simulate this circuit – Schematic created using CircuitLab
It's a bit of a drag to compute manually, or even build a spreadsheet to compute the total resistance for all switch combinations, so I wrote a python program to crunch the numbers, and used the scipy optimizer to find good values, as although the 3 resistor solution looks systematic, it's not obvious how that extends to more resistors. If you want a copy to play with just ask.
The top arrangement produces the following end to end resistances for all 4 switch combinations: 47ohm, 100ohm, 220ohm, 470ohm. Pretty log, huh! It even follows the E3 resistor selections.
Adding more switches gets finer steps, but we get fewer than 2^n steps from n switches, and we get even fewer ones that are nicely spaced.
The second figure gave 14 unique resistance settings, covering a range of 28.4:1, with the 10 most evenly spaced geometrically being ...
17.2, 23.3, 32.3, 47.9, 67.0, 100.0, 149.2, 222.7, 332.4, 488.1
... which have step ratios between 1.36 and 1.49. Apart from the first one, those values happen to be very close to the E6 series, 22, 33, 47, 68, 100, 150, 220, 330, 470!
This is a plot on a log axis of the resistances
Unfortunately, things don't improve much when we add even more switches. I tried 8 switches, 9 resistors. I tried random values, optimized values, tight spreads, wide spreads. However there was always a big step, often several, in the middle of the range. Had the big step been at the end, that would have been more tolerable. But a big step in the middle cripples general purpose usability, you can't guarantee that you'll be able to find the step you want.
Here is one example of a random run. This allowing a random choice for each resistor in the range 100 to 500ohms.
Over two decades of variation, and mostly fine steps. But you can see those bigger steps, the largest is ratio 1.35, very little better than the 5 resistor case. So while extra switches improved the range a lot, the fineness in the lower resistances a lot, the lack of improvement in big steps in the upper resistances means I don't feel the extension to more switches has the bang for buck. While optimisation can move the big steps around, it doesn't really reduce them that much.
\edit 2019\
A sort of related topic. I wanted to do some low current experiments, and to simplify that, house some large value and wide-range resistors. I like to minimise the number used, and maximise the number of connection possibilities. The following arrangement occured to me using E3 series resistors.
simulate this circuit
Each junction goes to a 4mm socket. Connecting to each resistor in turn obviously gives me the E3 series.
Connecting to pairs of resistors in series, for instance R4+R5 = 3.2M (instead of 3.3M). The other pairs give approximately the other interpolating resistors in the E6 series. 1, 1.47 (1.5), 2.2, 3.2 (3.3), 4.7, 6.9 (6.8).
Connecting to four resistors in series, for instance R4+R5+R6+R7 = 17.9M (instead of 18M). The other quads give approximately half of the remaining interpolating resistors in the E12 range.
Connecting to three resistors in series, with the middle one shorted with a link, for instance R4+R6 = 5.7M (instead of 5.6M). The other 'spaced pairs' give approximately the other remaining interpolating resistors in the E12 range.
/edit 2019\
\edit 2020\
Unfortunately, any real advantage for this sort of resistor/switch arrangement crumbles to dust if you want to extend it to useful ranges.
My 4 switch 5 resistor solution manages a range of 28:1, with 1.5:1 ratios between steps. That ratio means two could be stacked together to get a 1000:1 range, with two extra switches, or one c/o switch. So we now have a 9(ish) switch solution for 1000:1. However, it's not obvious how to control the switches for any given resistance value, so uC control is almost mandated.
Are there other better ways to get 1000:1 in 9 switches with a similar 1.5:1 step size? Yes, there are. Consider a series string like I suggested in 2019, 10, 22, 47, 100, 220, 470, 1000, 2200, 4700, but now each with a shorting switch across it. Any one switch open of course gives you one of the E3 series resistor values. Any two adjacent switches open gives you the other E6 resistor values, with interstep ratios of 1.5:1. It's obvious how to extend the series to a wider range. If you're not keen on a long series string of switches (too many uncertain switch contacts in series) then all in parallel will also work and give you the same ratios.
Is there a yet better way to get interpolation over a 1000:1 range? Let's go to 10 switches rather than 9, not a huge increase. The E3 resistor ratios were individually 2.2:1, which meant there were some resistance values that could not be generated with even arbitrary combinations of switches. However with 10 switches, we can cover 1000:1 range with 1.995:1 ratios, very very close to binary. True binary would give us 1024:1, just slightly different from nice powers of 10. That means we can generate any desired resistance value within an obvious tolerance. The fact that the ratio is slightly less than 2:1 means that were this arrangement to be used as an ADC, there would be missing codes. As a DAC, that doesn't matter, some resistances would have more than one unique way of constructing them. However, as the expected accuracy for most load applications is not expected to be better than a few percent, we never need to use enough resistors to notice the deviation from 2.
This DAC could use resistors like 1, 2, 4, 8, 16, 32, 63, 125, 250, 500, to make the addition straightforward. The 2.4% error is absorbed into a couple of steps in the middle. The error from binary is below the resolution for even up to 5 adjacent bits used to make a resistance value, which will get us within a couple of percent of any value we specify, within the range of the DAC.
As a series string with shorting switches, it's quite easy to do the mental arithmetic to choose a specific resistive value. The parallel arrangement would be trickier. It might help to label the switches with the conductance, so 0.001, 0.002 ... 0.25, 0.5, which add as we close switches, so we only need to do one inversion of our target resistance to a conductance.
/edit 2020\