The english site : http://www.amsys.info/products/ams5915.htm
How did you connect the sensor to which Arduino board ? because it is a 3.3V sensor.
Don’t tell it’s good because it works, you have to convince me that you did it right 8)
When printing a BIN value, the zeros at the start are omitted.
Your values are : 0010 0110 and 0101 0010.
That is 0x26 0x52
Glue them together, and use the 14 lower bits makes : 9810 decimal
Your local wheater stations convert it to value to “what it should be” at sea level (zero height).
That means that you have to compensate it for every meter height you are at.
The Wire.requestFrom() is a complete I2C transaction on its own. You don’t need the Wire.beginTransmission() and not the Wire.endTransmission().
Steps to make it work:
1 ) tell me how you have connected it, where the pullup resistors are, and so on.
2 ) run the i2c_scanner ( http://playground.arduino.cc/Main/I2cScanner ) and let it run for a while to see if it is stable.
3 ) Do a Wire.requestFrom() and combine the bytes with word().
#define adr 40
int n = Wire.requestFrom (adr, 4);
if (n == 4)
Wire.readBytes (buffer, 4);
unsigned int rawB = word (buffer, buffer); // word(high,low)
unsigned int rawT = word (buffer, buffer);
// note that the next bit operations works best with "unsigned int", not with "int"
rawB &= 0x3FFF; // Keep only the 14 lower bits
rawT >>= 5 ; // Use the 11 highest bits, shift them in position
float baromic = (( (float) rawB - 1638.0 ) / ( 13107.0 / 10.0 ) ) - 5.0;
float temperature = (( (float) rawT * 200.0 ) / 2048.0 ) - 50.0;
Serial.print("rawB = ");
Serial.print(" --> ");
Serial.print("rawT = ");
Serial.print(" --> ");
Serial.println ("Error, no sensor found");
As you can see, I read all 4 bytes, and I use an array for that. The function Wire.readBytes() reads all 4 bytes at once in the array. The way the bits are handled and the formulas are from the datasheet. I checked if I got the same result as the datasheet and it was okay.
Your value of 9810 results into 1235 mbar ? Perhaps the sensor is not calibrated.
Can you get a BMP180 to compare the results ? They are calibrated in the factory and are very accurate.
Adafruit has also a library for it, so you don’t have to read the datasheet of the BMP180.