From: Jon Kirwan on
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.
>
>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?

You were looking for an inverse function of something with an offset
built into it. Sometimes, it helps to first subtract the offset (the
1V) before feeding it to an inverse function to linearize. That was
my first thought. Second, was to wonder if you might instead focus on
a function block that replicates the exponential behavior of the
sensor but is _driven_ by a linear parameter (such as time or
frequency, for example) and then arrange things to adjust the linear
control so that the two outputs match and then read off the control
parameter value, instead. Third was to consider recommending a micro,
which is a rather common approach to conditioning sensors these days.

Jon
From: Richard Rasker on
Michael wrote:

> On Nov 24, 1:19 pm, Richard Rasker <spamt...(a)linetec.nl> wrote:
>> Hi all,
>>
>> I'm currently working with a mass air flow sensor (a Honeywell AWM3100V,
>> seehttp://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

[snip]

> A few side questions: how do those voltages look when performed at
> different ambient temperatures, and at different elevations (air
> pressures)? You might have a few more equations to play with in those
> cases...

Good questions. I varied the temperature of the air input to the sensor
between 15 and 60 degrees Celsius, and found no significant differences.
I didn't vary the air pressure, but the setup is intended for use in normal
atmospheric pressure at sea level, so this latter parameter is not
important.
Also, the gas measured is air with only very low traces (< 100ppm) of
contaminants, so I don't have to take differences in gas parameters into
account.

Richard Rasker
--
http://www.linetec.nl
From: Richard Rasker on
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.
>>
>>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?
>
> You were looking for an inverse function of something with an offset
> built into it. Sometimes, it helps to first subtract the offset (the
> 1V) before feeding it to an inverse function to linearize.

I assumed that this step could be considered trivial -- in my measuring
setup, I have a +1.00V reference voltage for this exact purpose.

> That was my first thought. Second, was to wonder if you might instead
> focus on a function block that replicates the exponential behavior of the
> sensor but is _driven_ by a linear parameter (such as time or
> frequency, for example) and then arrange things to adjust the linear
> control so that the two outputs match and then read off the control
> parameter value, instead.

Well, of course that would provide a limited (in time and range) solution,
but I'm rather more interested in a direct transfer function without
translating the nonlinearity into another domain first.

> 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.

Richard Rasker
--
http://www.linetec.nl
From: Michael on
On Nov 24, 1:19 pm, Richard Rasker <spamt...(a)linetec.nl> wrote:
> Hi all,
>
> I'm currently working with a mass air flow sensor (a Honeywell AWM3100V, seehttp://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
> --http://www.linetec.nl


It's been awhile since I've done this, but why not simply graph
flowrate vs. voltage using Excel and take a 4th-order polynomial best-
fit curve?

y = 0.6869x^4 - 6.0407x^3 + 23.423x^2 - 10.814x - 7.138
R^2 = 0.9998

where y=flowrate (in cc/min?) and x=voltage

Are these deviations from v acceptable?

v f v, calc
1 0 0.1
1.9 25 24.4
2.67 50 50.9
3.27 75 75.3
3.75 100 99.0
4.17 125 124.7
4.5 150 149.7
4.8 175 177.2
5 200 198.6


Regards,

Michael
From: Spehro Pefhany on
On Tue, 24 Nov 2009 22:19:26 +0100, Richard Rasker
<spamtrap(a)linetec.nl> 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

Definitely use a micro-- you can implement your equation (in a very
straightforward manner if you use C) and/or do a polynomial fit to
squeeze out the last bit of error.

For example:

Flow (ccm) = 0.6629*v^5 - 9.5389*v^4 + 53.6729*v^3 - 139.4424*v^2 +
192.9420 *v -98.3132

.... which can be evaluated with only five multiplies and no
transcendental operations.

You *could* go looking up how to design analog log/antilog amplifiers
with matched transistors and thermistors for temperature compensation,
but AFICR this is not 1980 and a suitable micro is going to be
cheaper, simpler and much more stable.