0 Members and 1 Guest are viewing this topic.

#### eslavko

• Contributor
• Posts: 29
• Country:
« on: September 26, 2022, 04:26:55 pm »
Hello...

Is it possible to make digital adjustable resistor based on attached schematics?
I can't find proper resistor values to have for example 100 to 1600 ohm values in linear range.

...and resistors are of range tens of watts...
[attach=1]

#### Kleinstein

• Super Contributor
• Posts: 12222
• Country:
« Reply #1 on: September 26, 2022, 04:31:28 pm »
Switching with the MOSFETs only works well for 1 direction of the current and low voltge in the other direction.
Finding the right values may be tricky, but with high power one could use parallel / sereis connections. This can also help reducing the BOM.   Power resistors are often not very accurate anyway and may need some trimming / added parallel resistor for fine adjustment.

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #2 on: September 26, 2022, 04:40:54 pm »
The 'resistor' will see DC voltage. I know that values for each resistor will be strange. The problem is that I fail to calculate R1...R4 values.

#### jwet

• Regular Contributor
• Posts: 171
• Country:
« Reply #3 on: September 26, 2022, 05:14:05 pm »
You don't say but this but this looks a bit like an electronic load type circuit- unipolar.  You can make a constant R type load from a current sink by using the input voltage to program the sink current to a standard op-amp FET type current sink.  The higher the volts, the higher the current, just like an R.  You adjust the fraction of the voltage that take to adjust the R.  If this is just a one time need, most electronic load will do constant R mode.  Also at your resistances this wouldn't be too bad.  The confusing part is 10 watts across a 1600 ohm resistor is about 125 volts.  The benefit is this is that you don't need a lot of high power R's (expensive) just a bank of FET's on a good heat sink.

If I was making a more universal type "floating" resistor, I would consider using something like Photomos parts like the Panasonic AQY211EHAX.  These can do an amp continuous, conduct in both directions, etc.  The FET's are actually turned on by light from the LED's so you don't have to mess with biasing, etc.   This would allow you to make network the resistors in a 100,200,400,800 series string.  I would take 3 Photomos, the base 100 ohm would be unswitched minimum a Photomos across each of the upper 3.  You might buy 200's and series and parallel them to get your values- cheaper by the dozen.  Opto isolation is a nice side effect.

Don't overlook plain old relays or latching relays if power is tight.  They still have their place but at these resistance values, their best attribute- low low R is kind of wasted.  Have fun.  Also add a fuse to this rascal- if my calcs of the volts and amps are right, this could be dangerous during failures.

#### Kleinstein

• Super Contributor
• Posts: 12222
• Country:
« Reply #4 on: September 26, 2022, 05:22:20 pm »
The get a large range and about equal steps it would be test to have resistors in 1,2,4,8,16,...  ratio. The steps would be equal for 1/R.
Depending on the intended use is may be also OK to have several equal resistors for the smallest value as this helps with the BOM.
With mechanical realys one could even consider unsing the same high resistors in series or parallel depending on the needs. This works well with 3 resistors in series and 2 additional links to switch to a parallel  configuration.

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #5 on: September 26, 2022, 05:47:27 pm »
Opamp solution doesn't work well.

The applied voltage is 0 to 30V but i's like PWM. Using single FET and opamp I can't got working result. FET/OPAMP works if I use DC or slowly changed DC. But with Square wave at 10kHz all thing rings to much.

Resistors in ratio 1,2,4,8 doesn't works as results aren't  linear...
the results for 1,2,4,8 are:

GATES   Resistance
0000   open
1000   1.0
0100   2.0
1100   0.6666666666666666
0010   4.0
1010   0.8
0110   1.3333333333333333
1110   0.5714285714285714
0001   8.0
1001   0.8888888888888888
0101   1.6
1101   0.6153846153846154
0011   2.6666666666666665
1011   0.7272727272727273
0111   1.1428571428571428
1111   0.5333333333333333

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #6 on: September 26, 2022, 05:50:40 pm »
Even 1/1, 1/2, 1/4, 1/8 doesn't work...
Resistors 1.0,  0.5,  0.25,  0.125 gave me:

0   0000   open
1   1000   1.0
2   0100   0.5
3   1100   0.3333333333333333
4   0010   0.25
5   1010   0.2
6   0110   0.16666666666666666
7   1110   0.14285714285714285
8   0001   0.125
9   1001   0.1111111111111111
10   0101   0.1
11   1101   0.09090909090909091
12   0011   0.08333333333333333
13   1011   0.07692307692307693
14   0111   0.07142857142857142
15   1111   0.06666666666666667

#### ejeffrey

• Super Contributor
• Posts: 3066
• Country:
« Reply #7 on: September 26, 2022, 08:18:08 pm »
You aren't going to get get exactly linear resistances out of switched parallel resistors because their conductances add not their resistances.

If you don't need tremendous resolution the easiest way is to use more stages than you need (say 6 or , then just select the closest values to what you need.   The non-linearity is always going to be extreme near the highest resistances, so let's say you want resistances from the range 0..1.  Use R values of 4, 2, 1, 0.5, 0.25, .125] and you will get a lot of values in the range of 1/16..1.  There will also be resistance values up to 4, but they will be widely spaced and less useful.

#### EPAIII

• Frequent Contributor
• Posts: 418
• Country:
« Reply #8 on: September 27, 2022, 05:33:37 am »
If you want to use a 1, 2, 4, 8 sequence of resistors, you are going to have to arrange them in series. Then each resistor can be shorted by a relay in parallel. Drive the relays with transistors, FETs, or even logic chips.

#### strawberry

• Super Contributor
• Posts: 1054
• Country:
« Reply #9 on: September 27, 2022, 06:26:04 am »
LM324

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #10 on: September 27, 2022, 06:36:11 am »
If you want to use a 1, 2, 4, 8 sequence of resistors, you are going to have to arrange them in series. Then each resistor can be shorted by a relay in parallel. Drive the relays with transistors, FETs, or even logic chips.

I'm allready know that combination 1,2,4,8 doesn't work. But I just wonder if there is any other combination that will give similar results

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #11 on: September 27, 2022, 06:40:29 am »
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.

#### CountChocula

• Supporter
• Posts: 81
• Country:
« Reply #12 on: September 27, 2022, 12:02:03 pm »
I'm allready know that combination 1,2,4,8 doesn't work. But I just wonder if there is any other combination that will give similar results

That combination should work if you place it in series and bypass each resistor with a switch that shorts across its terminals. In theory, it gives you linear resolution of 1/(2^n), where n is the number of resistors you have in series. In practice, you have to deal with non-linearity caused by resistor tolerances. This is basically how an e-pot works, except those are usually laser-trimmed to match the resistors to a certain precision—and even those can typically only achieve 10% tolerance.

One thing you can do to avoid dealing with weird resistor values is to use an R-2R ladder, which only requires two values (really, only one, since you can double it up to obtain the 2R arm of the ladder) and, again, gives you theoretically linear resolution. If you want to control it with MOSFETs, though, I think you're going to have to deal with a lot of losses in the circuit, because the transistors aren't perfect switches; depending on the performance characteristics of your circuit, you may be better off using relays. I sketched up a simplistic example for you—as you can see, even the simulator shows less-than-perfect performance (assuming I wired my circuit correctly, of course).

HTH!

—CC

#### Terry Bites

• Super Contributor
• Posts: 1657
• Country:
• Recovering Electrical Engineer
« Reply #13 on: September 27, 2022, 01:50:08 pm »
You can use a ladder network. Its easy to work out the binary sequence and values you need.

MOSFET ringing at switch on can be reduced by limiting the gate voltage rise time.
A series gate resistor, say 10 Ohms will help.
Its like pwm or is it pwm?
Where does the opamp come into it?

« Last Edit: September 27, 2022, 04:32:08 pm by Terry Bites »

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #14 on: September 27, 2022, 03:39:05 pm »
You can use a ladder network. Its easy to work out the binary sequence and values you need.

MOSFET ringing at switch on can be reduced by limiting the gate voltage rise time.
A series gate resistor, say 10 Ohms will help.
Its like pwm or is it pwm?
Where does the opamp come into it?

I tried similar as strawberry posted.
It's not PWM. Source give two informations one is frequency and other is ratio. Voltage is irelevant and can be any from 5V up to about 30V - Must be 50V safe. The 'load' must change resistance betwen low portition of signal and should mimic pure resistor close as possible.

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #15 on: September 27, 2022, 03:46:26 pm »
To be more specific I have working circuit as I posted. It have 11 bits (I posted with 4 just for clarity). But in current circuit I have only one FET active at time. So I have 11 useable values (matching my requirements), now I got idea to do testing device with same hardware but instead using only one bit at time to use as binary number.  So the FETs must be grounded, and actually I can't change design, but can change values (piggybacking resistor is allowed) and can change firmware.
So I just wonder if there is any way to get more linear response. If I use 1/1, 1/2, 1/4, 1/8 seems pretty logharitmic curve and not line.

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #16 on: September 27, 2022, 03:48:57 pm »
I sketched up a simplistic example for you—as you can see, even the simulator shows less-than-perfect performance (assuming I wired my circuit correctly, of course).

HTH!

—CC

I don't need DAC, but variable resistor. So that circuit and R2R variant probably can't work

#### Terry Bites

• Super Contributor
• Posts: 1657
• Country:
• Recovering Electrical Engineer
« Reply #17 on: September 27, 2022, 05:18:50 pm »
All is revealed! Make sure you manage the heat and layout properly.

It it really ringing or do you have a poor grounding set up at the scope probe? See our friend Dave
It might also suck because you didn't take enough care contructing it.  A bad grounding and decoupling scheme will make ringing far more likely.

It may also ring horribly becasue the pulse souce supplying it has its own stability and/ or output drive issues. Again very likely, it will have a finite ouput impedance and who knows what strays. Unless you have perfect cables, limitless power and speed it will affect performance.
You'll have to check that.

How fast a rise time do you need?
How much overshoot/ undershoot are you aiming for?

#### ejeffrey

• Super Contributor
• Posts: 3066
• Country:
« Reply #18 on: September 27, 2022, 05:57:29 pm »
To be more specific I have working circuit as I posted. It have 11 bits (I posted with 4 just for clarity). But in current circuit I have only one FET active at time. So I have 11 useable values (matching my requirements), now I got idea to do testing device with same hardware but instead using only one bit at time to use as binary number.  So the FETs must be grounded, and actually I can't change design, but can change values (piggybacking resistor is allowed) and can change firmware.
So I just wonder if there is any way to get more linear response. If I use 1/1, 1/2, 1/4, 1/8 seems pretty logharitmic curve and not line.

As I posted above: it's impossible to get a linear resistance range by adding fixed resistors in parallel.

The way to get close is to A) use more stages that you might otherwise think, and B) use a restricted region of the total range.

If you use binary weighted resistors as has been suggested you get something which is linear in conductances.  It is not logarithmic, it is 1/x.  So plot 1/x, and then you will see that if you pick a restricted region it can be approximately linear.  Scale your resistor values so that your desired range fits there, then use enough stages that you can adjust for imperfections by varying the code.

Otherwise you will need to put the resistors in series and use floating switches.

#### MrAl

• Frequent Contributor
• Posts: 850
« Reply #19 on: September 28, 2022, 03:51:32 am »
Hello,

If you use resistors 4,3,2,1.1 you get the following total resistances.  The hex code is the code that it takes to get that value.  The values have been sorted so you can see the increments and they are not equal.  The increments are shown on the far right.  Note hex code 00 produces an open circuit because all switches are off, but you could add a permanent parallel resistor to get some lower value and not affect the other values too much unless it is a low value.

0.501901,  0F,
0.573913,  07,  0.072012
0.602740,  0B,  0.028827
0.670051,  0D,  0.067311
0.709677,  03,  0.039627
0.804878,  05,  0.095201
0.862745,  09,  0.057867
0.923077,  0E,  0.060332
1.100000,  01,  0.176923
1.200000,  06,  0.100000
1.333333,  0A,  0.133333
1.714286,  0C,  0.380952
2.000000,  02,  0.285714
3.000000,  04,  1.000000
4.000000,  08,  1.000000
inf,           00,  inf

A better idea i think is to bite the bullet and use a 1 of 16 decoder and 16 'switches' and 16 hand selected resistances that range from 1 to 16 or really whatever you want.  You could also have a second set of 16 resistors and switch them out or in with another switch.  This would involve both N channel MOSFETs and P channel MOSFETs.

An even better way i think is to create a digital resistance decade box.
This would involve two 1 of 10 decoders, around 20 switches, and around 20 resistors.  One set could go from say 0 to 9 Ohms in steps of 1 Ohm each and the second set from 10 to 90 Ohms in steps of 10 Ohms each (and one switch has to create 0 Ohms for that bunch too).  That way you can get resistances from 0 to 99 ohms in steps of 1 Ohm each with an 8 bit binary word.  You may have to make some adjustments in the resistor values for the 'on' state resistance of the transistors, but if you only have to go say 0 to 90 Ohms in steps of 10 Ohms and then 100 to 900 Ohms in steps of 100 Ohms then the transistor on state resistance may not matter as much.  Again this would involve both N and P channel devices and perhaps some carefully planned drive circuits.
I could see something like this making a nice load box for testing power supplies and the like.

Another perhaps even more interesting idea would be to combine a current source with some known resistances.  Since you can make a zero Ohm active current shunt this way, i would think you could create an 'any' Ohm shunt (which is just a resistor) this way too.  It would take a decent voltage or current controlled current source and some control circuitry which may only require an op amp or two.  If the resistances will only be used in a DC circuit this would be possible, but an AC version would have to be faster to response to fluctuations in the signal.
The main idea here is to make a larger resistor look lower or a lower resistor look higher in value by feeding the circuit a current from an external current source under the control of a measurement circuit.
« Last Edit: September 28, 2022, 03:59:50 am by MrAl »

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #20 on: September 28, 2022, 06:15:58 am »
All is revealed! Make sure you manage the heat and layout properly.

I have that design for my battery bank capacity tester. Works perfect for that but misearably failed as load resistor for 'PWM' tester.

When you have load connected and Opamp inputs are the same (current matched Vref) all works perfect. Even frequency response is good. But now let's go to the worst case scenario. Assume the load is disconnected. voltage at R2 is 0V and inverting input is at 0V. But noninverting input is at some voltage and the output of opamp is saturated at high voltage and fet is saturated too. Now when you connect load the inrush current will be much higher as opamp must go out of saturation and this take time in range of a few microseconds up to milisecond (depend on quality of opamp).

#### Kleinstein

• Super Contributor
• Posts: 12222
• Country:
« Reply #21 on: September 28, 2022, 10:47:52 am »
With enough resolution one can just the parallel configuration to get relatively close to the values you want. It just adds a little math and more channels (with relatively large resistors and thus low power).

#### eslavko

• Contributor
• Posts: 29
• Country:
« Reply #22 on: September 28, 2022, 11:27:19 am »
With enough resolution one can just the parallel configuration to get relatively close to the values you want. It just adds a little math and more channels (with relatively large resistors and thus low power).

That is... I just wonder if there are some better selection available? with 1/1, 1/2, 1/4 .... values and 11 bits I have, the lower 2/3 of scale have good resolution but in upper 1/3 the range is to coarse.

#### Kleinstein

• Super Contributor
• Posts: 12222
• Country:
« Reply #23 on: September 28, 2022, 12:27:43 pm »
Other resistor stepping should not get significant better, as there would than be uneven holes in the 1/R scale and thus more problems. Ohne could just change the range, so that 2/3 of the resistance would be the new full scale. So there would be a few point above the normally used range.

#### Terry Bites

• Super Contributor
• Posts: 1657
• Country:
• Recovering Electrical Engineer
« Reply #24 on: September 28, 2022, 01:27:19 pm »
You'll find the maths much easier if you work in conductances. Use G instead of R. See explanation at:

Decide on a range of conductances Gs and increments of G needed. All that 1/(1/R1-1/R2....) stuff will drive you mad. G1+G2... will save you time and headaches. Gselect= 1/Rselect
Easy, but as noted there is no linear arangement of resistor branches that can be paralleled.
So my suggestion is that you buy a box of 10R resistors and build a matrix and swich it with good old relays. No ringing there.

« Last Edit: September 29, 2022, 09:05:09 am by Terry Bites »

Smf