From: Fred Bartoli on 25 Nov 2009 10:10 Richard Rasker a écrit : > 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 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.
From: Don Lancaster on 25 Nov 2009 11:05 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. 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: don(a)tinaja.com Please visit my GURU's LAIR web site at http://www.tinaja.com
From: Jan Panteltje on 25 Nov 2009 11:17 On a sunny day (Wed, 25 Nov 2009 09:05:55 -0700) it happened Don Lancaster <don(a)tinaja.com> wrote in <7n52uqF3kcuc0U2(a)mid.individual.net>: >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. > > >Use a cubic spline. > >http://www.tinaja.com/cubic01.asp 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.
From: John Fields on 25 Nov 2009 12:20 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
From: Jim Thompson on 25 Nov 2009 12:30
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 -- | 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 | |