Reply by kg4pid December 1, 20042004-12-01

I hope to start a project using the same MPX4115A sensor, would you
care to share your working code ? I don't want to reinvent the wheel.
Max

--- In , "Scott Lee" <midl_man@y...> wrote:
>
> I used the following equations (which coded in asm) with a MPX4115A
> (in a 867 case) with great success. These are based on the equation
> given in the Motorola datasheet. Note that I scaled everything so
> that the division would be easy (trivial in fact!) in asm *and*
> integer math will provide a result that is scaled up by 100 so it
> contains two decimal places. I'm using the 10 bit AD value in the
> calculation and if you convert the 32 bit binary result to BCD the
> lowest byte (two BCD digits) will be the decimal portion.
>
> millibar = (AD * 1111 + 10809) / 1024
> inHg = (AD * 3281 + 319186) / 1024
>
> These are from the comments in my code. I actually used the "inHg"
> equation and it provides values as accurate as the device is (which
> really isn't *that* great -- +/-1.5kPa). I beleive the millibar
> equation is correct but it is untested.
>
> As for the circuit, I simply used a bypass caps like shown in the
> Motorolla datasheet. That is, I put a 1.0uF and .01uF cap on the
> supply pin, with the supply being the same regulated 5V supply rail
> the PIC uses, and a 470pF cap on the output pin. Measurements are
stable.
>
> Let me know if how this works.
>
> --Scott >
> --- In , "bergweed" <mikeberg@r...> wrote:
> >
> > Thanks to the group for the help.
> > Once the turkey wears off, you folks really get sharp <grin>.
> > Some interesting suggestions how to tackle this problem.
> >
> > To summarize, we can either get it done with more complex
software or
> > by adding hardware - in this case an adjustable voltage regulator
and
> > tweaking the sensor supply.
> > Cool.
> >
> > 73 Mike



Reply by Scott Lee December 1, 20042004-12-01

I used the following equations (which coded in asm) with a MPX4115A
(in a 867 case) with great success. These are based on the equation
given in the Motorola datasheet. Note that I scaled everything so
that the division would be easy (trivial in fact!) in asm *and*
integer math will provide a result that is scaled up by 100 so it
contains two decimal places. I'm using the 10 bit AD value in the
calculation and if you convert the 32 bit binary result to BCD the
lowest byte (two BCD digits) will be the decimal portion.

millibar = (AD * 1111 + 10809) / 1024
inHg = (AD * 3281 + 319186) / 1024

These are from the comments in my code. I actually used the "inHg"
equation and it provides values as accurate as the device is (which
really isn't *that* great -- +/-1.5kPa). I beleive the millibar
equation is correct but it is untested.

As for the circuit, I simply used a bypass caps like shown in the
Motorolla datasheet. That is, I put a 1.0uF and .01uF cap on the
supply pin, with the supply being the same regulated 5V supply rail
the PIC uses, and a 470pF cap on the output pin. Measurements are stable.

Let me know if how this works.

--Scott
--- In , "bergweed" <mikeberg@r...> wrote:
>
> Thanks to the group for the help.
> Once the turkey wears off, you folks really get sharp <grin>.
> Some interesting suggestions how to tackle this problem.
>
> To summarize, we can either get it done with more complex software or
> by adding hardware - in this case an adjustable voltage regulator and
> tweaking the sensor supply.
> Cool.
>
> 73 Mike




Reply by Lance November 29, 20042004-11-29

Hi Guys

I use voltage references extensivly throughout our precision
industrial instrumentation range.
TL431/LM431 etc will work on 1mA and temperature drift is in the
order of 10's of parts per million per degC. They are very cost
effective too.
They are rock stable for most applications.
What you MUST be careful of is the capacitance across it must NOT be
in the range 10nF<>10uF (it must be equal to or greater than 10uF or
less than 10nF)or it will likly become unstable .. even oscillate.
This may at first appear to be a wavering voltage level.

Lance
ICM

--- In , "Phil" <phil1960us@y...> wrote:
>
> --- In , "sirtiffguy" <sirtiff@h...> wrote:
> >
> > I'm using the TL431 at work right now, and I'd suggest rather
than
> > using precision resistors, just add in a variable resistor
instead.
> > Using 25K per side (see the suggested circuit for making
variable
> > zener), and a 2K 25turn resistor, I could get accuracy to 0.001
Volt
> > (more, but the voltmeter wasnt that accurate). Im not sure how
> > temperature sensitive it would be, but man do thoes ever work
slick
> > for only using up around 5mA of current.
> >
>
> I've used similar for Vref. Horrible temperature stability but
they
> sure are easy to use. I've seen tricks where one puts a low
value,
> high wattage resistor next to the pot to act as a heater to keep a
> reasonable stable temperature. You have to calibrate after 15
mins of
> operation or so. Doesn't work well for battery equipment,
though.
>
> Using a decent trimmable Vref chip isn't that much more effort or
cost.



Reply by Phil November 27, 20042004-11-27

--- In , "sirtiffguy" <sirtiff@h...> wrote:
>
> I'm using the TL431 at work right now, and I'd suggest rather than
> using precision resistors, just add in a variable resistor instead.
> Using 25K per side (see the suggested circuit for making variable
> zener), and a 2K 25turn resistor, I could get accuracy to 0.001 Volt
> (more, but the voltmeter wasnt that accurate). Im not sure how
> temperature sensitive it would be, but man do thoes ever work slick
> for only using up around 5mA of current.
>

I've used similar for Vref. Horrible temperature stability but they
sure are easy to use. I've seen tricks where one puts a low value,
high wattage resistor next to the pot to act as a heater to keep a
reasonable stable temperature. You have to calibrate after 15 mins of
operation or so. Doesn't work well for battery equipment, though.

Using a decent trimmable Vref chip isn't that much more effort or cost.




Reply by sirtiffguy November 27, 20042004-11-27

I'm using the TL431 at work right now, and I'd suggest rather than
using precision resistors, just add in a variable resistor instead.
Using 25K per side (see the suggested circuit for making variable
zener), and a 2K 25turn resistor, I could get accuracy to 0.001 Volt
(more, but the voltmeter wasnt that accurate). Im not sure how
temperature sensitive it would be, but man do thoes ever work slick
for only using up around 5mA of current. --- In , "Phil" <phil1960us@y...> wrote:
>
> --- In , "bergweed" <mikeberg@r...> wrote:
> >
> > Thanks to the group for the help.
> > Once the turkey wears off, you folks really get sharp <grin>.
> > Some interesting suggestions how to tackle this problem.
> >
> > To summarize, we can either get it done with more complex
software or
> > by adding hardware - in this case an adjustable voltage
regulator and
> > tweaking the sensor supply.
> > Cool.
> >
> > 73 Mike
>
> reasonable summary. I would not use a regulator but rather a
voltage
> ref and a couple of precision resistors. Usually better temp
> stability. Zetex and ST make some decent ones that are very cheap
> ($.30 for the ST TL431 for example). If you dont care that much
about
> accuracy, you could just use a simple multiturn trimpot as a
divider
> to get your reference.
>
> Note also that your accuracy will also be dependent on your voltage
> supply which unless you take a lot of care can be off as much as
+/- 10%.
>
> Finally, ADC requires a lot of care with the analog section. Its
easy
> to get a situation where you see error/fluctuations of +/- 3 LSBs
or
> more. Kind of ruins your accuracy.
>
> Phil




Reply by Phil November 26, 20042004-11-26

--- In , "bergweed" <mikeberg@r...> wrote:
>
> Thanks to the group for the help.
> Once the turkey wears off, you folks really get sharp <grin>.
> Some interesting suggestions how to tackle this problem.
>
> To summarize, we can either get it done with more complex software or
> by adding hardware - in this case an adjustable voltage regulator and
> tweaking the sensor supply.
> Cool.
>
> 73 Mike

reasonable summary. I would not use a regulator but rather a voltage
ref and a couple of precision resistors. Usually better temp
stability. Zetex and ST make some decent ones that are very cheap
($.30 for the ST TL431 for example). If you dont care that much about
accuracy, you could just use a simple multiturn trimpot as a divider
to get your reference.

Note also that your accuracy will also be dependent on your voltage
supply which unless you take a lot of care can be off as much as +/- 10%.

Finally, ADC requires a lot of care with the analog section. Its easy
to get a situation where you see error/fluctuations of +/- 3 LSBs or
more. Kind of ruins your accuracy.

Phil




Reply by bergweed November 26, 20042004-11-26

Thanks to the group for the help.
Once the turkey wears off, you folks really get sharp <grin>.
Some interesting suggestions how to tackle this problem.

To summarize, we can either get it done with more complex software or
by adding hardware - in this case an adjustable voltage regulator and
tweaking the sensor supply.
Cool.

73 Mike




Reply by Phil November 26, 20042004-11-26

--- In , "Phil" <phil1960us@y...> wrote:
...
> Note the spec for sensitivity. that gives you 45.9 mV/kPa. so,
> picking 4.7V (45.9*1023 = 4.696) as your Vref for a 10 bit ADC will

dang, that should read:
picking 4.7V (45.9*1023/10 = 4.696) as your Vref for a 10 bit ADC will




Reply by Phil November 26, 20042004-11-26

OK, I got curious about this sensor and looked it up on MOTOROLA's
(please note spelling) site. Turns out it is Freescale semi but no
matter. Maybe adding a link to the datasheet in your post would be a
good idea next time...

Note the spec for sensitivity. that gives you 45.9 mV/kPa. so,
picking 4.7V (45.9*1023 = 4.696) as your Vref for a 10 bit ADC will
yield your answer (almost) directly in kPa*10. Its "almost" because
you have to factor in Voffset (204 mV at 15 kPa) by adding 106. This
is 10.55*10 rounded up (10.55 is 10 5/9 - does that look familiar?) to
get the correct answer in kPa*10. You'll need to tweak the vref
slightly if you are using 5V instead of the 5.1 from the datasheet.

There's usually a way to avoid floating point if you think about it...

Phil




Reply by Phil November 26, 20042004-11-26

--- In , "bergweed" <mikeberg@r...> wrote:
...
> Maybe I should restate my question to
> How do I rearrange the transfer formula to solve for P?
> the original transfer formula is:
> Vout = Vs (.009 * P - .095)
> Vs = 5.1 (in my case it's 5.0)
>
> So, what I need is a formula the reads like:
> P= blah blah blah

ok, divide both sides by Vs. Vout/Vs = 0.009*P-0.095
add 0.095 to both sides Vout/Vs + 0.095 = 0.009*P
divide both sides by 0.009 (Vout/Vs + 0.095)/0.009 = P

You haven't said what the application is but I think you are going
about it the hard way. The equation is linear. You should be able to
find a value of your ADC reference (and maybe Vs) that gives a simple
relationship between P and your ADC reading.

An example to illustrate my point. For measuring temperature, I have a
sensor that gives 10 mV per degree of temp F. Setting the reference
to 2.55V gives me 10 mV per unit of an 8 bit ADC value. Thus 700 mV
reads as 70 from my ADC and is, gasp, 70 degrees. no conversions
needed. If I had used a Vref of 5, I would have had to scale by .512
It is true that it can't read negative temps or over 255 degrees but
my app doesn't care.

>
> I really should have stayed awake in algebra :)

I couldn't agree more.

Phil