I have a problem reading the BMP180 sensor.
When I read the raw values for the pressure I get values far to big. Temperature values are ok.
According to the data sheet from BOSCH Page 15 the values for UP range about 23843:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmp180/BST-BMP180-DS000-09.pdf
When I read my raw values I get values about 10509568 wich leads to a much to high pressure.
I used the data sheet page 15:
#include <Wire.h>
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop()
{
int x;
byte data[2];
char _error;
long UP;
Serial.println();
Serial.print("read pressure direct: ");
// ask for data
data[0] = 0xF4;
data[1] = 0x34;
Wire.beginTransmission(0x77);
Wire.write(data, 2);
Wire.endTransmission();
delay(30);
// read data
data[0] = 0xF6;
Wire.beginTransmission(0x77);
Wire.write(data[0]);
_error = Wire.endTransmission();
if (_error == 0)
{
Wire.requestFrom(0x77, 3);
while(Wire.available() != 3) ;
for (x=0;x<3;x++)
data[x] = Wire.read();
Serial.println();
Serial.print("data[0]: ");
Serial.print(data[0], BIN);
Serial.println();
Serial.print("data[1]: ");
Serial.print(data[1], BIN);
Serial.println();
Serial.print("data[2]: ");
Serial.print(data[2], BIN);
}
UP = ((unsigned long)data[0] << 16) + ((unsigned long)data[1] << 8) + ((unsigned long)data[2] >> (8 - 0));
Serial.println();
Serial.print("UP: ");
Serial.print(UP);
delay(1000);
}
Output:
read pressure direct:
data[0]: 10100000
data[1]: 1011101
data[2]: 0
UP: 10509568
I can not see what I did wrong but obviously there must be an error in my code.
I use an arduino mega 2560.
Any suggestions? Thank you in advance.