Types of circuits that have a nonlinear response to R

  • #1
BiGyElLoWhAt
Gold Member
1,630
134
TL;DR Summary
I'm looking to be able to approximate a few orders of a taylor series expansion using a potentiometer, particularly a sin wave.
Hi, I am ultimately looking to be able to have an analog circuit with an amplifier that uses a pot for the resistor over the op amp (maybe there's a better way, let me know if there is). I want to be able to control the shape of the gain roll-on/roll-off, and have it be functions of R, particularly sin(R_pot).

Is there a "simple" way to do this? I.e. can I construct a circuit that gets me ##V_{out}/V_{in} = f(\vec{x}) sin(R)## or something to that extent? x vector here is just some set of variables, probably w, L, c, etc. My other thought is if I have something with 3 degrees of freedom, so maybe 3 capacitors or something, I should be able to tune the values to the coefficients of the taylor series for sin, assuming I can construct a circuit that has R, R^3, and preferably R^5. I checked a graph and the first 2 terms are decent, but the 5th order term really makes it nice. I am looking for when the pot is halfway on, the gain is sqrt(2)/2, when it's 2/3 on root 3/2, 1/3 on it's 1/2, up to full on gain is 1... or at least really close to those values.

Ideally I would like either near-constant frequency response or no frequency response, although I think there are ways to adjust the phase afterwards.
 
Engineering news on Phys.org
  • #2
There are a couple of ways you can do this using a microcontroller (uC) and an ADC and DAC. Or are you wanting to try to do this only with analog components? What accuracy and temperature stability do you need?
 
  • #3
There are several solutions. Each depends on the methods you like and the accuracy you need. So, you may need to be more specific. In the digital world, it would be an ADC, some calculations in SW, and DAC. In the analog world, you could use a network of forward biased diodes (piece-wise linear response), but I would probably just use a multiplier IC (Gilbert Cell, if you want the steam punk DIY version).
 
  • Like
Likes BiGyElLoWhAt and berkeman
  • #4
Can you just apply a sin wave to a variable clipper?
 
  • Like
Likes DaveE and BiGyElLoWhAt
  • #5
I would prefer to do it analog. It's just coding with psoc or arduino, which is easy enough. It's partially an exercise/trying to understand circuits better, partially I want to build something.
 
  • #6
Actually, something like this clipper and multiplier might work. Multiply Vout by my source signal. I might need a latch as well. I never consider diodes when I'm trying to design stuff, I'm not sure why.
 
  • #7
BiGyElLoWhAt said:
I never consider diodes when I'm trying to design stuff, I'm not sure why.
Probably your good instincts to worry about tempco and matching issues destroying your signal accuracy... :wink:
 
  • Like
Likes BiGyElLoWhAt
  • #8
berkeman said:
Probably your good instincts to worry about tempco and matching issues destroying your signal accuracy... :wink:
BTW, just to expand on that since you are using this project as a learning experience...

When analog design engineers want to use something like diodes or transistors in precision analog circuits, they lay them out on the same die and with special layout techniques to ensure good matching and thermal tracking. When you buy a matched transistor pair (all in the same package), the matched transistors are on the same die, and usually would consist of multiple interconnected transistors to form each overall transistor of the matched pair. The multiple transistors from each of the matched pair are interleaved in ways to try to ensure that they will thermally track each other, and other non-linear effects are matched as well by the layout.

When you try to use discrete diodes and transistors in a design, it is not possible to do this sort of interleaved matching layout on the same die, so your design performance will suffer. For hobby-level circuits, that may be okay. But it's important to understand the limitations of non-matched components so you can set your expectations for the performance/accuracy of your circuit. :smile:
 
  • Like
Likes DaveE and BiGyElLoWhAt
  • #9
OK, thanks, I will keep that in mind. This might turn into something where I will have to be very concerned with accuracy. Only time will tell. I appreciate the help everyone. One more question, is there a good online simulator that's free (actually) that I can use? All of the ones I've used so far have tried to make me buy or sign up after just 2-3 simulations.
 
  • #10
BiGyElLoWhAt said:
This might turn into something where I will have to be very concerned with accuracy.
Then IMO you will either have to design and lay it out on a single die, or you should go the route suggested by a couple of us above of using a uC and ADC/DAC.

BiGyElLoWhAt said:
is there a good online simulator that's free (actually) that I can use?
What kind of simulator? If you want a circuit simulator LTSPICE is free to download.
 
  • Like
Likes BiGyElLoWhAt
  • #11
I did mean circuit simulator. Thank you.
 
  • Like
Likes berkeman
  • #12
BiGyElLoWhAt said:
I did mean circuit simulator. Thank you.
Keep in mind that when you use a SPICE simulator and place multiple diodes or transistors, they all will have default/matched parameters, and their temperature will not change with power dissipation. To get an idea of how your real-world circuit will perform, you will need to use the Monte Carlo simulation option in any SPICE package. That will vary all of your component values within their tolerances in different simulation runs to give you an idea of the overall circuit performance. Monte Carlo simulations are an important part of any production quality analog circuit design. :smile:
 
  • Like
Likes BiGyElLoWhAt
  • #13
OK, I'm messing with the program now. I'll keep that in mind for when I get further into the circuit.
 
  • Like
Likes berkeman
  • #14
The first approximation to a sinusoid is a parabola.
If I remember rightly, from 1974, you can get a square law response from a linear pot.
Consider a linear potentiometer, with the cw and acw ends connected. The resistance between the connection and the wiper follows a parabola as you rotate the pot.
If you only want one side of the parabola, connect cw and acw with a fixed value resistor, having the same resistance as the pot. You will then have a resistance between the wiper and cw or acw following a square law response. Select cw or acw, according to the direction you want the change.
 
  • #15
A square law curve can be similar to an "inverted" sine if proportioned carefully and can be obtained using a diode.
 
  • #16
tech99 said:
Can you just apply a sin wave to a variable clipper?
Or a fixed comparator with a sinewave frequency that varies with R. Maybe based on a wave-shaping function generator IC like the old (ancient) XR2206? The problem with this approach, in general, is it is a sampled data system, not really linear. If R changes at the wrong time, it may take a while for the sampler to update. So, if you are going to go with a sampled data system, I'd just do everything in SW myself.

Maybe you could use the diode shaping network in the XR2206 without the oscillator. Like you are making a 0Hz sine wave? IDK, I'd have to think about that IC harder than I want to. But it's cheap and it has a good shaping network built in.


BiGyElLoWhAt said:
is there a good online simulator that's free (actually) that I can use?
LTSpice is the most common choice amongst EEs in my experience.
 
Last edited:
  • #17
tech99 said:
A square law curve can be similar to an "inverted" sine if proportioned carefully and can be obtained using a diode.
Further to that, if the angle in degrees is represented by a current I ranging, say, from 0 to 90 microamps, and called theta, then cos theta is within about 4% of a square law given by 1 -( I/90)^2, so could be done with an op amp and a diode.
 
  • #18
BiGyElLoWhAt said:
Is there a "simple" way to do this?
There is a single component solution.

A resolver, operating as a transformer, generates two output channels, one is proportional to the sine of the shaft angle, the other is proportional to the cosine of the shaft angle.
At shaft angle t ; for signal input a ; S1 = a * Cos( t ) ; S2 = a * Sin( t ) .
https://en.wikipedia.org/wiki/Resolver_(electrical)
Bandwidth is limited to audio, from about 50 Hz to 5 kHz.

You can achieve the same with a variometer, having modified connections.
https://en.wikipedia.org/wiki/Inductor#Variable_inductor
Use the primary as the input, with the secondary as the output.
A variometer, having an air core, will operate over the audio and radio spectrum.
 
  • #19
Baluncore said:
There is a single component solution.

A resolver, operating as a transformer, generates two output channels, one is proportional to the sine of the shaft angle, the other is proportional to the cosine of the shaft angle.
At shaft angle t ; for signal input a ; S1 = a * Cos( t ) ; S2 = a * Sin( t ) .
https://en.wikipedia.org/wiki/Resolver_(electrical)
Bandwidth is limited to audio, from about 50 Hz to 5 kHz.

You can achieve the same with a variometer, having modified connections.
https://en.wikipedia.org/wiki/Inductor#Variable_inductor
Use the primary as the input, with the secondary as the output.
A variometer, having an air core, will operate over the audio and radio spectrum.
OK. But, big expensive and not really a DC circuit.
Yes, you could do this and it would work, you know, steam punk style. Shaft angle as a function of resistance? Yep, that would work... with a motor.

One of the strong biases I acquired in 30 years of analog design was to avoid, at almost all costs, adding mechanical things in systems that don't already have mechanical things as a fundamental constituent. They are expensive, big, and unreliable, compared to electronics.

Still, it's a good idea about how to make a sine response without a second-order DE.
 
  • #20
Not sure about the electronic/mechanical conclusion. For example, I believe a modern vehicle which uses electronics liberally, even when not essential, such as for adjusting a seat, is not preferable to an earlier mechanical one. The electronics are a source of costly repairs and difficult diagnosis and I would much prefer the simpler design having, say, a mechanical fuel injection system and no ECU.
 
  • #21
DaveE said:
OK. But, big expensive and not really a DC circuit.
The resolver shaft is a DC mechanical input, like a pot shaft, that controls the gain of the AC coupled transformer circuit. Resolvers can be similar in size to a small DC motor with a wound rotor and field. If it only moves through 90° then the slip-rings or a commutator are not needed, and you can use a cheap toy DC motor as a one channel resolver. Prices for precision resolvers made in China can be less than $100.
https://www.aliexpress.com/item/1005005801411840.html

DaveE said:
Yes, you could do this and it would work, you know, steam punk style. Shaft angle as a function of resistance? Yep, that would work... with a motor.
And there I was thinking the OP wanted a pot that was hand adjustable, that would give an op-amp circuit, a gain proportional to the sine of the pot angle.
Replacing the pot with a resolver would solve that problem. No pot, and no motor would be needed to convert the pot resistance, into movement of a resolver. The resolver can be rotated by hand, just like the pot.

DaveE said:
Still, it's a good idea about how to make a sine response without a second-order DE.
It is not a new idea, it has been the standard engineering solution to the problem for the last century.

Synchro and resolver circuits have been around for years. They are simply not understood by most engineers, nor used outside of aviation, ballistic computers, phase locked machinery, or wheel balancing machines.
 
Last edited:
  • #22
This reminds me of a 1923 or 1927 paper where a combination of linear and conical potentiometers are used to produce a nonlinear pot that removes the nonlinear dependence of a loaded voltage divider.

Ingenuity and simplicity combined.
 
  • #23
SredniVashtar said:
Ingenuity and simplicity combined.
Or the wedge shaped pot element that has a resistance related to the log of the shaft position.
 
  • #24
As the pot is adjusted linearly from p=0 to p=100%,
the gain of the amplifier varies from: G=0 to G=1-(p/100)2.
That is a close approximation to the form of a cosine function.
The two sides of the pot R=a+b, are simulated here by R2=a, and R3=b.
1-Cos(p).png
 
  • Like
Likes DaveE
  • #25
I'm not seeing the curve on the plot @Baluncore ...?

Baluncore said:
That is a close approximation to the form of a cosine function.
The two sides of the pot R=a+b, are simulated here by R2=a, and R3=b.
1732409770056.png
 
  • #26
berkeman said:
I'm not seeing the curve on the plot
The plots are for 5% steps of the pot setting. Each line represents the gain across the audio spectrum for a different setting. Notice how the lines get closer at the top. If the gain was simply proportional to the pot position, then the gains would be equally spaced.

100% pot gives a gain of 1.000
95% pot gives a gain of 0.9975
90% pot gives a gain of 0.990
65% pot gives a gain of 0.877
50% pot gives a gain of 0.750 which is close to the 0.7071 wanted
30% pot gives a gain of 0.510
10% pot gives a gain of 0.190
5% pot gives a gain of 0.0975
0% pot gives a gain of 0.0000
 
  • #27
Hmm, I wonder if there is a better way to show the data. Maybe not in LTSpice I guess -- it might take some post-processing...
 
  • Like
Likes DaveE
  • #28
I used LTspice to document the circuit diagram, and to demonstrate that the gain is proportional to 1-x2, not linearly to shaft angle x.

Here, the approximation circuit; 1-(1-x)2; is plotted in yellow,
with the first quadrant of sine(x), plotted in magenta.
dump.png
 
Last edited:
  • Like
Likes berkeman
  • #29
Baluncore said:
As the pot is adjusted linearly from p=0 to p=100%,
the gain of the amplifier varies from: G=0 to G=1-(p/100)2.
That is a close approximation to the form of a cosine function.
The two sides of the pot R=a+b, are simulated here by R2=a, and R3=b.
View attachment 353831
You can improve the fit by adding a fixed resistor across R3. But then we need to wonder, what's the point? Does it really need to be any better?
 
  • Like
Likes Baluncore
  • #30
DaveE said:
You can improve the fit by adding a fixed resistor across R3.
To optimise the least squares fit, what value should the added resistor be in terms of R.

Before we take the next step, we would need to know what the circuit was being used for. Without a specification from the OP, we cannot really optimise the fit.

With sin(x) being transcendental, there is no possibility of perfectly satisfying the fit. If 1-x2 is not close enough, get a resolver.

For all we know, the OP has realised, that sin(x) is not what was needed.
 
Back
Top