BMP180 barometer breakout - how to change sample rate?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
VoidWarranty
 
Posts: 23
Joined: Thu Nov 06, 2014 6:36 pm

BMP180 barometer breakout - how to change sample rate?

Post by VoidWarranty »

While working with the MPL3115A2 I2C barometer, I was puzzled that the reading in the serial console only updated once per second, even if I took out the delay. So I looked into the spec sheet for the MPL3115A2 barometer, and found that 1 measurement/sec is the fastest it will operate. Okay fine, I need a different barometer for the rapid measurements I want to do. The spec sheet for the BMP180/085 altimeter says that it allows up to 128 samples/sec. But where do I find and change this parameter? I see that the oversampling parameter can be changed, but that doesn't change the sample rate, which I'm guessing is set at 1/sec by default. If someone has a quick answer and wants to throw me a line, that'd be great!

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: BMP180 barometer breakout - how to change sample rate?

Post by Franklin97355 »

Page 21 of this document has information on the code to send the register and the time to make the conversion.

User avatar
VoidWarranty
 
Posts: 23
Joined: Thu Nov 06, 2014 6:36 pm

Re: BMP180 barometer breakout - how to change sample rate?

Post by VoidWarranty »

Thanks for the reply Franklin.

Page 21 of the Bosch documentation has "Figure 8: Timing diagram for starting pressure measurement" and "Table 8: Control registers values for different internal oversampling_setting (oss)".

As far as I can glean, the oversampling setting allows adjustment of the number of measurements (samples) used to compute each reported result, which still get reported back to my controller once per second regardless of the oversampling setting. The difference is that using more samples to compute the result yields a more accurate answer, but the oversampling and computation are done on the barometer chip before it gets sent back to my Arduino or other controller.

Figure 8 is the timing diagram, showing how the pressure measurement is initiated relative to the clock signal SCL: "the master sends the device address write, the register address and the control register data." The BMP chip is meanwhile sending an acknowledgement signal back periodically while this data is being received.


I don't know how and where the once-per-second reporting of data is derived.
Related question: what is the default clock frequency?

User avatar
jboyton
 
Posts: 101
Joined: Tue Sep 16, 2014 2:52 pm

Re: BMP180 barometer breakout - how to change sample rate?

Post by jboyton »

The "128 samples per second" refers to standard mode and is determined by the conversion time (7.5ms for standard mode). That is, if all you do is ask the chip over and over to give you the pressure (and the temperature at least once per second) you'll be able to do this 132 times in one second. Bosch calls this 128 for some reason; maybe there's something I missed.

In standard mode the chip performs 2 internal samples each "sample". The terminology is confusing. But what it means is you could really do about 264 samples in a second in standard mode. Since the conversion time doesn't scale linearly, in ultra high resolution mode you could do 39 samples of 8 internal samples each which is a total of 314 samples per second.

User avatar
VoidWarranty
 
Posts: 23
Joined: Thu Nov 06, 2014 6:36 pm

Re: BMP180 barometer breakout - how to change sample rate?

Post by VoidWarranty »

Aha, awesome thank you. I received my BMP180's in the mail. I wired one up, decreased the delay in the example code, and sure enough, got rapid-fire data in the serial console. Hooray. I am back in business. In summary, the behavior of the BMP180 is quite distinct from the MPL3115; wish I'd known this before putting all my effort into the latter. Also, the libraries and example code from Adafruit are very different for the two barometers. For the BMP180, and my application, I found the Sparkfun example code/library for the BMP180 to be a better choice. Only tiny changes to the code I had constructed for the MPL3115 had to made to make the switch to the BMP180. In fact, my code got simpler.

User avatar
jboyton
 
Posts: 101
Joined: Tue Sep 16, 2014 2:52 pm

Re: BMP180 barometer breakout - how to change sample rate?

Post by jboyton »

I looked at the MPL chip and thought it was more or less the same as the BMP. Similar precision. Same cost. Same footprint. The BMP is slightly faster but the MPL does the floating point processing for altitude on board. Tomato tomahto.

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

Return to “Arduino”