Electronics > Beginners

Any way to change a linear DC voltage to a x^2 response?

<< < (3/4) > >>

T3sl4co1l:
1. Slide rule

Take the exponent.  Apply gain of 2.  Take the logarithm.

Downsides: requires thermally and electrically matched diodes/transistors to achieve few-% accuracy.

Very popular for a time (60s-70s).  All the analog methods were popular around then, really.

2. Multiplier

2a. Multiplier IC.  The aforementioned AD633 and a few relatives.  Some mixers and OTAs.  The ready-made kind are pretty accurate, somewhat noisy, and these days, very special purpose ($$).

2b. Guts of a multiplier.  Gilbert cell, OTA or other mixer structure.  These start with the exp or tanh function of a transistor or diff pair, so you only get the leading (product or square) terms for small signals.  The input can be pre-distorted with diodes and stuff (that's how the multipliers do it), extending the range (basically, noise floor) for a given amount of distortion.

2c. Weird multipliers.  Tektronix patented these, back in the day -- if you take a bunch of diff pairs (each having a tanh function) and wire their inputs in series (I think?) and their outputs in the correct pattern, you can synthesize the general Taylor series of many functions, including other exp-family functions like trig (sin/cos)!  The number of stages functions much like the order of the approximation, so you might consider a couple stages for about one hump of sine, or half a dozen stages for a couple cycles, etc.

Of course, you can use 1-cos(x) as x^2 over a limited range.

2d. PWM multiplier.  Create a linear PWM generator (can use a 555 with current sources to make linear ramps, then a comparator to slice the triangle wave into PWM), and drive an analog switch between 0V and VREF.  VREF is the same input signal setting PWM.  Filter the result.  Voila: you've got VREF*VREF.  This is a 1- or 2-quadrant multiplier depending on what kind of analog switch you've used, or if you cancel out offsets or not.  Downsides: not terrific accuracy (dominated by messy switching edges), slow (bandwidth and delay limited by PWM frequency and output ripple).

3. Samplers

Start with a periodic function that resembles x^2, and convert the input signal into a time delay synchronized to that function.  Sample the function, and optionally filter the output to smooth out the sampling steps.

x^2 is not a periodic function, so this obviously only works over some range.  You might start with a low-distortion sine wave, and sample part of the peak, in the same way as 2c. uses 1-cos(x) ~= x^2 over a local range.

Or we could integrate the input value, making a ramp waveform with variable rate.  If we sample that ramp at a proportional time delay, then reset the integrator and repeat, we get \$ \int_0^x x dt = x^2\$.

4. Anything else analog

Any physical phenomenon that has an even-order nonlinear term (and probably some other well-behaved properties) can be used in ways like the above.  Cancel out other terms until the desired term remains.  Constant and linear terms can be calibrated out easily (as long as they don't vary with other parameters like temperature or supply voltage).  Higher order terms can be canceled in certain ways (e.g. put together two or three multiplier cores with different signs of operands), or simply reduced by keeping the argument small, at the expense of noise floor (since noise is constant but your signal might be 10mV versus 100mV).

5. Digital

Arguably, this is part of #3 because of sampling, but it's also nonlinear in so many extreme ways (i.e., the implementation of a full digital function plus converters) that it would be kind of silly to model it that way.  But yeah, ADC-multiplier-DAC, simple as that!

Obvious limitations: number of bits, sample rate.  Note that, when you multiply two numbers together, you expect about twice as many digits out.  If you sample the two inputs at 12 bits, you ideally need a 24-bit output!  This could get pretty extreme -- and not something you're likely to achieve from an analog solution where the noise has constant and proportional terms ruining your ENOB -- but 24-bit DACs are absolutely reasonable.  Needless to say, this method offers accuracy far beyond anything an analog solution can offer, and this (and cost) is why analog solutions disappeared in the 70s-80s.

Methods?

An MCU or FPGA to run the ADCs and DAC, obviously enough.  May suffer from inconsistent timings, because of instructions and interrupts and stuff (well, the MCU more so than the FPGA).  Depending on how it's written, of course.  Use whatever type of hardware you like, that meets the ENOB and sample rate required.

On a lower level, a bit-serial ADC and DAC would actually be very easy.  You can half-clock the ADCs (so you're producing two half-bits every cycle), multiply them together plus carry (very simple logic, can solve with a couple of gates), then clock the full product bits into the DAC.

Excccccccccept... you'll never get LSBs first out of a serial ADC, that would be crazy.  You'd have to stack the bits in a shift register, then shift them out in reverse, into the multiplier.  And then whatever order the DAC is, which I'd have to look up if they're usually MSB first or last.

So you'd actually incur the multiplier logic, a few shift registers, and a state machine to control everything, which is kind of sucky.

Or if you get a parallel-out ADC, you can use a selector/mux instead of shift register, which is probably the better way to go.  These are a bit antiquated, honestly, though I think they're still in production.

So yeah, a couple of lines of Arduino is looking pretty good, eh? :P

Tim

Ground_Loop:
How about something like this, an overall unity gain Voltage Controlled Amplifier (VCA).  Of course you'll need to play with the resistor values to get correct scaling and such.  Tie both inputs together to get a squared function.

atmfjstc:
What are you trying to do, specifically? It sounds like you might be trying to normalize/undistort the output of a sensor. In that case, are you sure that squaring it is the ideal transformation? In my experience I have to play with various functions before I get what I need, and often end up with gentler exponents like 1.2, 1.3 etc instead of 2.

If you find an exponent different from 2 serves you better, you'll probably need a different op-amp setup (or better yet, just do it digitally). One way to do it would be to take the logarithm of the signal, then amplify this by a tunable "constant", then exponentiating it again. e^(a * ln(x)) = e^(ln(x^a)) = x^a.

james_s:
This is actually an interesting topic, at first glance I thought "oh that's easy" then thinking about it further I realized it's not so straightforward. I do like this old analog stuff, I mean they figured out ways to compute all sorts of complex math with analog systems back in the day.

atmfjstc:
Now that I think about it, I remember that FETs have a quadratic dependency of I_D vs V_GS when in saturation. So maybe you could add the threshold voltage to the input voltage, feed it to the gate, and get a quadratic current dependency at the output which you can then trivially turn into a voltage.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod