Resistance Multiplier

Eclorian

Joined Aug 27, 2022
10
I am working on a final project for a 2-Year EET degree. It is an extremely basic analog calculator that takes the coefficients of 3 equations with x, y, z variables and outputs the values for x, y and z. The circuit operates using op amps.

The problem I'm running into is that I need a way to multiply a resistance, probably up to 50k or maybe 100k depending on how ambitious I get with the possible range of my coefficients. I thought of using a digital resistor, but the maximum voltage will be somewhere around 15V, and most of the digital resistors I have found cap out lower than this. Can anyone suggest a better way to do this?

I can always opt for a more complex solution, but this feels like something that should be easier than I'm making it.

I know this circuit is not really practical, it's really more of a learning experience and a way to demonstrate what I've learned in the course. Also, analog computers are fascinating.

Alec_t

Joined Sep 17, 2013
14,312
Welcome to AAC!
Look at the problem another way. Can you think of a way of reducing current instead?

MrAl

Joined Jun 17, 2014
11,457
I am working on a final project for a 2-Year EET degree. It is an extremely basic analog calculator that takes the coefficients of 3 equations with x, y, z variables and outputs the values for x, y and z. The circuit operates using op amps.

The problem I'm running into is that I need a way to multiply a resistance, probably up to 50k or maybe 100k depending on how ambitious I get with the possible range of my coefficients. I thought of using a digital resistor, but the maximum voltage will be somewhere around 15V, and most of the digital resistors I have found cap out lower than this. Can anyone suggest a better way to do this?

I can always opt for a more complex solution, but this feels like something that should be easier than I'm making it.

I know this circuit is not really practical, it's really more of a learning experience and a way to demonstrate what I've learned in the course. Also, analog computers are fascinating.
Hi,

First, do you have to multiply them on the fly (as the circuit is running) or can you multiply them before you turn the circuit on and then turn the circuit on after. This is an important question.

I would think you have to multiply them while the circuit is running, automatically, so my second question is can you use some simple sampling techniques?

I think maybe you should show your circuit too that would help us understand what you are doing better.

MrSalts

Joined Apr 2, 2020
2,767
Instead of adding resistance, why don't you think about an op amp or transistor to increase current through a fixed resistor to create a voltage?

Eclorian

Joined Aug 27, 2022
10
As I have had time to think through the problem more and review some sample solutions, I think my original idea of using a microcontroller and a digital resistor will be sufficient for the small calculations I will be doing.

I do like the idea of adjusting the current, depending on my time constraints, I may try to explore that further. My concern would be how that would effect the circuit down the chain. (This is essentially multiple chains of op-amps, one chain for each of the 3 equations.) Once I have a diagram of the circuit I'll post it on here for feedback. I am extremely novice with these things, so it takes a bit of time for me figure them out right now.

DickCappels

Joined Aug 21, 2008
10,169
If you can average over time, you can switch your resistor in and out of the circuit using pulse-width modulation.

(Above) the 10k resistor is multiplier by 1/(dutycycle) of the 2N3904 and is used as a PWM variable attenuator for the 1 Khz sine wave.

A transmission gate like the CD4066 also works well in this mode, just be sure to take the resistance of the transmission gate into account. I've had very good results using

A "digital pot" is a less challenging approach, but very likely to give expected results on your first try.

Eclorian

Joined Aug 27, 2022
10
If you can average over time, you can switch your resistor in and out of the circuit using pulse-width modulation.
View attachment 277000
(Above) the 10k resistor is multiplier by 1/(dutycycle) of the 2N3904 and is used as a PWM variable attenuator for the 1 Khz sine wave.

A transmission gate like the CD4066 also works well in this mode, just be sure to take the resistance of the transmission gate into account. I've had very good results using

A "digital pot" is a less challenging approach, but very likely to give expected results on your first try.
Thank you so much. After I figure out the digital pot, I would love to try figuring it out with this approach.

MrAl

Joined Jun 17, 2014
11,457
Thank you so much. After I figure out the digital pot, I would love to try figuring it out with this approach.
That's the 'sampling' approach i was talking about and it is fairly easy to understand.

The basic idea is that if a resistor of value K Ohms is switched out of the circuit for P percent of the time then the average resistance goes up by 1/(1-P).
For example, if you have a 100 Ohm resistor in the circuit and you switch it out for 50 percent of the time (a 50 percent duty cycle switching action) then the effective resistance goes up to 200 Ohms because 100/0.50=200 Ohms.
If you switch it out for 75 percent of the time (25 percent 'on') then the effective resistance goes up to 100/(0.25)=400 Ohms. That's because a resistor that is only in the circuit for 25 percent of the time looks like it has 1/4 of the original resistance, so we could say that if K is the 'on' duty cycle then the resistance is:
Reff=R/K
and so again if the on time is 25 percent of the total period then if R=100 then Reff=100/0.25=400 Ohms.
This would mean that if you used a 1kHz frequency which has a period of 0.001 seconds then had the resistor switched 'on' for 0.000250 seconds then the effective resistance would look like 400 Ohms if the original resistor value was 100 Ohms.
So it's kind of simple.

Just one catch, the rest of the circuit has to be capable of interpreting this switching action as an average. That would mean that there has to be some kind of storage involved such as as with an inductor or capacitor, and the switching frequency has to be high enough to be averaged smoothly enough for the rest of the circuit. This can either be immediate or somewhere else down the line as long as the final result looks the same as with a real resistor substituted for the switched resistor.
A place where this would work is with an ADC circuit with a pre-filter that is low pass, but it may not work with the same circuit if there is no pre-filter because of aliasing between the switching frequency and the ADC sampling frequency, so some care has to go into the application.
Very often you can increase the switching frequency to get smoother results, but that also depends on the application and how the rest of the circuit can average the changes over time.

You can use this idea for a lot of things though including oscillators where the switching frequency is higher than the oscillator frequency, and of course the output does not contain too much noise as a result (unless you can add a filter too).

It would be easy to control the resistance with a microcontroller, but to do it manually you end up back with the same problem, and that would go from adjusting the resistance to adjusting the duty cycle. A potentiometer would be good enough for a manual adjustment.

Another interesting application is if you have to adjust two isolated resistances at the same time, but dont want to use a double ganged potentiometer. You adjust the duty cycle, and both resistances change. Using two opto couplers you could even have two resistances that are galvanically isolated from each other change with that single duty cycle adjustment.

Eclorian

Joined Aug 27, 2022
10
That's the 'sampling' approach i was talking about and it is fairly easy to understand.

The basic idea is that if a resistor of value K Ohms is switched out of the circuit for P percent of the time then the average resistance goes up by 1/(1-P).
For example, if you have a 100 Ohm resistor in the circuit and you switch it out for 50 percent of the time (a 50 percent duty cycle switching action) then the effective resistance goes up to 200 Ohms because 100/0.50=200 Ohms.
If you switch it out for 75 percent of the time (25 percent 'on') then the effective resistance goes up to 100/(0.25)=400 Ohms. That's because a resistor that is only in the circuit for 25 percent of the time looks like it has 1/4 of the original resistance, so we could say that if K is the 'on' duty cycle then the resistance is:
Reff=R/K
and so again if the on time is 25 percent of the total period then if R=100 then Reff=100/0.25=400 Ohms.
This would mean that if you used a 1kHz frequency which has a period of 0.001 seconds then had the resistor switched 'on' for 0.000250 seconds then the effective resistance would look like 400 Ohms if the original resistor value was 100 Ohms.
So it's kind of simple.

Just one catch, the rest of the circuit has to be capable of interpreting this switching action as an average. That would mean that there has to be some kind of storage involved such as as with an inductor or capacitor, and the switching frequency has to be high enough to be averaged smoothly enough for the rest of the circuit. This can either be immediate or somewhere else down the line as long as the final result looks the same as with a real resistor substituted for the switched resistor.
A place where this would work is with an ADC circuit with a pre-filter that is low pass, but it may not work with the same circuit if there is no pre-filter because of aliasing between the switching frequency and the ADC sampling frequency, so some care has to go into the application.
Very often you can increase the switching frequency to get smoother results, but that also depends on the application and how the rest of the circuit can average the changes over time.

You can use this idea for a lot of things though including oscillators where the switching frequency is higher than the oscillator frequency, and of course the output does not contain too much noise as a result (unless you can add a filter too).

It would be easy to control the resistance with a microcontroller, but to do it manually you end up back with the same problem, and that would go from adjusting the resistance to adjusting the duty cycle. A potentiometer would be good enough for a manual adjustment.

Another interesting application is if you have to adjust two isolated resistances at the same time, but dont want to use a double ganged potentiometer. You adjust the duty cycle, and both resistances change. Using two opto couplers you could even have two resistances that are galvanically isolated from each other change with that single duty cycle adjustment.
I really appreciate the explanation, this will give me something to reference when I start playing with that approach. With everything being practically shut down for a couple years I didn't get any hands on practice in any of my classes, so some things I'm re-learning as I go along.

Eclorian

Joined Aug 27, 2022
10
Here is kind of a basic block diagram of the idea. I can already see a mistake I made on the first equation, so maybe ignore that for now. I sent this to my instructor to verify if it looked right, but I haven't heard back yet.

MrAl

Joined Jun 17, 2014
11,457
Here is kind of a basic block diagram of the idea. I can already see a mistake I made on the first equation, so maybe ignore that for now. I sent this to my instructor to verify if it looked right, but I haven't heard back yet.
View attachment 277044
Hi,

So what exactly are you trying to do?

Jerry-Hat-Trick

Joined Aug 31, 2022
551
It is an extremely basic analog calculator that takes the coefficients of 3 equations with x, y, z variables and outputs the values for x, y and z. The circuit operates using op amps.
Maybe I'm missing the point, but for me the key word is analog - i.e. no processor. A simple multiplier can be achieved by changing the gain of an Op Amp with a potentiometer. I'd have a largish circular cardboard disk behind each potentiometer knob so they can be calibrated - it's not linear with resistance, it's (R1 + R2)/R1.

And Op Amps can be used to add or subtract voltages.

Three variables and three equations is more complex so starting with 2 and 2:
ax + by = c
dx + ey = f
=> (bd - ae)y = (cd - af)

One Op Amp to multiply bd, one for ae, another to subtract one result from the other. Same again for (cd - af). Now multiply the output (bd - ae) by a value determined by twisting a potentiometer so that the output equals (cd - af). A resistor across the two outputs should have zero voltage across it - an analog moving coil meter with needle centered so it gives plus minus, switchable resistor(s) in series so you have coarse and fine adjustment without overloading the meter. Adjust the potentiometer to find the value of y on the coarse scale, switch to fine scale when the current is low.

I wonder if something like this is intended? A don't fancy solving 3 variables but I guess a similar approach could be used. I wouldn't worry about large values of a to f - I'm sure the project is more about understanding principles and making something work. Even a working solution for two equations two variables should get some approval...

Eclorian

Joined Aug 27, 2022
10
I finally have something I can demonstrate. Turns out, the original question I had was easier to solve than I thought. I have a new challenge, not sure if this should go in a new thread, but here goes:

The idea here is to solve 3 equations with 3 variables using op amps. Why someone would do such a thing is irrelevant, this is more of a learning exercise.

Using a format of Ax + By + Cz = D --- Ex + Fy + Gz = H --- Ix + Jy + Kz = L; then solving for the variables x, y, z.

The below circuit is solving for 2x + 3y + 4z = 5 --- 4x + 2y + 3z = 3 --- x + 4y + 2z = 4

My new challenge, is probably something simple, but I can't seem to get it right. For the coefficients of D, H, and L, I need to input a voltage. The rest of the coefficients are simple variable resistors in the op amp circuits. How can I do this using the main power rail, which will probably be very similar to below (a 24V supply with + and - rails). If I try to branch a parallel circuit from the +24V, all of my outputs go crazy and are way off. I tried researching voltage regulators and playing around with those, but that didn't seem to help either.

I think the problem is when I try to use any kind of resistor to regulate the voltage into the op amp circuit, it interferes with the circuit. How can I feed a variable voltage into those spaces so I guess it looks like a power source? I'm not even sure what I'm looking for, so any ideas would be appreciated.

EDIT: I think sometimes it helps to just write these posts out, I often come up with an answer immediately after posting. I think I may know what to do. I can probably just use another op amp as the input voltage, does this sound like a good solution?

Last edited:

MrAl

Joined Jun 17, 2014
11,457
I finally have something I can demonstrate. Turns out, the original question I had was easier to solve than I thought. I have a new challenge, not sure if this should go in a new thread, but here goes:

The idea here is to solve 3 equations with 3 variables using op amps. Why someone would do such a thing is irrelevant, this is more of a learning exercise.

Using a format of Ax + By + Cz = D --- Ex + Fy + Gz = H --- Ix + Jy + Kz = L; then solving for the variables x, y, z.

The below circuit is solving for 2x + 3y + 4z = 5 --- 4x + 2y + 3z = 3 --- x + 4y + 2z = 4

My new challenge, is probably something simple, but I can't seem to get it right. For the coefficients of D, H, and L, I need to input a voltage. The rest of the coefficients are simple variable resistors in the op amp circuits. How can I do this using the main power rail, which will probably be very similar to below (a 24V supply with + and - rails). If I try to branch a parallel circuit from the +24V, all of my outputs go crazy and are way off. I tried researching voltage regulators and playing around with those, but that didn't seem to help either.

I think the problem is when I try to use any kind of resistor to regulate the voltage into the op amp circuit, it interferes with the circuit. How can I feed a variable voltage into those spaces so I guess it looks like a power source? I'm not even sure what I'm looking for, so any ideas would be appreciated.

EDIT: I think sometimes it helps to just write these posts out, I often come up with an answer immediately after posting. I think I may know what to do. I can probably just use another op amp as the input voltage, does this sound like a good solution?
View attachment 277801
View attachment 277802
Hello,

I think you should try a single variable solution first like y=A*x+B before attempting a three variable problem with op amps or anything else. That's because to solve for any equation like this even the single variable problem you need to implement division or multiplication and op amps do not natively do that without some special addition to the circuit like a programmable resistance of some kind.
If you intend to use potentiometers to get the div or mult then maybe you can get this to work.

So my question is, how do you intend to implement the divisions and/or multiplications?
For the above single variable equation you would have to do:
y=A*x+B
and if x was the input voltage Vin then:
y=A*Vin+B
so A would be a gain factor and B an addition. The gain factor A could be a variable resistor in the feedback path of the op amp, and B would be an inverted addition which then you could invert to get the addition. But to solve this:
Y=A*x+B
for x you have to subtract first:
Y-B=A*x
then divide:
(Y-B)/A=x
So one op amp to do the subtraction and one with variable resistor in the feedback path to divide by A.

For circuits that do stuff like this there is often a special circuit involved and that is something like a 4 quadrant multiplier or some sort of log-antilog circuit to do the multiplication. If you do intend to use a potentiometer to vary the gain and thus the coefficients then it is much easier but you'll always have to set these gains by hand before you can solve the problem.

The solutions to the 3 variable problem are:
[x=(B*(H*K-G*L)+C*(F*L-H*J)+D*(G*J-F*K))/(A*(G*J-F*K)+B*(E*K-G*I)+C*(F*I-E*J)),
(A*(H*K-G*L)+C*(E*L-H*I)+D*(G*I-E*K))/(-A*(G*J-F*K)-B*(E*K-G*I)-C*(F*I-E*J)),z=(A*(H*J-F*L)+B*(E*L-H*I)+D*(F*I-E*J))/(A*(G*J-F*K)+B*(E*K-G*I)+C*(F*I-E*J))]

or:
[x=(B*G*L-C*F*L-B*H*K+D*F*K+C*H*J-D*G*J)/(A*F*K-B*E*K-A*G*J+C*E*J+B*G*I-C*F*I),y=
(A*G*L-C*E*L-A*H*K+D*E*K+C*H*I-D*G*I)/(-A*F*K+B*E*K+A*G*J-C*E*J-B*G*I+C*F*I),z=(A*F*L-B*E*L-A*H*J+D*E*J+B*H*I-D*F*I)/(A*F*K-B*E*K-A*G*J+C*E*J+B*G*I-C*F*I)]

so it looks kind of involved.

Eclorian

Joined Aug 27, 2022
10
Hello,

I think you should try a single variable solution first like y=A*x+B before attempting a three variable problem with op amps or anything else.
I actually did this using the same methods as you can see in my image above. My instructor and I even tested a practical circuit that was accurate to 2 or 3 decimal points. The simulation above also works for the 3 variable equations and gives the correct output. You can even adjust for a positive or negative coefficient. Adjusting the gain was the easiest way to accomplish this, even though I know there are surely more elegant ways. The bottom circuit above is the format for all of blocks. I just solved for each variable. The amazing part of this to me is that I can connect the variable inputs and outputs and the solution comes from that.

MrAl

Joined Jun 17, 2014
11,457
I actually did this using the same methods as you can see in my image above. My instructor and I even tested a practical circuit that was accurate to 2 or 3 decimal points. The simulation above also works for the 3 variable equations and gives the correct output. You can even adjust for a positive or negative coefficient. Adjusting the gain was the easiest way to accomplish this, even though I know there are surely more elegant ways. The bottom circuit above is the format for all of blocks. I just solved for each variable. The amazing part of this to me is that I can connect the variable inputs and outputs and the solution comes from that.
Did you ever draw a signal flow graph?
That would show the algebraic connections and sounds like what you are doing with the circuit. But what did you mean when you said, "I can connect the variable inputs and outputs"?

Eclorian

Joined Aug 27, 2022
10
Did you ever draw a signal flow graph?
That would show the algebraic connections and sounds like what you are doing with the circuit. But what did you mean when you said, "I can connect the variable inputs and outputs"?
Yes, I did. And I mean you can connect the x's to the x's and the y's to the y's. If you look at the images I uploaded you can see how everything is connected.

MrAl

Joined Jun 17, 2014
11,457
Yes, I did. And I mean you can connect the x's to the x's and the y's to the y's. If you look at the images I uploaded you can see how everything is connected.
You havent made it any clearer im afraid. There's only one 'x' on the schematic and it's "x2".