loading

In this tutorial we will use the Adafruit BMP280 sensor. This sensor can measure barometric pressure and temperature with very good accuracy. Because pressure changes with altitude we can also use it as an altimeter with ±1 meter accuracy! Accuracy for barometric pressure is ±1 hPa and ±1.0°C for temperature.

You can connect it with your Arduino board with I2C or SPI connection protocol. It has a 3.3V regulator and level shifting so you can use it with a 3V or 5V logic micro controller without any problems.

In this tutorial we will use the Arduino UNO board with this sensor and the serial monitor of Codebender to print measured values every 5 sec.

So, let's get started!

Step 1: What You Will Need

For this tutorial you will need:

  • Arduino uno
  • Breadboard (or breadboard shield)
  • Adafruit BMP280
  • Some breadboard cables

Step 2: The Circuit

The connections are pretty easy, see the above image with the breadboard circuit schematic.

We will use the I2C connection (SCL and SDA pins)

Connections of the Adafruit BMP280 sensor:

  • Vin to Arduino 5V pin
  • 3Vo
  • GND to GDN
  • SCK to Arduino SCL pin (A5)
  • SDO
  • SDI to Arduino SDA pin (A4)
  • CS

Step 3: The Code

Here's the code, embedded using Codebender!
Try downloading the Codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. And that's it, you've programmed your Arduino uno board with this sketch!

Step 4: Measured Values

Press the "connect" button to the serial monitor of Codebender below:

Step 5: Well Done!

You have successfully completed one more "How to" tutorial and you learned how to use the Adafruit BMP280 sensor with the Arduino uno board.

I hope you liked this, let me know in the comments. There will be more of them, so make sure to click Follow button!

<p>I need to use 6 to 8 BMP280's Using I2C and common wiring to 5V, GND, SCK &amp; SDI. There is no chip selection in any of the tutorials that I could find that shows how to enable/disable communications in I2C mode. </p><p>Looking at the BMP280's documentation, there is a &quot;Vdd io&quot; that must have 5V applied to enable communication. But nowhere in the tutorials is CS or CSO connected in I2C mode. </p><p>Looking the SPI documentation there is an inference that the CS can be set. Is it active in I2C? </p><p>Can I, set CS to 5V to enable one BMP280 at a time in I2C ? Or does Adafruit's BMP280 use SC to disable?</p>
<p>From datasheet.. hope this help..</p><p>&quot;Interface selection is done automatically based on CSB (chip select) status. If CSB is connected to VDDIO, the I&sup2;C interface is active. If CSB is pulled down, the SPI interface is activated.</p><p>The I&sup2;C 7-bit device address is 111011x. The 6 MSB bits are fixed. The last bit is changeable by SDO value and can be changed during operation. Connecting SDO to GND results in slave address 1110110 (0x76); connection it to VDDIO results in slave address 1110111 (0x77), which is the same as BMP180&rsquo;s I&sup2;C address. The SDO pin cannot be left floating; if left floating, the I&sup2;C address will be undefined.&quot;</p>
<p>After purchasing a Chinese BMP280 4 pin sensor, I had trouble with getting any response at all; all 0000's. I changed the Adafruit_BMP280.h from the standard library to the *.h file that has the</p><p> &quot;</p><p>I2C ADDRESS/BITS/SETTINGS<br> -----------------------------------------------------------------------*/<br> #define BMP280_ADDRESS (0x76)<br> #define BMP280_CHIPID (0x58)</p><p>&quot; </p><p>and all works perfectly now. </p>
<p>winniepough</p><p>Is the answer there in the methods available to instantiate the Adafruit_BMP280 object? The three options are shown in this Instructable without explanation. the simplest/default as</p><p>Adafruit_BMP280 bmp; // I2C</p><p>/*//For SPI connection!</p><p>#define BMP_SCK 13</p><p>#define BMP_MISO 12</p><p>#define BMP_MOSI 11</p><p>#define BMP_CS 10</p><p>The second is &quot;Adafruit_BMP280 bme(BMP_CS);&quot; where BMP_CS is the user's pin number choice.</p><p>The third is &quot;Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);&quot; where all four pins are user values. I don't know if these are optional arguments with defaults or not. The obvious application for this method is to allow Mega1280 or Mega2560 as well as UNO</p><p>Not being familiar with this chip/module, I presume the first option is I2C if SDA/SCL connected but have no idea how the library figures out to use the default SPI. Also not expert with I2C vs SPI but it may not be possible to use I2C for 6-8 devices.</p><p>Your 6-8 modules will certainly tax a UNO assuming TX.RX(2) SCK.MISO.MOSI(3) if your using Arduino pins directly. The analog pins can be used as pin #14-19 but not 18,19 when using SDA/SCL.</p><p>Lots of little tripping hazards.</p><p>Good Luck</p>

About This Instructable

29,401views

108favorites

License:

Bio: Arduino Tutorials by Codebender.cc Team
More by codebender_cc:How to use a magnetic door switch / sensor with Arduino How to Measure LUX With Arduino How to Control an RGB LED Strip - Arduino Tutorial 
Add instructable to: