From: Phil Hobbs on
Robert Baer wrote:
> Richard Rasker wrote:
>> Hi all,
>>
>> I'm currently working with a mass air flow sensor (a Honeywell
>> AWM3100V, see
>> http://datasheet.octopart.com/AWM3100V-Honeywell-datasheet-57019.pdf),
>> and
>> I would like to convert the rather non-linear response curve of this
>> device
>> into a voltage which bears a linear relationship to the actual air flow.
>> Ideally, I would like to see the air flow converted in millivolts, so
>> that
>> it can be fed into a 3.5 digit voltmeter directly.
>>
>> These are the values (F=flow):
>> F (ccm) Vout (V)
>> 0 1.00
>> 25 1.90
>> 50 2.67
>> 75 3.27
>> 100 3.75
>> 125 4.17
>> 150 4.50
>> 175 4.80
>> 200 5.00
>>
>> The first problem was simple: finding a suitable mathematical function
>> which
>> fits the curve; I looked at something along the lines of
>> Vout=c1*(1-e^(-F/c2))+1, and it turns out that c1=5 and c2=125 provides a
>> near-perfect fit. The second problem was to find an inverse function
>> -- no
>> problem there either: F=-c2*ln(1-(Vout-1)/c1) -- leading to the third and
>> rather trickier problem, which of course is to implement that inverse
>> function in an actual circuit.
>> I've been doing some trial-and-error experimenting with a simple circuit,
>> based on a simple Si-diode with some bypass and series resistors in
>> several
>> configurations, but that doesn't produce satisfactory results -- the best
>> curve I get is easily 10% off at the extremes, and that's even without
>> temperature instability. All this is of course no surprise, as the
>> exponential function of a forward-biased diode is something different
>> than
>> a logarithmic function, and a simple PN junction has a temperature
>> coefficient of approximately 2 mV per degree Celsius.
>>
>> Does anyone know of designs which provide a better fit for this type of
>> logarithmic function, and preferably a better temperature stability?
>>
>> Thanks in advance, best regards,
>>
>> Richard Rasker
> 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.

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
From: Fred Bartoli on
Rich Grise a �crit :
> On Tue, 24 Nov 2009 15:30:47 -0600, Tim Wescott wrote:
>> On Tue, 24 Nov 2009 22:19:26 +0100, Richard Rasker wrote:
>>> These are the values (F=flow):
>>> F (ccm) Vout (V)
>>> 0 1.00
>>> 25 1.90
>>> 50 2.67
>>> 75 3.27
>>> 100 3.75
>>> 125 4.17
>>> 150 4.50
>>> 175 4.80
>>> 200 5.00
>>>
> ...
>>> Does anyone know of designs which provide a better fit for this type of
>>> logarithmic function, and preferably a better temperature stability?
>> .-----. .----. .-----.
>> | | | | | |
>> problem o---->| ADC |----->| uP |----->| DAC |-----> answer
>> | | | | | |
>> '-----' '----' '-----'
>
> .-----. .-----. .-----.
> | | | | | |
> problem o---->| ADC |----->| LUT |----->| DAC |-----> answer
> | | | | | |
> '-----' '-----' '-----'
>

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


--
Thanks,
Fred.
From: krw on
On Wed, 25 Nov 2009 10:30:08 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon(a)My-Web-Site.com> wrote:

>On Wed, 25 Nov 2009 11:20:41 -0600, John Fields
><jfields(a)austininstruments.com> wrote:
>
>>On Tue, 24 Nov 2009 15:23:24 -0800, Rich Grise <richgrise(a)example.net>
>>wrote:
>>
>>>On Tue, 24 Nov 2009 15:30:47 -0600, Tim Wescott wrote:
>>>> On Tue, 24 Nov 2009 22:19:26 +0100, Richard Rasker wrote:
>>>>>
>>>>> These are the values (F=flow):
>>>>> F (ccm) Vout (V)
>>>>> 0 1.00
>>>>> 25 1.90
>>>>> 50 2.67
>>>>> 75 3.27
>>>>> 100 3.75
>>>>> 125 4.17
>>>>> 150 4.50
>>>>> 175 4.80
>>>>> 200 5.00
>>>>>
>>>...
>>>>>
>>>>> Does anyone know of designs which provide a better fit for this type of
>>>>> logarithmic function, and preferably a better temperature stability?
>>>>
>>>> .-----. .----. .-----.
>>>> | | | | | |
>>>> problem o---->| ADC |----->| uP |----->| DAC |-----> answer
>>>> | | | | | |
>>>> '-----' '----' '-----'
>>>
>>> .-----. .-----. .-----.
>>> | | | | | |
>>> problem o---->| ADC |----->| LUT |----->| DAC |-----> answer
>>> | | | | | |
>>> '-----' '-----' '-----'
>>>
>>
>>Bingo!
>>
>>JF
>
>LUT best implemented with an FPGA ??

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.
From: Jon Kirwan on
On Wed, 25 Nov 2009 15:16:41 +0100, Fred Bartoli <" "> wrote:

>Richard Rasker a �crit :
>> Jon Kirwan wrote:
>>
>>> On Tue, 24 Nov 2009 22:19:26 +0100, Richard Rasker wrote:
>>>
>>>> I'm currently working with a mass air flow sensor (a Honeywell AWM3100V,
>>>> see http://datasheet.octopart.com/AWM3100V-Honeywell-datasheet-57019.pdf),
>>>> and I would like to convert the rather non-linear response curve of this
>>>> device into a voltage which bears a linear relationship to the actual air
>>>> flow. Ideally, I would like to see the air flow converted in millivolts,
>>>> so that it can be fed into a 3.5 digit voltmeter directly.
>>>>
>>>> These are the values (F=flow):
>>>> F (ccm) Vout (V)
>>>> 0 1.00
>>>> 25 1.90
>>>> 50 2.67
>>>> 75 3.27
>>>> 100 3.75
>>>> 125 4.17
>>>> 150 4.50
>>>> 175 4.80
>>>> 200 5.00
>>>>
>>>> The first problem was simple: finding a suitable mathematical function
>>>> which fits the curve; I looked at something along the lines of
>>>> Vout=c1*(1-e^(-F/c2))+1, and it turns out that c1=5 and c2=125 provides a
>>>> near-perfect fit. The second problem was to find an inverse function -- no
>>>> problem there either: F=-c2*ln(1-(Vout-1)/c1) -- leading to the third and
>>>> rather trickier problem, which of course is to implement that inverse
>>>> function in an actual circuit.
>>>>
>...
><snip>
>...
>>
>>> Third was to consider recommending a micro, which is a rather common
>>> approach to conditioning sensors these days.
>>
>> I know. But I'm one of those old school die-hards who prefers hooking up a
>> dozen or so components to a meter in an hour or so instead of spending a
>> multiple of that time programming a controller to do the same.
>>
>
>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.

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

Jon
From: Spehro Pefhany on
On Wed, 25 Nov 2009 10:30:08 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon(a)My-Web-Site.com> wrote:

>On Wed, 25 Nov 2009 11:20:41 -0600, John Fields
><jfields(a)austininstruments.com> wrote:
>
>>On Tue, 24 Nov 2009 15:23:24 -0800, Rich Grise <richgrise(a)example.net>
>>wrote:
>>
>>>On Tue, 24 Nov 2009 15:30:47 -0600, Tim Wescott wrote:
>>>> On Tue, 24 Nov 2009 22:19:26 +0100, Richard Rasker wrote:
>>>>>
>>>>> These are the values (F=flow):
>>>>> F (ccm) Vout (V)
>>>>> 0 1.00
>>>>> 25 1.90
>>>>> 50 2.67
>>>>> 75 3.27
>>>>> 100 3.75
>>>>> 125 4.17
>>>>> 150 4.50
>>>>> 175 4.80
>>>>> 200 5.00
>>>>>
>>>...
>>>>>
>>>>> Does anyone know of designs which provide a better fit for this type of
>>>>> logarithmic function, and preferably a better temperature stability?
>>>>
>>>> .-----. .----. .-----.
>>>> | | | | | |
>>>> problem o---->| ADC |----->| uP |----->| DAC |-----> answer
>>>> | | | | | |
>>>> '-----' '----' '-----'
>>>
>>> .-----. .-----. .-----.
>>> | | | | | |
>>> problem o---->| ADC |----->| LUT |----->| DAC |-----> answer
>>> | | | | | |
>>> '-----' '-----' '-----'
>>>
>>
>>Bingo!
>>
>>JF
>
>LUT best implemented with an FPGA ??
>
> ...Jim Thompson

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.