Author Topic: Digital adjustable resistor  (Read 8297 times)

0 Members and 1 Guest are viewing this topic.

Offline eslavkoTopic starter

  • Contributor
  • Posts: 43
  • Country: si
Re: Digital adjustable resistor
« Reply #50 on: October 01, 2022, 08:03:14 am »
Got it.
If I linear space resistor in betwen R nad R/2 I got best response. If I go betwen R and R/3 the response is worse but I can get wider range. Will try to find compromise.

 
The following users thanked this post: Nominal Animal

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2389
  • Country: gb
  • Recovering Electrical Engineer
Re: Digital adjustable resistor
« Reply #51 on: October 03, 2022, 12:23:14 pm »
I decided to model an electronic resistor out of curiosity. Then I stumbled upon this https://www.edn.com/electronic-rheostat-provides-decades-of-load-resistance/
Nice and easy. You'd have to rescale R1 and R2 to suit your purposes. As the man says, if you run it of a battery, it floats. Note the stabilty components.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Digital adjustable resistor
« Reply #52 on: October 03, 2022, 08:02:06 pm »
I decided to model an electronic resistor out of curiosity. Then I stumbled upon this https://www.edn.com/electronic-rheostat-provides-decades-of-load-resistance/
Nice and easy. You'd have to rescale R1 and R2 to suit your purposes. As the man says, if you run it of a battery, it floats. Note the stabilty components.
The whole point is it's supposed to be digitally controlled. Using a digital potentiometer would make it easy to control with a microcontroller, via an opto-isolator. It needs to be suitable for a 9V supply. I found the MCP45HV51-104E/ST on Mouser.
https://www.mouser.co.uk/datasheet/2/268/20005304A-347268.pdf

The MAX480 is not recommended for new designs. I wonder if the OP07 could be used instead? An LED could be used to lift the local 0V up by 2V, so a single supply op-amp isn't needed. The frequency compensation might need to be adjusted, as the OP07 is much faster. The downside is it will use more current, so perhaps an isolated DC:DC converter could be used, rather than a battery.

Here's the circuit with the values changed to give 75R to 2k, which is more than enough. I went for a slightly wider range, because the digital potentiometer has a tolerance of 20%, so it might have a much lower value of 80k. The circuit would need to be calibrated, if such a wide tolerance is unacceptable.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Digital adjustable resistor
« Reply #53 on: October 03, 2022, 08:46:22 pm »
I decided to model an electronic resistor out of curiosity. Then I stumbled upon this https://www.edn.com/electronic-rheostat-provides-decades-of-load-resistance/
Nice and easy. You'd have to rescale R1 and R2 to suit your purposes. As the man says, if you run it of a battery, it floats. Note the stabilty components.

The whole point is it's supposed to be digitally controlled. Using a digital potentiometer would make it easy to control with a microcontroller,

The resulting resistance is given by R_eff = (1+R1/R2)*R_shunt where R1 is the upper leg of the non-inverting input voltage divider.

A digital pot could be used for R1 to give linear spacing between resistances.

Alternatively, it seems that you could use the original parallel control idea for R2 since such a configuration gives linear spacing between conductances, i.e. R_eff = (1+R1*G2)*R_shunt.
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1429
Re: Digital adjustable resistor
« Reply #54 on: October 04, 2022, 12:06:19 am »
The "optimum" resistor set is linear, down to about half the largest one.

As a practical example, with 100Ω, 75Ω, 50Ω you can get 23.1Ω, 30.0Ω, 33.3Ω, 42.9Ω, 50Ω, 75Ω, and 100Ω.

You can combine 1.0, 0.9, 0.8, 0.7, 0.6, 0.5 into 0.118, 0.134, 0.136, 0.139, 0.142, 0.147, 0.155, 0.158, 0.161, 0.164, 0.166, 0.169, 0.173, 0.173, 0.176, 0.181, 0.183, 0.187, 0.187, 0.192, 0.196, 0.199, 0.203, 0.209, 0.209, 0.214, 0.214, 0.220, 0.226, 0.229, 0.230, 0.235, 0.238, 0.243, 0.244, 0.248, 0.255, 0.264, 0.265, 0.272, 0.273, 0.283, 0.292, 0.298, 0.308, 0.321, 0.323, 0.333, 0.343, 0.360, 0.373, 0.375, 0.394, 0.412, 0.424, 0.444, 0.474, plus you then have the 0.500, 0.600, 0.700, 0.800, 0.900, 1.000 on their own.

This is because parallel resistor arrays simply mathematically cannot provide many combinations in the upper half:
For N resistors in parallel, the total resistance cannot exceed max(R)/N, where max(R) is the largest resistor in the parallel array of N resistors.  Thus, the distribution in the upper half is the set of individual resistances (within the upper half).

Given N such resistors, with largest 1 and smallest 0.5, the minimum resistance possible is 1/(2×(N-1)×sum(1/(N+k-1), k=0..N-1)). 

For N=2, 1/3≃0.333; for N=3, 3/13≃0.231; for N=4, 10/57≃0.175; for N=5, 105/743≃0.141; for N=6, 252/2131≃0.118; for N=7, 2310/22727≃0.102; for N=8, 25740/288851≃0.0891; for N=9, 9009/113567≃0.0793; for N=10, 136136/1904613≃0.0715; for N=11, 11639628/178964263≃0.0650 ≃ 1/15.  Since the minimum for N=24 is 204773655626139600/6837434095326667939≃0.0299489 ≃ 1/33, the tradeoff with this approach is the minimum stays relatively high (about 1/Nc, with 1≤c≤1.2555 for N≥4), even with many resistors.

In my opinion, if you want a linear distribution of total resistances, parallel configurations just won't work: the upper half of the total resistance range is always covered by individual resistors, no matter what you do!  It is a square peg in a round hole; the wrong tool for the job.

Yes i had to agree that parallel resistors is not a very good way to do that.
I think the way to look at it is that sometimes there is simply no dual to some circuit so transforming from series to parallel is not actually possible.  Some circuits that are a little more complicated do have duals, but some simply do not.  That's life.  The next best thing is to try to come up with something that is usable but not perfect, or go with a more elaborate design.

If i was to build something like this i think i would go with the dual action relay idea because that allows a lot of flexibility and nearly perfect linearity.

The down side to all of this is that there are always gong to be limitations i probably could not live with unless it was being designed for a PARTICULAR application.  In other words, it would be difficult to design a resistor bank that went from 0.1 Ohms to 100k Ohms, so you are stuck with choosing a range.
Back when i worked in the industry, none of this would work because the power dissipation of the 'resistors' would simply be too high.  We're talking up to 10kWatts, 3 phase, and it's very hard to design a resistor bank for something like that.  The only way is to use banks of resistive load cones that can handle up to 500 to 1000 watts each, and a bunch of screw in lamp bases.  With that you can screw in the 'resistors' you need and simply dont screw in those you dont need.  A benefit is it also works with AC.

For DC, i favor the control circuit and transistor(s) method. That is where you adjust the current not the resistance.  You can get a wide variation in current levels and it's fully adjustable.  i used this idea back in the 1990's with a simple setup where a single potentiometer would be used to adjust the base current to an NPN power transistor.  You can get a wide variation in current with that simple setup.  Might need a driver transistor also, and of course depending on power levels you probably need a heat sink of the appropriate size, and possibly a parallel transistor arrangement to handle larger power levels.
 

Offline eslavkoTopic starter

  • Contributor
  • Posts: 43
  • Country: si
Re: Digital adjustable resistor
« Reply #55 on: October 04, 2022, 06:36:24 am »


That circuit seems to near avoid trouble from post #20, as input amplifier isn't saturated but has only 'opamp dif err' when load is not connected. But the circuit itself doesn't solve the primary deal. As I start that thread the tester was intended for some use but in time arised that it can be used for one more task. Its just software change and span. The required span is from 50 Ohm up to 3kOhm with max 15 ohm step (mimic 0.5% resistor) , up to 4k5 with max step of 30 O (mimic 1% resistor).

On boot time device have self callibration procedure (connecting known voltage to input and measure current from 24bit ADC) to avoid drifts. 
 

Offline eslavkoTopic starter

  • Contributor
  • Posts: 43
  • Country: si
Re: Digital adjustable resistor
« Reply #56 on: October 04, 2022, 06:48:58 am »
... just wonder how to add PWM/PDM signal to mimic R1/R2 in circuit from #55. For example to set value of 2k Digipot to get lowest resistance required, and to set 100k potentiometer with resistor to get max resistance required, and parallel with that resistor to have PWM/PDM controlled switch. If switch works in few MHz range just the small capacitor at + input of opamp can filter fignal.
I allready do similar but I was feeding PWM through RC filter directly to + input of opamp, and failed as + input can have some high voltage and - input can have 0 V if there are no load, thus saturate opamp. With getting IN+ voltage as reference for PWM I think this situation can be avoided. Need to make some tests.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Digital adjustable resistor
« Reply #57 on: October 04, 2022, 10:37:53 pm »


That circuit seems to near avoid trouble from post #20, as input amplifier isn't saturated but has only 'opamp dif err' when load is not connected. But the circuit itself doesn't solve the primary deal. As I start that thread the tester was intended for some use but in time arised that it can be used for one more task. Its just software change and span. The required span is from 50 Ohm up to 3kOhm with max 15 ohm step (mimic 0.5% resistor) , up to 4k5 with max step of 30 O (mimic 1% resistor).

On boot time device have self callibration procedure (connecting known voltage to input and measure current from 24bit ADC) to avoid drifts.
I've just realised the circuit I posted would require the digital potentiometer to be powered off +IN.

I thought you wanted 100R to 1k6. Now you say 50 to 3000 with 15 Ohm steps or up to 4500 with 30 Ohm steps. Which is it?

All you need is a string of resistors, bypassed with switches, whether they be mechanical relays, or solid state.

You just need more bits.

A chain of: 15, 30, 60, 120, 240, 480, 960, 1920 would give 0 to 4607 Ohms, in 15 Ohm steps. You could add another resistor in series, which isn't switched out, to give a minimum resistance.
 

Offline jwet

  • Frequent Contributor
  • **
  • Posts: 455
  • Country: us
Re: Digital adjustable resistor
« Reply #58 on: October 05, 2022, 02:41:54 pm »
The OP-07 is a nice op-amp but is no good on single supply.  Its common mode is a volt off its V- terminal (max 2v). Setting up a a pseudo ground gets kind of messy in DC type circuits.  An LM-358 would probably work fine.  A few mV of offset wouldn't be a big deal here.
« Last Edit: October 05, 2022, 02:47:04 pm by jwet »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Digital adjustable resistor
« Reply #59 on: October 05, 2022, 06:19:58 pm »
The OP-07 is a nice op-amp but is no good on single supply.  Its common mode is a volt off its V- terminal (max 2v). Setting up a a pseudo ground gets kind of messy in DC type circuits.
The LED forms a pseudo ground and should work quite well in this application.
Quote
An LM-358 would probably work fine.  A few mV of offset wouldn't be a big deal here.
The problem with the LM358 is the offset voltage is a bit higher and would affect the accuracy, especially at lower voltages.
 
The following users thanked this post: jwet

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1057
  • Country: us
Re: Digital adjustable resistor
« Reply #60 on: October 06, 2022, 09:25:42 am »
To answer your ORIGINAL question, EXACTLY as it was asked,

NO! You can not use any sequence of four resistor values in the PARALLEL circuit you show to produce a LINEAR sequence of overall resistance values. It is MATHEMATICALLY IMPOSSIBLE.

This is because resistance values, in parallel do not directly add together. It is their reciprocals that do add together and reciprocals produce an entirely different type of mathematical sequence than that produced by the numbers themselves. And, of course, after adding the reciprocals, you must take the reciprocal of the sum.

If the numbers graph as a straight line, then the reciprocals graph as a curved line and if the reciprocals graph as a straight line, then the numbers graph as a curved line. OK, it is not really that simple. But you can take my word for it or look at the following attempt.

Since resistors in parallel will always result in a combined value that is less than either (any) of the individual resistors, we need to start with the highest value desired. You said 1600 Ohms. Now, what value is needed, in parallel with 1600 Ohms to get 1500 Ohms? I get 24K Ohms. So that is one value we will need. Next, what value is needed, again in parallel with 1600 Ohms to get 1400 Ohms? I get 11.2K Ohms. Notice it is not the nice, neat 12K Ohms which would be half of 24K Ohms. Here are two tables that attempt to show a the list of individual, parallel resistors that are needed to get the linear sequence you want:

1608010-0

You can see that neither of them works. The first table starts with a 1600 Ohm resistor and then shows the values for individual resistors that need to be in parallel with that 1600 Ohms to bring the combination to the values at steps of 100 Ohms. These are in the second column. The resulting sequence is not very regular and I see no way to combine any of the values there into any kind of groups. You simply need all 16 different values. I added a third column in an attempt to find a common difference. This is one simple trick to find a pattern in a sequence of numbers. But it too yields nothing. I even tried a second column of differences (not shown) but they too were still quite irregular.

The second chart tries to combine the parallel resistances in an additive manner. So the 1500 total value would use one resistor in parallel with the 1600 Ohm one. And the 1400 total would need two. The 1300 would use all three down to that point, etc. This produced a slightly better sequence and the differences show a sequence in 200 Ohm jumps. But even that does not allow us to construct a circuit.

In short, there just is NO WAY to do what you want with parallel resistors, no matter what the values are unless you are willing to use a total number of resistors equal to the number of total values you want. The math just does not allow it.

This is why I, along with others, suggested a SERIES circuit instead of a parallel one. As we have said, four resistors in series along with relays or other means of shorting them individually, WILL give you sixteen values, spaced at equal intervals. I suggested relays because FETs at different DC bias points (along that series string of resistors) will need a complicated set of driving circuits.



LM324

This works as DC load. But It sucks when applied voltage is square wave. (When input voltage at FET is 0V the opamp and FET is saturated, and on fast rising ramp (0.5us/20V) the whole thing just oscillate few ms. I did try this approach and try to avoid saturations but without success.
« Last Edit: October 06, 2022, 09:29:43 am by EPAIII »
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 
The following users thanked this post: eslavko

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2389
  • Country: gb
  • Recovering Electrical Engineer
Re: Digital adjustable resistor
« Reply #61 on: October 06, 2022, 01:40:07 pm »
Notes the Gm stage hast be fast. That s not easy in the tradional V to I source, the opamp can't drive the MOSFET porperly.
Its  a bit easier using a Darlington insted of a MOSFET.
Driver stages just make compensation even more problematic.
You can control β with a multiplying DAC. Take care that the DAC doesn't see the high voltage. You can pot down twice if needs be.


Make a or buy a servo controled pot.
So much less pain.
 https://www.eevblog.com/forum/chat/digitally-controlled-potentiometer-i-got-this!/
https://onlinecontrols.com/dc-motorized-potentiometers/


 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6241
  • Country: fi
    • My home page and email address
Re: Digital adjustable resistor
« Reply #62 on: October 06, 2022, 03:43:01 pm »
Make a or buy a servo controled pot.
A dual one, where one side was used to measure some reference voltage (AVcc works fine, as this is just a ratiometric measurement) by using the side as a voltage divider, might be particularly useful.  Instead of keeping track of the resistance in memory, one could use the potentiometer state itself, its measured resistance, as the value.
Of course, that assumes the two tracks have the same resistance.

If you find a non-servo pot, you can use an ubiquitous small 28BYJ-48 stepper with a ULN2003A driver, and a pair of plastic gears to drive the pot.  Trivial to drive from a microcontroller, and ubiquitous in the Arduino world.  These have internal gearing, so that a full turn is typically 2048 steps, but it does vary.  You can also use a timing belt, or even a short length of silicone, rubber, or PVA tubing as a direct inline coupler.  3D printed PLA gears and pulleys work fine for this kind of low loads, but you can find lots of suitable ones at eBay, Banggood, et.al., and also by maker-oriented companies.

The real problem I see, is that potentiometers usually cannot dissipate much heat; and high-power rheostats tend to be expensive –– 25W 5kOhm Ohmite RHS5K0E costs 80€ at Mouser –– and at least Mouser has them in single-gang only.  The dual-gang 5kOhm ones I found at Mouser topped at 1 W.  (Which means the current over the potentiometer should not exceed 15mA when the resistance is 4500 Ohms; or 47mA at 450 Ohms; or 149mA at 45 Ohms.)

As a comparison, you can get ten Omron G5RL-K1A-E-DC5 latching relays for under 45€ (total for ten), giving you 1024 steps. (Say, 5 Ohm steps from 5 Ohm to 5120 Ohm).  These relays can handle up to 16A 25VDC, and only need 5V 120mA for 10ms (0.0216 mAh) to switch.  They latch, meaning they draw no current except when switching.  You can use for example three ULN2003A Darlington arrays to drive ten of these relays (but I'd also add ten diode pairs to snub the voltage spikes).  If you don't have 20 GPIO pins in your MCU, you can use for example three 74HCT595A serial-to-parallel chips, and five GPIO pins instead.  For 5 Ohm steps up to 5120 Ohm, the needed resistances are 5, 10, 20, 40, 80, 160, 320, 640, 1280, and 2560 Ohms.  For say max. 8A current, the resistances need to be able to dissipate 12.8W, 6.4W, 3.2W, 1.6W, 0.8W, 0.4W, 0.2W, 0.1W, 0.05W, and 0.025W, respectively.  Single resistors suffice for the two highest ones (if you find precise enough ones!), but the rest I would build out of parallel arrays, with plenty of room in between for cooling.
« Last Edit: October 06, 2022, 03:51:00 pm by Nominal Animal »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Digital adjustable resistor
« Reply #63 on: October 06, 2022, 04:52:55 pm »
A servo controlled potentiometer will need a considerable level of calibration. The tolerance is typically 20%, or poorer and matching is poor for dual ganged units.

An array of resistors, bypassed with switches is by far the best option, in terms of close tolerance, cost and simplicity.
 

Offline eslavkoTopic starter

  • Contributor
  • Posts: 43
  • Country: si
Re: Digital adjustable resistor
« Reply #64 on: October 07, 2022, 05:48:45 am »
To answer your ORIGINAL question, EXACTLY as it was asked,

NO! You can not use any sequence of four resistor values in the PARALLEL circuit you show to produce a LINEAR sequence of overall resistance values. It is MATHEMATICALLY IMPOSSIBLE.
few ms. I did try this approach and try to avoid saturations but without success.

Thanks for that!

During that post I realised that linear response is impossible.
But I can live with nonlinear response if the steps on high range are not to coarse.
In the start of topic I had a range from 100 to 1600 Ohms with steps to mimic 0.5% resistor.
But I see another use for device if I widen range to be from 50 to 4500 Ohm.
The step from 50 Ohm to 3k Ohm should be under 15 Ohm (mimic 0.5% scale), and from 3k to 4k5 with max 30 Ohm step (mimic 1% resistor).

So how many bits I need to accomplish that? I need someone who know math better than me  :--.

And as reply to other's. Device is handheld, battery powered. At  lowest range the dissipation is around 20W. So there are no place for relays, servo rheostats. Dynamic nature of signal prevent to use opamps driving current sources...



 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Digital adjustable resistor
« Reply #65 on: October 07, 2022, 06:43:33 am »
A chain of: 15, 30, 60, 120, 240, 480, 960, 1920 would give 0 to 4607 Ohms, in 15 Ohm steps. You could add another resistor in series, which isn't switched out, to give a minimum resistance.

1920+960+480+240+120+60+30+15 only gets you to 3825 so you'll need an additional switchable resistor to get to 4500.

This makes sense since 4500/15 = 300 and log base 2 of 300 is > 8 so you should need at least 9 resistors.


The step from 50 Ohm to 3k Ohm should be under 15 Ohm (mimic 0.5% scale), and from 3k to 4k5 with max 30 Ohm step (mimic 1% resistor).

So how many bits I need to accomplish that? I need someone who know math better than me  :--.


To span from 50 to 3K in increments of 15R you need at least 8 bits (log base 2 of 3000/15).

Using Zero999's scheme plus a 3840R resistor (total of 9 resistors) you can span 15R to 7.6K in increments of 15R which covers both of your use cases.



Alternatively, it seems that you could use the original parallel control idea for R2 since such a configuration gives linear spacing between conductances, i.e. R_eff = (1+R1*G2)*R_shunt.


I think it is worth investigating the schematic in Reply #52 but where R2 is a set of switchable parallel resistors and the top leg of the divider is fixed. For instance, consider the following selection:

R_shunt = 35R
for the "2k digital pot + 100k variable" use a fixed 13.7K resistor (call this R1)
for R2, use a switchable parallel combination of 9 resistors with values 32K, 16K, 8K, 4K, 2K, 1K, 500R , 250R and 125R.

The effective resistance is given by (1+R1/R2)*R_shunt. This gives a minimum resistance of (1+13.7/32)*35 = 50R and an increment of (13.7/32)*35 = 15R.
« Last Edit: October 07, 2022, 07:27:45 am by ledtester »
 

Offline eslavkoTopic starter

  • Contributor
  • Posts: 43
  • Country: si
Re: Digital adjustable resistor
« Reply #66 on: October 07, 2022, 08:39:26 am »

Using Zero999's scheme plus a 3840R resistor (total of 9 resistors) you can span 15R to 7.6K in increments of 15R which covers both of your use cases.



Alternatively, it seems that you could use the original parallel control idea for R2 since such a configuration gives linear spacing between conductances, i.e. R_eff = (1+R1*G2)*R_shunt.


I think it is worth investigating the schematic in Reply #52 but where R2 is a set of switchable parallel resistors and the top leg of the divider is fixed. For instance, consider the following selection:

R_shunt = 35R
for the "2k digital pot + 100k variable" use a fixed 13.7K resistor (call this R1)
for R2, use a switchable parallel combination of 9 resistors with values 32K, 16K, 8K, 4K, 2K, 1K, 500R , 250R and 125R.

The effective resistance is given by (1+R1/R2)*R_shunt. This gives a minimum resistance of (1+13.7/32)*35 = 50R and an increment of (13.7/32)*35 = 15R.

Seems nice. All switches are ground based so no gate drive problems. Need to check if OPAMP saturation and transitions are solved. If there are no IN+ voltage the inverting and noninverting inputs are at 0V. I think this worth to be tested. And impact of R4/C1 on transitions.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6241
  • Country: fi
    • My home page and email address
Re: Digital adjustable resistor
« Reply #67 on: October 07, 2022, 02:54:09 pm »
The formula for calculating how many binary switching elements you need is
$$N = \log_2 \left \lceil \frac{\max - \min}{\text{step}} \right\rceil$$
where \$\lceil x \rceil\$ is rounding up to next whole integer, and \$\log_2\$ is base-2 logarithm; you can use \$\log_2 x = (\log x) / (\log 2)\$ (regardless of the base of the logarithms on the right side, as long as you use the same one for both).

Or, in another terms, \$\log_2\lceil x \rceil\$ means you find the smallest power of two that is at least \$x\$, i.e. the smallest \$k\$ for which \$x \le 2^k\$, and use the exponent \$k\$.

When you have \$N\$ switching elements in series, there are \$2^N\$ combinations.  The base one, \$\text{step}\$, is then
$$\text{step} = \frac{\max - \min}{2^N - 1}$$
If you round it up, you'll push \$\max\$ higher; round it down, and you reduce \$\max\$:
$$\max = \min + (2^N - 1)\text{step}$$
(The term \$2^N-1\$ comes from the fact that the largest \$N\$-bit value is \$2^N-1\$.  There are a total of \$2^N\$ values, yes, but the smallest one is zero.)

The step from 50 Ohm to 3k Ohm should be under 15 Ohm (mimic 0.5% scale)
\$\frac{3000 - 50}{15} \le 197\$, and the closest power of two not smaller than that is \$256 = 2^8\$, so you need 8 steps for that.  You'll also need a non-switchable 50 Ohm resistor in series with the switchable ones.

and from 3k to 4k5 with max 30 Ohm step (mimic 1% resistor).
Because the steps are formed by the smaller resistors, you save nothing by combining two separate linear scales into one resistor pack.  Here, you'd need \$33\$ steps, and even if we round it down to \$32 = 2^5\$, you'll still add five new resistors.

If you instead extend the range to 4k5, \$\frac{4500-50}{15} \le 297\$,  the closest power of two not smaller than that is \$512 = 2^9\$.  Only one added resistor, in other words.

So how many bits I need to accomplish that?
Only nine, and you get a full 50 to 4k5 range with constant-sized steps, assuming exact resistor values.

You even have options.  For example, if your smallest resistor is 10 Ohms, and you start at 10 Ohms (i.e. have an unswitchable 10 Ohms always in series), the range will be from 10 Ohm to 5120 Ohm (0 to 5110 Ohm if you do not have a fixed 10 Ohm resistor), with a step of 10 Ohms, because
$$\max = \min + 10 \times (2^9 - 1) = \min + 10 \times 511 = \min + 5110$$

Edited: In practice, if each switchable resistor is precise to within \$v/N\$ (in Ohms, i.e. absolute precision, not relative precision like is usually used), your resistor pack will be precise to within \$v\$ Ohms.  There are other ways to ensure precision, but I think this is the most useful (I could be wrong, though).

In any case, I personally would get – borrow, hire – a precise resistance meter when building the resistor packs.
« Last Edit: October 07, 2022, 03:16:02 pm by Nominal Animal »
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2389
  • Country: gb
  • Recovering Electrical Engineer
Re: Digital adjustable resistor
« Reply #68 on: October 07, 2022, 05:00:26 pm »
Something that could easily be automated?
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6241
  • Country: fi
    • My home page and email address
Re: Digital adjustable resistor
« Reply #69 on: October 07, 2022, 06:49:37 pm »
Something that could easily be automated?
I could create a self-contained tool page that requires no server nor internet access, only a browser; works fine if you save the page locally on your computer and open it from there.  Similar to my Finite Impulse Response spectrum analysis page.  What would be useful there?

Most of the work in these is trying to devise an user interface that works well in a browser.  For example, the above one only requires you to paste some coefficients in the top (center-right) bar –– say, 1 0 1 ––, and press Enter.

Maximum power dissipation per resistor is easy to calculate if the overall current drawn through the series system is specified.

Linearity and relative and absolute error calculation is possible, if one specifies a minimum and a maximum resistance for each element.  Since the page is standalone, one could even let each value be calculatable via JS eval(): even though that opens cross-site scripting vulnerabilities (since it allows the execution of arbitrary javascript in the context of that page), in this particular case, it would be fully acceptable.

So, I'm thinking of at least two separate tools: one to find out the number of resistors needed and their power dissipation when maximum current through the series system is specified, and the other to show how the selection of particular resistors affects the overall precision and monotonicity.

Or did you mean something completely different?
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Digital adjustable resistor
« Reply #70 on: October 07, 2022, 08:10:04 pm »
A chain of: 15, 30, 60, 120, 240, 480, 960, 1920 would give 0 to 4607 Ohms, in 15 Ohm steps. You could add another resistor in series, which isn't switched out, to give a minimum resistance.

1920+960+480+240+120+60+30+15 only gets you to 3825 so you'll need an additional switchable resistor to get to 4500.

This makes sense since 4500/15 = 300 and log base 2 of 300 is > 8 so you should need at least 9 resistors.


The step from 50 Ohm to 3k Ohm should be under 15 Ohm (mimic 0.5% scale), and from 3k to 4k5 with max 30 Ohm step (mimic 1% resistor).

So how many bits I need to accomplish that? I need someone who know math better than me  :--.


To span from 50 to 3K in increments of 15R you need at least 8 bits (log base 2 of 3000/15).

Using Zero999's scheme plus a 3840R resistor (total of 9 resistors) you can span 15R to 7.6K in increments of 15R which covers both of your use cases.



Alternatively, it seems that you could use the original parallel control idea for R2 since such a configuration gives linear spacing between conductances, i.e. R_eff = (1+R1*G2)*R_shunt.

You're right. 9-bits are required, for 15R increments and > 4k5.
« Last Edit: October 07, 2022, 10:13:12 pm by Zero999 »
 

Offline eslavkoTopic starter

  • Contributor
  • Posts: 43
  • Country: si
Re: Digital adjustable resistor
« Reply #71 on: October 08, 2022, 10:23:25 am »
I say  0.5% up to 3k and 1% up to 4k5.
Can someone calculate how many bits I need if I use pure parallel aproach? I know that in upper range steps will be coarser and this is reason why I say 1% from 3k to 4k5.

All serial circuits are out of question as driving fet needs serious gate circuit (float voltage up to 30V) or at least to use P fet, zener, resistor and another pulldown transistor (of course -V generator is necessary in that case ). relays are just to bulky to be usable


(it's easyer to add few bits and keep parallel resistors than redesign all thing to have serial resistor.)
« Last Edit: October 08, 2022, 10:26:22 am by eslavko »
 

Offline eslavkoTopic starter

  • Contributor
  • Posts: 43
  • Country: si
Re: Digital adjustable resistor
« Reply #72 on: October 08, 2022, 10:32:33 am »
Something that could easily be automated?
I could create a self-contained tool page that requires no server nor internet access, only a browser; works fine if you save the page locally on your computer and open it from there.  Similar to my Finite Impulse Response spectrum analysis page.  What would be useful there?

Most of the work in these is trying to devise an user interface that works well in a browser.  For example, the above one only requires you to paste some coefficients in the top (center-right) bar –– say, 1 0 1 ––, and press Enter.

Maximum power dissipation per resistor is easy to calculate if the overall current drawn through the series system is specified.

Linearity and relative and absolute error calculation is possible, if one specifies a minimum and a maximum resistance for each element.  Since the page is standalone, one could even let each value be calculatable via JS eval(): even though that opens cross-site scripting vulnerabilities (since it allows the execution of arbitrary javascript in the context of that page), in this particular case, it would be fully acceptable.

So, I'm thinking of at least two separate tools: one to find out the number of resistors needed and their power dissipation when maximum current through the series system is specified, and the other to show how the selection of particular resistors affects the overall precision and monotonicity.

Or did you mean something completely different?

Actually I still prefer parallel resistors (inperfect response) but no gate driver hassle.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Digital adjustable resistor
« Reply #73 on: October 08, 2022, 06:02:32 pm »
All serial circuits are out of question as driving fet needs serious gate circuit (float voltage up to 30V) or at least to use P fet, zener, resistor and another pulldown transistor (of course -V generator is necessary in that case ). relays are just to bulky to be usable
There are some very small relays:
https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=1-1773734-7_IM_Relay_I_Type&DocType=DS&DocLang=English
Or go solid state.
https://toshiba.semicon-storage.com/info/TLP241A_datasheet_en_20200217.pdf?did=14237&prodName=TLP241A

Another option is opto-couplers which can be used to drive high-side MOSFETs.
https://www.infineon.com/dgdl/pvi5013r.pdf?fileId=5546d462533600a401535683d8d12940
https://toshiba.semicon-storage.com/info/TLP3905_datasheet_en_20200929.pdf?did=15185&prodName=TLP3905
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Digital adjustable resistor
« Reply #74 on: October 08, 2022, 06:30:33 pm »
 
The following users thanked this post: Tigerwoods


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf