From: Michael on 24 Nov 2009 17:37 On Nov 24, 2:33 pm, Michael <mrdarr...(a)gmail.com> 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 > > > 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 Sorry, 3rd column should read (f, calc) instead of (v, calc). M
From: Tim Wescott on 24 Nov 2009 17:47 On Tue, 24 Nov 2009 17:41:06 -0500, Spehro Pefhany wrote: > 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. 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. -- www.wescottdesign.com
From: Jon Kirwan on 24 Nov 2009 17:49 On Tue, 24 Nov 2009 23:20:01 +0100, Richard Rasker <spamtrap(a)linetec.nl> wrote: >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. 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
From: Joerg on 24 Nov 2009 17:49 Tim Wescott wrote: > On Tue, 24 Nov 2009 17:41:06 -0500, Spehro Pefhany wrote: > >> 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. > > 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. > 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. -- Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.
From: Frank Buss on 24 Nov 2009 18:06
Richard Rasker wrote: > 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: http://www.frank-buss.de/vco/ 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, fb(a)frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de |