Tracy + Math =Guido
Guido
Posts: 195
Tracy,
I am still working on this Weather project. I am taking another step and a few months ago I asked if anyone had a good Pressure Sensor to use. I was told that the Motorla MPX4115 Pressure Sensor would work.....The only problem I have tried Google and Search but the only reference to a Barometric Pressure is on Shawn Wilsons Site.
http://geocities.com/SiliconValley/Orchard/6633/altimeter.html
I am fine with what he is doing except that I need to convert his equation from the ADC in from KPA to Inches of Mercury. Shawns example for His project is····· ·P(KPA) = (ADCin*/1991/10+7744)+ 2220, where 2220 is an offset number for my area. Ok, so I can just convert it to Inches of Mercury using this
kilopascals x 0.2953 = inches of mercury
I have tried the following: P = (ADCin*/1991/10+7744)+ 2220*492/6. It does not like it, not even close....The reading really seems to jump around alot and the KPA seems basically steady
Thanks
Guido
I am still working on this Weather project. I am taking another step and a few months ago I asked if anyone had a good Pressure Sensor to use. I was told that the Motorla MPX4115 Pressure Sensor would work.....The only problem I have tried Google and Search but the only reference to a Barometric Pressure is on Shawn Wilsons Site.
http://geocities.com/SiliconValley/Orchard/6633/altimeter.html
I am fine with what he is doing except that I need to convert his equation from the ADC in from KPA to Inches of Mercury. Shawns example for His project is····· ·P(KPA) = (ADCin*/1991/10+7744)+ 2220, where 2220 is an offset number for my area. Ok, so I can just convert it to Inches of Mercury using this
kilopascals x 0.2953 = inches of mercury
I have tried the following: P = (ADCin*/1991/10+7744)+ 2220*492/6. It does not like it, not even close....The reading really seems to jump around alot and the KPA seems basically steady
Thanks
Guido
Comments
The "problem is very simple.
In equation P =P (ADCin*/1991/10+7744)+2220*492/6 the part 2220*492/6 is 2220*492=1092240. 1092240 is
to much for the basicstamp.
Basicstamp has only room for 16 bits valueu's (word) meaning only valueu's up to 65536 can be used.
1092240 needs at least 21 bits (20 bits = 1048576) so the answer of 2220*492 is not ok and the aswer of P also.
I'm not sure where you came up with *492/6, but Ross is correct, that will cause overflow and give very strange results. To multiply times 0.296 in Stampese without overflow, use the ** operator.
P = ((ADCin*/1991/10+7744)+ 2220) ** 19399
The factor 19399 comes from 0.296 * 65536. The parentheses are for clarity.
I have not checked Shawn's formula, but I'm sure he was careful with that. And it of course depends on following his circuit to go with the MPX4115 and the calibration of it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Take a look at aplication note #7, using a thermister of the attached parallax/pdf document. There are some neet tricks to keep your numbers/math less then 16 bits.
http://www.parallax.com/Portals/0/Downloads/appnt/stamps/bs1Appnotes.pdf
Have fun.
SJW
You probably already know this, but barometric pressure is relative to your location (elevation). All sensors, to read accurately, must be routinely calibrated to a known source. Differences between you and this known source must also be taken into account.
When I was working in research labs, we had a special, large, wall-mounted, mercury manometer which we used as our reference. We calibrated this reference to the local airports values routinely, compensating for elevation difference between us and the airport, and temperature. We then calibrated our electronic sensors against this manometer.
There is an ASTM test method covering this topic, but I forget its name or number.
FYI