Non-linear functions ...

Nov 24, 2009 58 Replies

I don't know but if I had to do it with analog I might simply do averaging. This will produce a spline approximation:

for example:

75 3.27 100 3.75

if your input was 80 then your output is (3.75 - 3.27)/(100-75)*(80 - 75) +

3.27. i.e., fitting a line between the two points.

now, you implement the analog electronics to compute that equation then use a multiplexer to select the different data points which is simply setup by using appropriate resistors that feed your analog equation calculator.

For a large number of data points this is out of the equation as also if linear approximation is bad. (you can use better approximations but the analog circuitry starts to get very complex real quick)

You gotta decide when the analog method starts to become more complex than a uC. Alsoa uC will, in general, be much more accurate and be easily changed even after fab.

On a sunny day (Tue, 24 Nov 2009 15:45:11 -0700) it happened "Paul Hovnanian P.E." wrote in :

.-----. .----. .-----.

An other advantage is that he wants a digital display, the micro can drive a LCD direcly, no need for a DAC(or PWM).

"Richard Rasker" a écrit dans le message de news:

4b0c4dde$0$729$ snipped-for-privacy@textreader.nntp.internl.net...

Of course the microcontroller-based approach proposed in previous posts is very probably the easiest solution. On the "nearly analog" way there are some chips dedicated to signal conditionning and sensor linearization, like the PGA309 from TI (see

formatting link
However it will probably not be easy to use it in your application as the liearisation is done through a modification of the sensor excitation and is adapted to wheatstone bridges. But may be you could add an external aop or two ?

Friendly yours, Robert

formatting link

"Robert Lacoste" a écrit dans le message de news: 4b0ce377$0$936$ snipped-for-privacy@news.orange.fr...

A variant may be more easily adaptable to your application :

formatting link
Robert

But..but..but.. Transistors have been used for ages (>40 years i think) to generate log (and anti-log functions). For temp tracking, use a superpair (by National) and use one for reference (emulating log(k) where k is some non-zero constant) and subtract.

, see

nd

vice

.

hat

which

ovides a

no

and

t,

eral

st

han

e

ct,

One project I was involved in used a transistor charging a capacitor to generate a pretty accurate hyperbolic function, though compensating of the internal emitter and base resistances of the transistor was a bit tricky.

In a related circuit I used a thick film platinum resistance sensor to compensate for the change in the therma voltage - kT/h which is proportional to absolute temperature and about 26mV at 300C (room temperature).

-- Bill Sloman, Nijmegen

First Google hit is this PDF, which has all the equations needed.

formatting link

see around page 9 (simplified schematic). Matched transistors are used to compensate for offset change with temperature, and to compensate for gain error with temperature R4 is made to be a temperature dependent resistor. Probably good enough for your application, but not as good as the dedicated chips were.

Unfortunately, the IC dedicated analog blocks they talk of, and even many of the matched transistors, have been becoming more and more availability-challenged. The market has spoken.

That does seem a tad on the warm side, Bill. At 22-23°C+ some folks start to complain, IME.

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

formatting link

Ah, yes, of course -- I searched for "non-linear amplifiers", and got lost in all sorts of interesting but (for my application) useless information. And I still have a few SSM2210's around somewhere, so a matched transistor pair is no problem.

I know, and I guess I'll eventually switch to using controllers for these applications as well -- but somehow, having a digital chip perform complicated calculations feels like making things needlessly difficult, when there are one-step analog processes to do the same. It's like asking someone across the room if they want another cup of coffee by sending then a text message.

Also, I don't have the need for any digital stuff at this point -- I have a simple (digital) voltmeter module which takes analog input, monitoring several different parameters selected by a switch, and some simple analog circuitry surrounding it, all running on a single 12 volt supply.

I'm also pondering the idea of charging a capacitor via a resistor, and have a linear rising voltage (integrator) starting at the same time; when the capacitor voltage has reached the sensor output voltage, a simple sample-and-hold of the linear voltage should provide a relatively accurate value for the flow rate. The only critical component here would be the capacitor, which must have a low temperature drift.

:-)

Anyway, thanks to everyone for their contributions. It's quite interesting to see how ever more electronic design questions are answered by the single adage "use a controller!".

Thanks again, best regards,

Richard Rasker

http://www.linetec.nl

...

...

OK, then instead of using your log approach, one could notice the extreme similarity between your sensor response Vout=c1*(1-e^(-F/c2))+1 and an RC step response Vout=Vo*(1-e^(-t/tau)) which only differs from your sensor response by a 1 constant. You can easily put this to work, without having to bother with the inherent log amp thermal problems, and use feedback to recover the flow value...

R C RC = C2 ___ || -1 >----. C1 >--|___|--+--||---. | | || | .---. | === Vout >--| + |---. .--------+ GND '---' | | | .-----. | \\+ -/ +-|| comparator \\ / ->|| V +-||---. | | | | === | .--o--. GND | GND -|D S Q|-------------' | | Clk >---|> -| ___ | R Q|---|___|--+-----> Flow '--o--' | --- --- | === GND

Note that this will be a sampled system, so you have to adapt the clock frequency to your wanted frequency bandwidth.

Thanks, Fred.

Yes, I just figured out something along the same lines, and I was just about to design a schematic -- but yours is quite a bit simpler and more elegant than what I had in mind :-) And as your schematic bears a great resemblance to the innards of the humble

555, it wouldn't surprise me if I could use that device for this particular purpose.

Thanks for this very neat suggestion!

Richard Rasker

http://www.linetec.nl

Yes, maybe you could use the 555... You have access to the upper divider point to inject your Vout-1, but make sure the comparators have the low rail in their input range, which is not the normal working mode and make sure to use the CMOS version so that you don't have input bias currents and output switch VCEsat problems.

Hmmm, even simpler... You could use the 555 with an external mos switch with it's source shifted, say 1V (guess why) and omit the constant subtraction from your Vout input.

R C RC = C2 ___ || C1 >--|___|--+--||---. | || | | === Vout >----------. .--------+ GND | | | .-----. | \\+ -/ +-|| comparator \\ / ->|| V +-||---. | | | | +1V | .--o--. | GND -|D S Q|-------------' | | Clk >---|> -| ___ | R Q|---|___|--+-----> Flow '--o--' | --- --- | === GND

Thanks, Fred.

Use a cubic spline.

formatting link

Many thanks, Don Lancaster voice phone: (928)428-4073 Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552 rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com Please visit my GURU\'s LAIR web site at http://www.tinaja.com

On a sunny day (Wed, 25 Nov 2009 09:05:55 -0700) it happened Don Lancaster wrote in :

But... you can make a lookup table on the PC, using cubic splines or any other method, then prgram it into a PIC. For a 10 bit ADC, 1024 steps, in a 2 kB FLASH PIC, say 1 kB for code, 1 kB for lookup table in FLASH. No math routines needed in the PIC. Just a few lines asm to read the ADC, look up the vale in ROM, and drive a LCD display.

LUT best implemented with an FPGA ?? ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 |

All the supermatch pairs are going away. 3N3811, LM394, MAT02, MAT04--all gone. MAT01 and MAT03 probably soon to follow. A pity, but what do you expect when they cost $10 apiece?

Nowadays you have to instrument a less-good die, such as an HFA3046 or THAT340, which is quite doable but a much bigger pain, as well as more expensive overall. (You have to tweak out Ree' to do a decent job over wide current ranges anyway. I just did one of these.)

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net

.-----. .-----. .-----. .-----. .-----. | | | OPE | | ABA | | OPE | | | slow problem o---->| ADC |-->| RA |-->| CUS |-->| RA |-->| DAC |-->answer | | | TOR | | | | TOR | | | '-----' '-----' '-----' '-----' '-----'

Thanks, Fred.

Not necessary if there's no other control to be done. As described above all that's needed is a ROM of some description. Of course if the ADC and DAC have some sort of funky interface (I2C and SPI are popular) an FPGA makes the work simpler, though a uC will be cheaper. Cheap FPGAs tend not to have much, if any, memory.

Yes, I was imagining the RC response when I'd earlier responded. And this approach, though not so cleanly.

Jon

If speed isn't important, a micro is cheaper, will use less power, and will be pretty much self-contained (maybe just an external bypass capacitor). ROM in a FPGA uses a lot of internal resources. But if you need the answer FAST it might be the answer.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required