Pressure sensor BMP085 and Adafruit v1 Library

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Davide_sd
 
Posts: 3
Joined: Mon Apr 07, 2014 7:50 am

Pressure sensor BMP085 and Adafruit v1 Library

Post by Davide_sd »

Hi all,
i'm trying to understand the v1 API library code written by Adafruit for this sensor https://learn.adafruit.com/bmp085/using-the-bmp085. The library works great! :)
This is the data sheet for the sensor: https://www.sparkfun.com/datasheets/Com ... 000-05.pdf
Page 13 shows the pseudo-code. We can see that in order to calculate the raw temperature we have to read the values for MSB, LSB. But in the v1 API library there is the method readRawTemperature where the values for MSB and LSB are not used.
Can someone explain me the reason behind the code in that method?

Thanks in advance.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Pressure sensor BMP085 and Adafruit v1 Library

Post by adafruit_support_rick »

The library calls read16, which reads the LSB and MSB and returns a 16-bit result.

Davide_sd
 
Posts: 3
Joined: Mon Apr 07, 2014 7:50 am

Re: Pressure sensor BMP085 and Adafruit v1 Library

Post by Davide_sd »

Indeed, that's what i don't understand...
I'm trying to learn how to write a library for arduino, and i was looking at your code. In my implementation i didn't used the readRawTemperature method, instead i've used this code. It works good for temperatures < 25 °C, but when the temperature is >= 25°C, the output is something like -260°C... What am i doing wrong?

Code: Select all

  uint8_t MSB, LSB;
  write8(0xF4, 0x2E);
  _delay_ms(5);
  MSB = read8(0xF6);
  LSB = read8(0xF7);
  UT = ( MSB << 8 ) + LSB;

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Pressure sensor BMP085 and Adafruit v1 Library

Post by adafruit_support_rick »

Make UT a uint16_t

Davide_sd
 
Posts: 3
Joined: Mon Apr 07, 2014 7:50 am

Re: Pressure sensor BMP085 and Adafruit v1 Library

Post by Davide_sd »

Thank you, it worked! :)
In this page it's introduced the EOC pin. https://learn.adafruit.com/bmp085/wiring-the-bmp085
What does it do? how it is supposed to work?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Pressure sensor BMP085 and Adafruit v1 Library

Post by adafruit_support_mike »

That's explained at the bottom of the page. 'EOC' means "End of Conversion".

The BMP085 sets that pin HIGH when it's done taking a reading, so you can connect it to a pin that accepts interrupts to make the system respond as quickly as it can.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”