So, spend the $0.40 and get an 8-to-1 analog mux (CD4051). Then, ground one end of each analog switch, pull up the other end. Feed those three logic signals to A0, A1, A2 of the mux, with any gain-setting resistors that suit your fancy.
So, spend the $0.40 and get an 8-to-1 analog mux (CD4051). Then, ground one end of each analog switch, pull up the other end. Feed those three logic signals to A0, A1, A2 of the mux, with any gain-setting resistors that suit your fancy.
There you go... the "solution" >:-}
Bwahahahahaha! ROTFLMAO ...Jim Thompson
-- | James E.Thompson | mens | | Analog Innovations | et |
It's 10 lines of code and will give you the no-doubt-about-it best answer to the exact problem using real components. Or as close as you can get given three switches. Brute force would probably work out to several more switches too if it should become an option.
Do you not like exact answers for specific problems?
The circuit (by which I mean the PCB) exists and can't be changed. Cost doesn't matter.
I did it with a spreadsheet, plotting log(gain) to try and eyeball as straight a line as possible between selected points. I farted around with resistor values and ended up with something acceptable.
I feel cheap now.
Cheers
-- Clive
Or not. The only constraint, is that we have a 'resistor network' with two inputs (ground, and op amp Vout), and one output (inverting connection to the op amp), which is then modified by three shunts (analog switches) between nodes of that network. The old solutions (R/2R ladder, series connection with switches that short across resistors, parallel connected resistors with switches in series that open) aren't the only ways to connect those switches into a network. So, make a cartesian 3-d array of a lot of resistors, like resistor-per-edge cube (12 resistors in all).
That's complex enough to make R/2R ladder for three bits.
Twelve resistor values, each to vary independently. Pick one (of eight) node for the summing junction, that leaves seven possible Vout. Each shunt goes to two distinct points in the array, call it (8*7) = 56 possibilities.
Roughly, you have 20 'standard' resistor values to consider,
7 * 56**3 * 20**12 = 5.1E21 cases to calculate.It's gonna take a LONG millisecond.
OP gave the impression that the (already fixed by the implementation that already exists before optimal values are determined for some reason) topology wasn't as free-form as that; at least from my interpretation of his post the yet-to-be determined resistors were parallel-connected across the feedback resistor with analog switches in series and that was non-negotiable.
If that's not at all the case then that does leave more room to maneuver and should be clarified...
... Oh, yeah, just parallel links. With all shunts open, the unswitched resistance sets the gain-of-20, and with all three closed (lowest resistance) you get gain-of-1, so there's only two free resistor values, and some RMS deviation measure can be made. It'll take 400-ish cases, and a simple "R2 greater than or equal to R3" free decision takes it down to 200. That, you can do by brute force search (though the ordering of the results isn't certain, you might have to sort the achieved gains before comparing them to the targets).
But, that just seems so dull. So, I made a ...more interesting problem. My bad.
Maybe I'm being thick here....
1 x n^3 = 20 thus you can get the multiplier n = 2.71. Thus the wanted values are 1k, 2.71k, 7.34k, 20k. Am I totally missing something?NT
Those are the required resistance of the feedback network with certain switches closed (or with the 3 switches R || 20k = your values).
-- Regards, Martin Brown
What you are trying to do can't be done. The resistance of the parallel combination of any resistors is always smaller than the smallest of the resistors. You have 8 combinations
20k 20k||R1 20k||R2 20k||R3 20k||R1||R2 20k||R1||R3 20k||R2||R3 20k||R1||R2||R3Notice that each of the three resistors appears in half the equations, so half of your selections will have resistances smaller than the smallest resistor. From your second highest gain setting we can quickly find one of the resistors.
20k||R1 = 13k ; R1 = 37.14kWe can now find the parallel combination of the other two from the lowest gain setting.
20k||37.14k||R2||R3 = 1k ; R2||R3 = 1.08kIf R2 and R3 are equal than they will be 2.16k and half of your settings will be less than 2.16k. If you make one of these resistors larger, the other gets smaller and half your range gets even smaller.
Half your range will always be smaller than your smallest resistor. To increase the size of your smallest resistor, you need to reduce the size of your largest resistor and lose the top of your range.
yes, my oops. R1=1k R1|R2|R3|R4 = 20k and R4/R1 = n^3
NT
Yep. The _real_ "solution" would be to insert a multiplying DAC in the feedback loop. ...Jim Thompson
-- | James E.Thompson | mens | | Analog Innovations | et |
Or, at least a part of the real solution: a three-bit DAC input would result in eight distinct gains, but not exponential progression.
Lookup table for eight gains of 1 to 20 by exponential steps is required
Table(0)= 12
18, 28, 43, 66, 102, 156, ...Table(7)= 240How did those old companders (u-law decoders) do the nonlinear gain?
The three switches determine eight possible gain settings. Eight distinct combinations, eight gains, not four, was the hope. Me, I'd do it with eight resistors, and n^7=20 sets the stepping...
Exponential voltage to current converter feeding the control input of an OTA gain block, probably.
Even handier: temp compensated voltage feeding the control input of an OTA e.g. LM13700 (diode characteristic on input pin, eh?).
Tim
-- Seven Transistor Labs, LLC Electrical Engineering Consultation and Contract Design
That makes me wonder: I know OP says the topology is fixed as to the number of elements in series with the analog switches parallel to the feedback resistor.
Could you get a better approximation to a linear increase in gain as you go up the scale by switching in some kind of combination of resistors and nonlinear elements (e.g. diodes) either in series or parallel, rather than just resistors?
You apparently can't do this, but brute force...
In actual practice, as I did for a WiFi repeater power control a number of years ago, you make a logarithmic DAC... except you choose your own personable ratio.
...Jim Thompson
-- | James E.Thompson | mens | | Analog Innovations | et |
Four resistors in series with three switches that short out three of the resistors.
R1 = 1 R2 = 2 switch A R3 = 4 switch B R4 = 8 switch C
C B A
0 0 0 R1+R2+R3+R4 = 15 0 0 1 R1+R3+R4 = 13 0 1 0 R1+R2+R4 = 11 0 1 1 R1+R4 = 9 1 0 0 R1+R2+R3 = 7 1 0 1 R1+R3 = 5 1 1 0 R1+R2 = 3 1 1 1 R1 = 1
Here is the way I do switchable gain on the integrated circuits I design...
It has the advantage that the resistance of the switches can be high, since they're not in series with a critical gain-setting resistor... and they contribute no TC. On a chip this is good, because it means reduced area... normal sized analog switches (
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.