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
--
http://www.linetec.nl
.-----. .----. .-----.
| | | | | |
problem o---->| ADC |----->| uP |----->| DAC |-----> answer
| | | | | |
'-----' '----' '-----'
Or a piece-wise linear circuit using lots of diodes and op-amps -- but a
microprocessor-based solution is smaller and probably more accurate.
I'll second that. Being an analog guy this was hard to write but we've
got to know when to fold'em.
The MSP430F2003 has the ADC part built in. Somehow DVM tells me it's
slow so you could get by with the el-cheapo MSP430F2001 or an even
cheaper PIC. The MSP can work sans crystal. Program it to do dual slope
conversion for the ADC and PWM the output, then RC filter that. The math
goes in between where the code is :-)
Piecewise linear can be ok but with diodes it's temperature-sensitive
and with comparators it's expensive.
--
Regards, Joerg
http://www.analogconsultants.com/
"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
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...
Michael
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
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.
> On Nov 24, 1:19 pm, Richard Rasker <spamt...@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.
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
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.
Sorry, 3rd column should read (f, calc) instead of (v, calc).
M
And way smaller.
You still get the challenge of making the innies and outies good to
whatever your desired precision is -- 3-1/2 digits is about 12 bits,
which is quite doable but still not something that you can just do
without double-checking your work.
It is trivial. But I didn't see you mention it and it's hard to know
what to assume, from my end. I just documented by early thoughts upon
reading.
>> 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.
I'm worried about what appears to be an open-loop approach you are
taking.
>> 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.
Well, I'm not going to argue with you about that. You know your
situation and desires better than I do. However, ... you may find
yourself buffeted by practical forces to head this way, all the same.
Jon
With dual-slope conversion at the input and a PWM at the output that
should be quite easy. The 3-1/2 digite DVM probably doesn't read more
than a few times per second anyhow.
> 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.
Combine this one:
http://www.frank-buss.de/PICPWM/
with some of the C code from this one:
and you're done, in less than an hour :-)
The function is already known, or you can use a simple piecewise linear
approximation with your measured values. Another idea would be to use a
slightly more powerful PIC and a realtime spline interpolation:
http://www.frank-buss.de/spline.html
I guess it would fit in an PIC16F628 and even with small PICs this would be
much faster than you can see the changes on your voltmeter. But I would use
a 7 segment display anyway, driven by the microcontroller, or with a
MAX7221, which is really nice for this, if price doesn't matter.
--
Frank Buss, f...@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
.-----. .-----. .-----.
| | | | | |
problem o---->| ADC |----->| LUT |----->| DAC |-----> answer
| | | | | |
'-----' '-----' '-----'
;-)
Rich
>http://www.frank-buss.de/vco/
Is not a 74HC4046 a much simpler VCO with a lot bigger range?
hehe
That's the solution to life, the universe and everything, if you have
the correct coefficient.
One more advantage to this approach is that one can add an SPI/I2C
output and use lots of stuff other then DVMs downstream.
--
Paul Hovnanian mailto:Pa...@Hovnanian.com
------------------------------------------------------------------
"Grant me the strength to change what I can, the ability to accept
what I can't, and the incapacity to tell the difference."
-- Calvin (of Calvin and Hobbes)
Comedy gold right there!
But the requirements were lower limit and upper limit for the voltage,
which would require more parts.
BTW: The new ATtiny10, mentioned in comp.arch.embedded, is interesting for
such applications, because it has some interesting PWM modes and other
timer goodies, which makes it even more trivial to solve such problems.
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.
.-----. .----. .-----.
>> | | | | | |
>> problem o---->| ADC |----->| uP |----->| DAC |-----> answer
>> | | | | | |
>> '-----' '----' '-----'
>>
>> --
>> www.wescottdesign.com
>
>That's the solution to life, the universe and everything, if you have
>the correct coefficient.
>
>One more advantage to this approach is that one can add an SPI/I2C
>output and use lots of stuff other then DVMs downstream.
An other advantage is that he wants a digital display,
the micro can drive a LCD direcly, no need for a DAC(or PWM).
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 http://focus.ti.com/lit/ds/symlink/pga309.pdf).
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
www.alciom.com
A variant may be more easily adaptable to your application :
http://focus.ti.com/lit/ds/symlink/xtr108.pdf
Robert
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.
http://www.electronics.dit.ie/staff/ypanarin/Lecture%20Notes/DT021-4/6LogAntiLogAmplifiers.pdf
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.
>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).
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"
sp...@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
>>> > 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,
>
> First Google hit is this PDF, which has all the equations needed.
>
http://www.electronics.dit.ie/staff/ypanarin/Lecture%20Notes/DT021-4/6LogAntiLogAmplifiers.pdf
>
> 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.
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.
> 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.
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.
>>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).
>
> That does seem a tad on the warm side, Bill. At 22-23°C+ some folks
> start to complain, IME.
:-)
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,
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.
> Richard Rasker a écrit :
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!
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.
http://www.tinaja.com/cubic01.asp
--
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: d...@tinaja.com
Please visit my GURU's LAIR web site at http://www.tinaja.com
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.
problem o----
.--------------------. .--------------------.
| | | |
| 10 kilomonkeys |--->| 10 kilotypewriters |---> answer
| | | | (eventually)
'--------------------' '--------------------'
Tim
--
Deep Friar: a very philosophical monk.
Website: http://webpages.charter.net/dawill/tmoranwms
>
>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
Very nice, Fred!
These should be very close to practical values:
24K9 10n
___ ||
6.02V >--|___|--+--||---.
| || |
| ===
Vout >---------. .--------+ GND
| | |
.-----. |
\+ -/ +-||
comparator \ / ->||
V +-||---.
| | |
| 1V |
.--o--. |
GND -|D S Q|-------------'
| |
100Hz Clk >---|> -| ___
| R Q|---|___|--+-----> Flow
'--o--' | 200mV full scale
---
---
|
===
GND
Er, KbT/q is volts. And it's 300K. Lead melts at 300C.
Just how long have you been unemployed, Bill? Ordinarily you're just a
sourpuss, but when you start reporting incorrect facts, you're actively
sabotaging things.
26 mV is reporting a voltage in volts. Sorry about the 300C. It was
meant to be 300K - which is 26.85 Celcius, and a bit warmer that
European room temperature - 20C - or US room temperature - 25C - but
the value traditionally associated with declaring kT/h to be 26mV. By
claiming that 300C was room temperature I did provide enough extra
information to avoid confusing all but the terminally stupid
kT/h was given as 30mV in the applications I read when I was young,
but we've got pickier since then.
As for "reporting incorrect facts" you've just told us that 26 mV
isn't a voltage, as if millivolts weren't an an absolutely standard
unit with the dimension "volt".
Sorry to be a sourpuss about this, but your tone hasn't given me much
alternative. Spehro's crack about melting lead was distinctly more
civilised.
--
Bill Sloman, Nijmegen
> 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.
>
A second degree polynomial fit is not too bad either.
V = -7.6087e-05*F^2 + 3.4724e-02 *F + 1.0566
BTW, your c1/c2 didn't work for me; shouldn't it be
128,125 rather than 5,125?
Thanks for calculating the values I was to lazy to compute.
Now I can reveal the whole world the last simplification bit (ahem) :
that is, if you make sure the duty cycle is far enough from 100%, which
sure would be with a 100Hz clock, then you can just delete the 1V
reference and make it a simple resistor (with a small bypass cap) so
that the 6.02V reference with the 24K9/Rsource divider just gives you
the wanted 1V at the capacitor top.
Adjust the source bypass cap to optimize the circuit behavior WRT the
mosfet charges. A value from the low tens of pF to maybe 1nF.
Also, please applause the effort I made in disclosing the resistor's
secret value (just had a cup of coffee :-).
That would be:
24K9 10n
___ ||
6.02V >--|___|--+--||---.
| || |
| ===
Vout >---------. .--------+ GND
| | |
.-----. |
\+ -/ +-||
comparator \ / ->|| optim.
V +-||---. .---||-----.
| | | | ___ |
| '--------+--|___|---+
.--o--. | 4K96 |
GND -|D S Q|-------------' ===
| | GND
100Hz Clk >---|> -| ___
| R Q|---|___|--+-----> Flow
'--o--' | 200mV full scale
---
---
|
===
GND
--
Thanks,
Fred.
> Spehro Pefhany a écrit :
>> On Wed, 25 Nov 2009 16:10:31 +0100, Fred Bartoli <" "> wrote:
>>
>>> Hmmm, even simpler...
[snip great, simple antilog circuit]
Absolutely wonderful, I'm truly amazed how even elegant, simple circuits can
often be optimized and refined even further!
Now talking about optimization: from this design, it would appear that one
could swap the MOSFET and 4K96 resistor -- which would mean that the
internal discharge FET (using an ICM7555) can be used, doing away with an
external MOSFET altogether.
I'll build this beastie tomorrow, and I'm sure to let you know how it turns
out!
Thanks once again, best regards,
I think you made a miscalculation then, or misinterpreted the formula; the
sensor's Vout exhibits an e-power curve which asymptotically approaches
+6 volts, which means that c1 must be 5. An example with F=75ccm:
Vout = 5(1-e^(-75/125))+1 ~= 5(1-0.55)+1 = 5*0.45+1 = 3.25V
Of course you're absolutely right (I guess one cup of coffee wasn't
enough this morning).
Now you've really squizzed the last remaining bit of optimization out of
this.
--
Thanks,
Fred.
Indeed! VERY NICE! I nominate Fred's solution as the "Most Clever
SED Posting of 2009" !!
Rich Grise schrieb:
> .-----. .-----. .-----.
> | | | | | |
> problem o---->| ADC |----->| LUT |----->| DAC |-----> answer
> | | | | | |
> '-----' '-----' '-----'
Hello,
works well for 8 bit ADCs, also for 10 or 12 bits. With large EPROMs
also for 14 or 16 bits.
Bye
These days it works for any A/D or D/A you can find.
>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 use Excel for that purpose. If you choose an X-Y graph you can
choose to show a math approximation.
--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
"If it doesn't fit, use a bigger hammer!"
--------------------------------------------------------------
Matlab etc. (if you have it) or Excel can help with this kind of
design. I took the solution to the diffeq for capacitor charging from
an intial voltage
v(t) = Vf * (1- exp(-(t-a)/tau))
and fit that to the data points to find a, Vf so as to minimize the
sum of errors squared from each data point.
With Excel 2003+ I think solver is not loaded by default, just a less
powerful function that will only change a single variable.
Argh... And also don't forget to shift the 6.02V by one volt too and
make it 7.02V, which makes the resistor's secret value 4K14
--
Thanks,
Fred.
>Fred Bartoli a �crit :
>> Richard Rasker a �crit :
>>> Fred Bartoli <" "> wrote:
>>>
>>>> Spehro Pefhany a �crit :
It might be worth dividing down the input voltage to allow the 6.02V
reference to be the same as the output reference (eg. FF power supply)
which I assumed to be 5.00V). Then a series 5V 0.1% reference like the
ADR395 could be used and a 1% NP0 cap. Stray capacitance would require
a bit of fiddling to compensate for, but it should be pretty darn
stable.
.--------------------.
| |
| Infinet monkey |
| crap |
'--------------------'
^
> .----------!---------. .--------------------.
> | | | |
> | 10 kilomonkeys |--->| 10 kilotypewriters |---> answer
> | | | | (eventually)
> '--------------------' '--------------------'
You left out a factor. :)
--
The movie 'Deliverance' isn't a documentary!
> >>Does anyone know of designs which provide a better fit for this type of
> >>logarithmic function, and preferably a better temperature stability?
> > 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 i
Well, just for YOU, then, how about using a straight two-slope
converter except that the counter value selects a tap on an
analog multiplexer, to a multiplicity of current sources. The
'discharge' part of the converter doesn't operate from a fixed
reference current, but from a MODULATED reference
current, programmed by the converter count value.
Unlike the diode-feedback schemes, this makes a true polygon of the
readout as a function of input. A '4051 analog switch will suffice
for
an octagon.
A PAL does the digital, a '4051 and some op amps does the conversion,
and the readout can be a decimal counter module. Eight or so fixed
resistor values set the curve.
> Fred Bartoli a écrit :
>> Richard Rasker a écrit :
>>> Fred Bartoli <" "> wrote:
>>>
>>>> Spehro Pefhany a écrit :
>>>>> On Wed, 25 Nov 2009 16:10:31 +0100, Fred Bartoli <" "> wrote:
>>>>>
>>>>>> Hmmm, even simpler...
>>>
>>> [snip great, simple antilog circuit]
[snip schematic]
>>> Absolutely wonderful, I'm truly amazed how even elegant, simple
>>> circuits can
>>> often be optimized and refined even further!
>>> Now talking about optimization: from this design, it would appear that
>>> one
>>> could swap the MOSFET and 4K96 resistor -- which would mean that the
>>> internal discharge FET (using an ICM7555) can be used, doing away with
>>> an external MOSFET altogether.
>>>
>>
>> Of course you're absolutely right (I guess one cup of coffee wasn't
>> enough this morning).
>> Now you've really squizzed the last remaining bit of optimization out of
>> this.
>>
>>
>
> Argh... And also don't forget to shift the 6.02V by one volt too and
> make it 7.02V, which makes the resistor's secret value 4K14
OK, I've been doing some experimenting, and the 555 (or ICM7555) isn't
suitable after all. The Vcontrol range doesn't extend down to 1V, and the
flip-flop is set directly, instead of being edge-triggered (which would
require a clock pulse with a shorter duration than the output pulse).
So I'd still have to use a separate D-flip-flop, comparator and clock pulse
generator, requiring at least two separate devices.
But as it turns out, there is a solution with just one comparator or opamp:
o +10.0V
|
| ________
| | flow |
|--| sensor |--.
| |________| |
R1| | | | |10K
| | === | |
| gnd | |\
.-----+-------------(---|-\ ___
| | | | | >--|___|-----> Vout
R3| | R2| | ---C |--|+/ 100K |
| | | | --- | |/ ---1uF
| | | | ---
| === === | |
||--' gnd gnd ||--' ===
||<-. ||<-. gnd
.--||--|Q1 .--||--|Q2
| | | |
| === | ===
| gnd | gnd
>-----------------------'
clock
__ __
_| |__| |__
This works fine; the only requirement here is that the clock signal has a
longer duty cycle than the maximum output pulse width.
The clock signal itself can be RC-generated, using a second comparator/opamp
and an identical capacitor to C, which may further diminish any temperature
drift.