Author Topic: BMP085 Readings off using Digix by Digistump  (Read 9045 times)

Techno

  • Newbie
  • *
  • Posts: 26
BMP085 Readings off using Digix by Digistump
« on: February 12, 2014, 05:54:10 pm »
National Weather Service Barometric Pressure readings differ from BMP085 sensor connected to Digix by .94.  This difference is on going; this is ~ 1 inch difference.
Is this due to library incompatibility?  I have seen this difference on two BMP085 sensors.  Another oddity is I have not seen High Pressure reach 30 inches on days of reported High Pressure locally.  I have checked WeatherUnderground stations close to my location; with similar results when compared to the BMP085 sensor.

I tried the library recommended on the forum here, that is from Adafruit --Library has been claimed to be working with the Digix.  I have doubled and triple checked the math; results are still not seeing the closeness (within a few hundredths of an inch,) I have seen using the Arduino Mega 2560 with the same BMP085 sensors.

These are my observations of the recommended BMP085 library.  http://digistump.com/board/index.php/topic,1237.0.html

I question the accuracy of the "readings..."

William
« Last Edit: February 12, 2014, 06:02:15 pm by Techno »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: BMP085 Readings off using Digix by Digistump
« Reply #1 on: February 12, 2014, 11:20:21 pm »
Well I don't know that sensor or have it to test but taking a quick look:

It is a digital sensor - so no voltage/ADC/etc issues - it is not hardware related.
It seems to be I2C so probably not a timing issue - or it would more likely just not work.

That makes me think it is either:
An issue with Arduino 1.5x vs 1.0x
or more likely an issue with the way the Due Core (which DigiX is based on) does math vs the Mega core - specifically something to do with 8-bit vs 32-bit and variable types or casting/types used in the maths.

I realize that isn't much of an answer but hopefully it will point toward the right direction... or at least rule out some things.

cpldcpu

  • Newbie
  • *
  • Posts: 30
Re: BMP085 Readings off using Digix by Digistump
« Reply #2 on: February 16, 2014, 05:43:07 am »
This is probably rather a misunderstanding. The pressure sensor measures the actual pressure at your level of elevation above the sea level. The values from the weather report are normalized to sea level. If you live above sea level (which most people do), the pressure sensure displays a lower value than the weather report one.
« Last Edit: February 16, 2014, 08:45:51 am by cpldcpu »

dbell

  • Newbie
  • *
  • Posts: 44
Re: BMP085 Readings off using Digix by Digistump
« Reply #3 on: February 16, 2014, 10:15:02 am »
Not unreasonable cpldcpu - 0.94" difference works out to ~265 meters altitude (861 feet)...

Dave

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: BMP085 Readings off using Digix by Digistump
« Reply #4 on: February 16, 2014, 11:42:13 pm »
Quote
The values from the weather report are normalized to sea level.

Which is easy to understand, if you think about the weather-maps with the isobars.  If you would measure the local pressure on ground, the weather-map would show much more the topographic situation with isoheights, instead the weather-condition with isobars. As far, as I know, there are two ways for normalization: One which uses the current temperature and humidity, another which uses just a standard atmosphere.
Wikipedia is your friend: http://en.wikipedia.org/wiki/QNH, http://en.wikipedia.org/wiki/QFF, ...

Looks like, that a good weather application should cover this.


Techno

  • Newbie
  • *
  • Posts: 26
Re: BMP085 Readings off using Digix by Digistump
« Reply #5 on: February 17, 2014, 08:06:04 am »
I understand  sea level elevation, temperature and humidity effect Barometric pressure.  My point is that based on NWS observations in local area, the Arduino Mega 2560 was much closer to those reported by NWS than the Digistump Digix.  Both developement boards were at the same elevation and same location.  Readings were taken withing minutes of each other, then compared to NWS.

I am not interested in exactly what the Barometric pressure is at a given time; rather, difference in Barometric pressure in a given time interval;however, that is beside the point.   

I was surprised to find that "huge" difference in the devices!  I do not believe it is a misunderstanding at this time.

William

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: BMP085 Readings off using Digix by Digistump
« Reply #6 on: February 17, 2014, 08:46:32 am »
The point is, that if you are not on sea level, you can't compare the measured values with reported NWS values!  To figure out, which of your combinations (DigiX or Mega2560) is reporting wrong values, you need to take your elevation into account. If you are located on sea level, it might be the mega, otherwise it might be the DigiX.
Even if the Mega shows values, which are more close to the reported ones, those can be wrong! Read: http://en.wikipedia.org/wiki/Barometric_formula

To assist you further, you should report your elevation and measured values as well as code samples.

As the BMP085 is part of many 10DOF sensors, some readers of this thread may own one, and can report back their experience, if you are posting code examples. 

dougal

  • Sr. Member
  • ****
  • Posts: 289
Re: BMP085 Readings off using Digix by Digistump
« Reply #7 on: February 17, 2014, 11:14:03 pm »
Have you tried the altimeter function of the sensor? As I recall, you give it the currently known sea-level adjusted pressure, and it compares that to its current local reading to determine your elevation.

If you plug in your weather service pressure value, and it gives you the correct elevation for your location, that would be a good indication that it's giving correct data back.

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: BMP085 Readings off using Digix by Digistump
« Reply #8 on: February 18, 2014, 01:03:29 am »
Quote
Have you tried the altimeter function of the sensor? As I recall, you give it the currently known sea-level adjusted pressure, and it compares that to its current local reading to determine your elevation.

If you plug in your weather service pressure value, and it gives you the correct elevation for your location, that would be a good indication that it's giving correct data back.

The sensor has no function like that. However the above referenced library provides one:

When called with the most current pressure reported for closest weather-channel as sealevel and atmospheric as well as temp with the last measured values you need to get your current elevation.

Code: [Select]
snippet from the library:
float Adafruit_BMP085_Unified::pressureToAltitude(float seaLevel, float atmospheric, float temp)
{
  /* Hyposometric formula:                      */
  /*                                            */
  /*     ((P0/P)^(1/5.257) - 1) * (T + 273.15)  */
  /* h = -------------------------------------  */
  /*                   0.0065                   */
  /*                                            */
  /* where: h   = height (in meters)            */
  /*        P0  = sea-level pressure (in hPa)   */
  /*        P   = atmospheric pressure (in hPa) */
  /*        T   = temperature (in °C)           */

  return (((float)pow((seaLevel/atmospheric), 0.190223F) - 1.0F)
         * (temp + 273.15F)) / 0.0065F;
}

As the sensor and the library is using metric units, I would recommend, that you first try to print and compare those on both platforms, before converting them into Imperial units.

I am waiting since some weeks on a 10DOF sensor from China, which includes an BMP085.  Hopefully its arriving soon!



cpldcpu

  • Newbie
  • *
  • Posts: 30
Re: BMP085 Readings off using Digix by Digistump
« Reply #9 on: February 18, 2014, 06:11:56 am »
I understand  sea level elevation, temperature and humidity effect Barometric pressure.  My point is that based on NWS observations in local area, the Arduino Mega 2560 was much closer to those reported by NWS than the Digistump Digix.  Both developement boards were at the same elevation and same location.  Readings were taken withing minutes of each other, then compared to NWS.

I am not interested in exactly what the Barometric pressure is at a given time; rather, difference in Barometric pressure in a given time interval;however, that is beside the point.   

Well, but your methodology does not reveal which reading is off. It could be either of them.

These sensors require some relatively complex calculations to correct the calibration. It is not impossible that one implementation of the library is off.

Techno

  • Newbie
  • *
  • Posts: 26
Re: BMP085 Readings off using Digix by Digistump
« Reply #10 on: February 18, 2014, 11:14:59 am »
Would you not expect a smaller difference in a distance of 20 miles?  I understand there are multiple variables; just thinking with two different setups (developement boards) the readings would be closer.  I realize the actual Barometric pressure is going to likely be different than NWS at my location.



William
« Last Edit: February 18, 2014, 11:19:01 am by Techno »

dougal

  • Sr. Member
  • ****
  • Posts: 289
Re: BMP085 Readings off using Digix by Digistump
« Reply #11 on: February 18, 2014, 02:13:02 pm »
Which BMP085 board do you have? The reason I ask, is that I'm trying to think of what factors could be different between your readings on the Mega and the DigiX. Two possibilities come to mind:

1) The sensor library could have code differences specific to the different processors, that aren't in sync for some reason.
2) The Mega is a 5V board, while the DigiX is 3.3V.

I don't know if the power difference could be a factor or not. But I was noticing that Adafruit's BMP085 sensor seems to be 5V safe, but I know I have a SparkFun sensor that's only for 3.3V. Again, I don't know if your sensor has a regulator, or if there's a mismatch, or if that would cause a problem in any case. It's just something that came to mind.

cpldcpu

  • Newbie
  • *
  • Posts: 30
Re: BMP085 Readings off using Digix by Digistump
« Reply #12 on: February 18, 2014, 09:29:57 pm »
The DigiX reading seems to be correct, taking the height difference into account.

The Mega value is the one that is off. Are you sure it does not have some kind of altitude correction activated?

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: BMP085 Readings off using Digix by Digistump
« Reply #13 on: February 18, 2014, 11:58:06 pm »
The library has a perfect #define prepared (line 32 in Adafruit_BMP085_U.cpp):
#define BMP085_USE_DATASHEET_VALS (0) /* Set to 1 for sanity check */
Set this value to 1 and than run the unchanged sensorapi, which is the example of the library on both devices.

If you see differences in the output values, you should carefully check, where different data types (8-bit vs 32-bit) in the calculations of the library may cause errors, like digistump assumed some answers above.

If the outputs are the same on both devices, check your code!

Techno

  • Newbie
  • *
  • Posts: 26
Re: BMP085 Readings off using Digix by Digistump
« Reply #14 on: February 23, 2014, 04:29:42 pm »
Here are my results of testing by using Adafruit's Senorapi.ino with the  .cpp file set to "1" sanity setting:

First Image shows results are identical!  699.64 hPa = 20.66 inches of Mercury  NWS Barometric preesure was 30.16 inches of Mercury or 1021.8 mb (Sea Level) at 2:54 PM EST.

Second image shows Weather Observations (Arduino Mega 2560 with
http://code.google.com/p/bmp085driver/ library.

William
« Last Edit: February 23, 2014, 04:42:23 pm by Techno »