Giter Site home page Giter Site logo

adafruit-bmp085-library's Introduction

Adafruit BMP085 Library Build StatusDocumentation

This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor

Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout ----> http://www.adafruit.com/products/391 ----> http://www.adafruit.com/products/1603

These displays use I2C to communicate, 2 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Check out the links above for our tutorials and wiring diagrams

Requires the https://github.com/adafruit/Adafruit_BusIO library for I2C abstraction

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, all text above must be included in any redistribution

To download. click the DOWNLOAD ZIP button, rename the uncompressed folder Adafruit_BMP085. Check that the Adafruit_BMP085 folder contains Adafruit_BMP085.cpp and Adafruit_BMP085.h

Place the Adafruit_BMP085 library folder your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.

We also have a great tutorial on Arduino library installation at: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

adafruit-bmp085-library's People

Contributors

caternuson avatar eangeloff avatar evaherrada avatar hoffmannjan avatar ladyada avatar netmaniac avatar paintyourdragon avatar samyk avatar sconaway avatar tdicola avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit-bmp085-library's Issues

Set mode and check if it will be use

Hy
i have a BMP_180 and want to use the ultra-low mode.
I'm not sure how i can check, if the ultralow mode is in use?

i read the *.h file and found the option:
#define BMP085_ULTRALOWPOWER 0
is it enough to use this code line after include the libary?
how can i check, if it is really in use?

thank you

Temperature calculation

In issue 5 (and the resulting commit) the calculation for the temperature was changed from
X1 = ((UT - (int32_t)ac6) * (int32_t)ac5) >> 15;
to
X1 = ((UT - (int32_t)ac6) * (int32_t)ac5) / pow(2,15);
I think (but may be wrong) that ">> 15" is faster than "/pow(2,15)" and gives the same result. So I would propose to use ">> 15" and "<< 11" (the other change made) again.

I added a new private function to get rid of the redundant code:

int32_t Adafruit_BMP085::readB5(void) {
int32_t UT, X1, X2, B5; // following ds convention

UT = readRawTemperature();

if BMP085_DEBUG == 1

// use datasheet numbers!
UT = 27898;
ac6 = 23153;
ac5 = 32757;
mc = -8711;
md = 2868;

endif

// step 1
X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15;
X2 = ((int32_t)mc << 11) / (X1+(int32_t)md);
B5 = X1 + X2;

if BMP085_DEBUG == 1

Serial.print("X1 = "); Serial.println(X1);
Serial.print("X2 = "); Serial.println(X2);
Serial.print("B5 = "); Serial.println(B5);

endif

return B5;
}

Now the new readTemperature() becomes:
float Adafruit_BMP085::readTemperature(void) {
int32_t B5; // following ds convention
float temp;

// step 1
B5 = readB5();
temp = (B5+8) >> 4;
temp /= 10;

return temp;
}

and readPressure():
int32_t Adafruit_BMP085::readPressure(void) {
int32_t UT, UP, B3, B5, B6, X1, X2, X3, p;
uint32_t B4, B7;

B5 = readB5();
UP = readRawPressure();

if BMP085_DEBUG == 1

...

I hope you like the change.

Stephan

using bmp085 with software I2C

I modified Adafruit_BMP085(.cpp|.h) and the example to work with the I2cMaster library, so that I can run it with an Adafruit data logger shield. How can I contribute the code?

No error Checking

Limor,

nice work. Works out of the box...

What puzzles me: works without box, too. There is no error checking, whether den BMP085 exists or answers with valid data.

I added a (.h)

class Adafruit_BMP085 {
public:
bool Error;

and (.c)

uint16_t Adafruit_BMP085::read16(uint8_t a) {
....
Error|=Wire.available()!=2;

if (ARDUINO >= 100)

Wire.endTransmission after Wire.requestFrom is not okay.

In two places there is a Wire.endTransmission after a Wire.requestFrom.
The Wire.requestFrom is a complete I2C transmission on its own, it should not be followed by a Wire.endTransmission.
The Wire.endTransmission transmits the bytes in the buffer that are written with Wire.write and waits until the I2C transmission (to write date) has finished.

Two sensors on I2C bus

Hello,
For a project, I would like to test the good functioning of a pressure sensor. To do that, I would like to comparate the value returned by the sensor tested with and other pressure sensor. However, I don't know if it is possible to do, because I have to connect the two sensors on the same I2C bus. Is it possible to adress differents requests to each sensors? These two are BMP180.
Thanks a lot,
Seb.

How to measure QNH using BMP085 sensor

Hello,

I would like to do my barometer to measure QNH in Hecto Pascal.
I tested your sample to Arduino but I perceved that pressure is the QFE and I would like know, how to get the QNH values. Other thing, I would like to show it in hPA. Can you help me?
Thank you

Pimentel

Cannot compile for Due

The library does not compile for the Arduino Due. The compiler complained that it cannot find "util/delay.h". After removing the offending "#include <util/delay.h>" and changing "_delay_ms()" to "delay()" it works.

Is there a difference between _delay_ms() and delay()?

A conditional compile would be great...

Thanks for the great job!
Stephan

Wrong calculations on readings.

Going through the datasheet and writing my own library for the chip and using this as a cross reference I have noticed that the temperature reading is incorrect. I would imagine this would make the others incorrect as well. In my specific case it's telling me the temperature is 15_c with this library and my version tells me it's 25.9_c. The calculation I did was pulled directly from the datasheet whereas in this library it's a different calculation.

From the library:

in one location its:
// do temperature calculations
X1 = ((UT - (int32_t)ac6) * (int32_t)ac5) >> 15;
X2 = ((int32_t)mc << 11) - (X1 + md)/2; // round up
X2 /= (X1 + md);
B5 = X1 + X2;
and in another location its:
// step 1
X1 = ((UT - (int32_t)ac6) * (int32_t)ac5) >> 15;
X2 = ((int32_t)mc << 11) / (X1 + (int32_t)md);
B5 = X1 + X2;
temp = (B5 + 8) >> 4;
temp /= 10;

From my code:

x1=(ut-(int32_t)((uint16_t)bar_calib[ac6]))_((int32_t)((uint16_t)bar_calib[ac5]))/pow(2,15);
x2=((int32_t)bar_calib[mc]_pow(2,11))/(x1+(int32_t)bar_calib[md]);
b5=x1+x2;
bar_data[temp]=(b5+8)/pow(2,4);

In my code i cast ac6 and ac5 into uint16_6 first since it's stored in an int16_t array then cast it to length. The way I calculated it is directly as stated in the datasheet unlike this library's code. If the temperature reading is wrong I would also imagine that pressure and altitude calculations would also be wrong.

Also ran sparkfun's listed library and it give's me the same reading as my code and they have:

x1 = (((long)ut - (long)ac6)*(long)ac5) >> 15;
x2 = ((long)mc << 11)/(x1 + md);
b5 = x1 + x2;

return ((b5 + 8)>>4);

Add function for calculating pressure at sea level

I missed a function to calculate the pressure at sea level if the the altitude is known.

Adafruit_BMP085.h:

int32_t readSealevelpressure(float altitude = 0); // std atmosphere

Adafruit_BMP085.c:

int32_t Adafruit_BMP085::readSealevelpressure(float altitude) {
int32_t sealevelPressure;

float pressure = readPressure();

sealevelPressure = (int32_t)(pressure / pow(1.0-altitude/44330, 5.255));

return sealevelPressure;
}

Pressure Readings too high.

Current Pressure reading at my location is 25.54 in/hg.
Converts to 86488 Pa
These readings are from a weather station on my property. I can provide the CWOP data QC validation if required.

Using the AdaFruit-BMP085-Library, I get the following readings

Temperature = 18.60 *C
Pressure = 233247 Pa
Altitude = -7622.78 meters
Real altitude = -7605.38 meters

Temperature is correct, but it seems as if the pressure calcs are quite a bit off. I've substituted code from another library and am able to get a close match on the pressure, so i'm pretty sure its not the chip.

Thanks in advance for your help!

compiler Error

Hi,

I run "Arduino Ver 1.0.5" to compiler the Adafruit-BMP085-Library. Unfortunately, I got the Error Messasage as following
" error: could not convert 'bmpAdafruit_BMP085::begin(3u)' to 'bool' "
" error: in argument to unary"
I am wondering the Library had been work? Anyone can help? Thanks!

Phillip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.