# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/099/707/medium800/sensors_BMP388_STEMMA_top.jpg?1614104911)

Bosch has been a leader in barometric pressure sensors, from the [BMP085](https://www.adafruit.com/product/391). [BMP180](https://www.adafruit.com/product/1603), and [BMP280](https://www.adafruit.com/product/2651)... now we've got the next generation, the **Adafruit BMP388 and BMP390 Precision Barometric Pressure sensors**. As you would expect, this sensor is similar to its earlier versions but _even better_. The BMP3xx has better precision than the BMP2xx series which makes it excellent for environmental sensing or as a **precision altimeter**. It can even be used in either I2C and SPI configurations.

The BMP3xx is the next-generation of sensors from Bosch, and is the upgrade to the BMP280 - with a low altitude noise as low as 0.1m and the same fast conversion time. And like the previous BMP280, you can use I2C&nbsp;or SPI. For simple easy wiring, go with I2C. If you want to connect a bunch of sensors without worrying about I2C address collisions, go with SPI.

![](https://cdn-learn.adafruit.com/assets/assets/000/096/768/medium800/sensors_4816-02.jpg?1604525142)

- This **BMP388** sensor has a relative accuracy of 8 Pascals, which translates to about ± 0.5 meter of altitude
- This **BMP390** sensor has a relative accuracy of 3 Pascals, which translates to about ± 0.25 meter of altitude

**Compare to the BMP280's 12 Pascal/ ±1 meter!**

The datasheet sort of implies they intend this sensor to be used for drones and quadcopters, to keep altitude stable, but you could also use this for wearables or any project that wants to track height-above-sea-level. Note that for absolute height you'll still need to enter in the barometric pressure at sea level, if the weather changes, but that's true of every altimeter sensor that uses pressure. You can also measure temperature with ±0.5°C accuracy.

![](https://cdn-learn.adafruit.com/assets/assets/000/096/767/medium800/sensors_4816-04.jpg?1604525113)

Nice sensor right? So we made it easy for you to get right into your next project. The surface-mount sensor is soldered onto a PCB and comes with a 3.3V regulator and level shifting so you can use it with a 3V or 5V logic microcontroller without worry.

![](https://cdn-learn.adafruit.com/assets/assets/000/099/708/medium800/sensors_BMP388_STEMMA_side.jpg?1614105151)

We also made these boards in the [**STEMMA QT** form factor](https://www.adafruit.com/?q=stemma%20qt%20sensor), making them easy to interface with. The [STEMMA QT connectors](https://learn.adafruit.com/introducing-adafruit-stemma-qt/what-is-stemma-qt) on either side are compatible with the [SparkFun Qwiic](https://www.sparkfun.com/qwiic) I2C connectors. This allows you to make solderless connections between your development board and the BMP390&nbsp;or to chain it with a wide range of other sensors and accessories using a [**compatible cable**](https://www.adafruit.com/?q=stemma%20qt%20cable).&nbsp;

Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/072/426/medium800/sensors_BMP388_Top.jpg?1551997219)

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/099/709/medium800/sensors_BMP388_STEMMA_pinouts.jpg?1614105275)

![](https://cdn-learn.adafruit.com/assets/assets/000/072/605/medium800/sensors_BMP388_Top_Pinouts.jpg?1552408840)

![](https://cdn-learn.adafruit.com/assets/assets/000/096/770/medium800/sensors_4816-04.jpg?1604525340)

Info: 

## Power Pins

- **Vin** - this is the power pin. Since the sensor chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V
- **3Vo** - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like
- **GND** - common ground for power and logic

## SPI Logic pins

All pins going into the breakout have level shifting circuitry to make them 3-5V logic level safe. Use whatever logic level is on **Vin!**

- **SCK** - This is the **S** PI **C** loc **k** pin, its an input to the chip and can use 3 - 5V logic.
- **SDO** - this is the **S** erial **D** ata **O** ut / **M** icrocontroller **I** n **S** ensor **O** ut pin, for data sent from the BMP3xx to your processor. Logic level is 3.3V output, so can be read by 5V microcontrollers.
- **SDA** - this is the **S** erial **Da** ta In / **M** icrocontroller **O** ut **S** ensor **I** n pin, for data sent from your processor to the BMP3xx. Its an input to the chip and can use 3 - 5V logic. (SDI on original version)
- **CS** - this is the **C** hip **S** elect pin, drop it low to start an SPI transaction. Its an input to the chip and can use 3 - 5V logic.
- **INT** - this is the **Int** errupt pin. The BMP3xx can send an output signal to tell you when data is read (we don't use this in our libraries but it is available for your use). The logic level is 3.3V output, so it can be read by 5V microcontrollers.

If you want to connect multiple BMP3xx sensors to one microcontroller, have them share the SDI, SDO and SCK pins. Then assign each one a unique CS pin.

## I2C Logic pins

- **SCK** - this is _also_ the I2C clock pin, connect to your microcontroller's I2C clock line.
- **SDA** - this is _also_ the I2C data pin, connect to your microcontroller's I2C data line. (SDI on original version)
- **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;-** These connectors allow you to connectors to dev boards with&nbsp; **STEMMA QT** connectors or to other things with&nbsp;[various associated accessories](https://www.adafruit.com/?q=JST%20SH%204)

Leave the **CS** and **SDO** pins disconnected for I2C use.

## Address Jumper

- **ADDR** - This is the I2C address selection jumper. The default I2C address - when this jumper is disconnected - is **0x77**. On the STEMMA QT Versions you can change the I2C address by shorting this jumper. Once shorted the I2C address is **0x76**.

Info: 

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Assembly

Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/074/292/medium800/sensors_image.png?1554850186)

## Prepare the header strip:

Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard -&nbsp; **long pins down**

![sensors_DSC_4394.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/629/medium640/sensors_DSC_4394.jpg?1555704827)

![sensors_DSC_4396.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/630/medium640/sensors_DSC_4396.jpg?1555703422)

## Add the breakout board:

Place the breakout board over the pins so that the short pins poke through the breakout pads

![sensors_DSC_4397.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/631/medium640/sensors_DSC_4397.jpg?1555703501)

## And Solder!

Be sure to solder all 8 pins for reliable electrical contact.  
  
_(For tips on soldering, be sure to check out our&nbsp;_[_Guide to Excellent Soldering_](http://learn.adafruit.com/adafruit-guide-excellent-soldering)_)._

![sensors_DSC_4398.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/645/medium640/sensors_DSC_4398.jpg?1555705994)

![sensors_DSC_4401.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/646/medium640/sensors_DSC_4401.jpg?1555706138)

![sensors_DSC_4403.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/647/medium640/sensors_DSC_4403.jpg?1555708313)

![sensors_DSC_4404.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/648/medium640/sensors_DSC_4404.jpg?1555708304)

You're done! Check your solder joints visually and continue onto the next steps.

![sensors_DSC_4408.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/642/medium640/sensors_DSC_4408.jpg?1555707077)

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Arduino

You can easily wire this breakout to any microcontroller, we'll be using an Arduino Uno/328P compatible. For another kind of microcontroller, as long as you have 4 available pins it is possible to 'bit-bang SPI' or you can use two I2C pins, but usually those pins are fixed in hardware. Just check out the library, then port the code.

## I2C Wiring

Use this wiring if you want to connect via I2C interface:

- Connect **Vin** to the power supply, 3-5V is fine.&nbsp;**(Red wire on STEMMA QT version.)** Use the same voltage that the microcontroller logic is based off of. For most older Arduinos, that is 5V.
- Connect **GND** to common power/data ground.&nbsp;**(Black wire on STEMMA QT version.)**
- Connect the **SCK/SCL** pin to the I2C clock **SCL** pin on your Arduino.&nbsp;**(Yellow wire on STEMMA QT version.)** On an UNO & '328 based Arduino, this is also known as **A5** , on a Mega it is also known as **digital 21** and on a Leonardo/Micro, **digital 3.**
- Connect the **SDI/SDA** pin to the I2C data **SDA** pin on your Arduino. **(Blue wire on STEMMA QT version.)** On an UNO & '328 based Arduino, this is also known as **A4** , on a Mega it is also known as **digital 20** and on a Leonardo/Micro, **digital 2.**

![sensors_BMP390_metro_I2C_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/905/medium640/sensors_BMP390_metro_I2C_STEMMA_bb.jpg?1604945935)

![sensors_BMP390_metro_I2C_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/906/medium640/sensors_BMP390_metro_I2C_breadboard_bb.jpg?1604945976)

![sensors_BMP388_metro_I2C.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/907/medium640/sensors_BMP388_metro_I2C.jpg?1604946060)

![sensors_BMP388_arduino_I2C_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/724/medium640/sensors_BMP388_arduino_I2C_STEMMA_bb.jpg?1614184471)

![sensors_BMP388_arduino_I2C_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/725/medium640/sensors_BMP388_arduino_I2C_breadboard_bb.jpg?1614184488)

## SPI Wiring

Since this is a SPI-capable sensor, we can use hardware or 'software' SPI. To make wiring identical on all Arduinos, we'll begin with 'software' SPI. The following pins should be used:

- Connect **Vin** to the power supply, 3V or 5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V.
- Connect **GND** to common power/data ground.
- Connect the **SCK/SCL** pin to **Digital #13** but any pin can be used later.
- Connect the **SDO** pin to **Digital #12** but any pin can be used later.
- Connect the **SDI/SDA** pin to **Digital #11** but any pin can be used later.
- Connect the **CS** pin **Digital #10** but any pin can be used later.

![sensors_BMP390_metro_SPI_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/908/medium640/sensors_BMP390_metro_SPI_bb.jpg?1604946112)

![sensors_BMP388_metro_SPI.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/909/medium640/sensors_BMP388_metro_SPI.jpg?1604946119)

![sensors_BMP388_arduino_SPI_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/726/medium640/sensors_BMP388_arduino_SPI_breadboard_bb.jpg?1614184515)

Later on, once we get it working, we can adjust the library to use hardware SPI if you desire, or change the pins assignments.

## Download Adafruit\_BMP3XX library

To begin reading sensor data, you will need to [install the Adafruit\_BMP3XX library (code on our github repository)](https://github.com/adafruit/Adafruit_BMP3XX "Link: https://github.com/adafruit/Adafruit\_BMP280\_Library"). It is available from the Arduino library manager so we recommend using that.

From the IDE open up the library manager...

![](https://cdn-learn.adafruit.com/assets/assets/000/073/361/medium800/sensors_managelib.png?1553015471)

And type in **adafruit bmp3xx** to locate the library. Click **Install**

![](https://cdn-learn.adafruit.com/assets/assets/000/073/364/medium800/sensors_image.png?1553015597)

You'll also need to install the **Adafruit Unified Sensor** library

![](https://cdn-learn.adafruit.com/assets/assets/000/073/365/medium800/sensors_adafruitsensor.png?1553015607)

We also have a great tutorial on Arduino library installation at:  
[http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use "Link: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use")

## Load Demo

Open up **File -\> Examples -\> Adafruit\_BMP3XX&nbsp;**** -\> bmp3xx\_simpletest** and upload to your Arduino wired up to the sensor.

![](https://cdn-learn.adafruit.com/assets/assets/000/073/366/medium800/sensors_image.png?1553015649)

Depending on whether you are using I2C or SPI, change the pin names and comment or uncomment the following lines.

```
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11
#define BMP_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BMP3XX bmp; // I2C
//Adafruit_BMP3XX bmp(BMP_CS); // hardware SPI
//Adafruit_BMP3XX bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);  // Software SPI
```

Once uploaded to your Arduino, open up the serial console at 115200 baud to see data being printed out:

Warning: The first reading may be inaccurate. You should look to read the sensor once and discard the reading. Subsequent readings should be accurate.

![](https://cdn-learn.adafruit.com/assets/assets/000/073/956/medium800/sensors_BMP3XX_Arduino_Serial_Output.png?1554154209)

 **Temperature** is calculated in degrees C, you can convert this to F by using the classic F = C \* 9/5 + 32 equation.  
  
**Pressure** is returned in the SI units of **Pascals**. 100 Pascals = 1 hPa = 1 millibar. Often times barometric pressure is reported in millibar or inches-mercury (Hg). For future reference 1 pascal =0.000295333727 inches of mercury, or 1 inch Hg = 3386.39 Pascal. So if you take the Pascal value of say 100734 and divide by 3389.39 you'll get 29.72 inches-Hg.  
  
You can also calculate Altitude. **However, you can only really do a good accurate job of calculating altitude if you know the hPa pressure at sea level for your location and day!** The sensor is quite precise but if you do not have the data updated for the current day, then it can be difficult to get more accurate than 10 meters.

Pass in the current sea level pressure in **hPa** - so the value will be somewhere around ~1000. You can also test with the generic 1013.25 value.

## Example Code

The following example code is part of the standard library. It illustrates how you can retrieve sensor data from the BMP388 for the temperature, pressure and approximate altitude:

https://github.com/adafruit/Adafruit_BMP3XX/blob/master/examples/bmp3xx_simpletest/bmp3xx_simpletest.ino

Purple: The first value read may not be accurate as the sensor gets going. If you find this behavior, make one sensor read and ignore the data. Subsequent values should then be ok.

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Arduino Docs

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Python & CircuitPython

It's easy to use the BMP388 sensor with CircuitPython and the&nbsp;[Adafruit CircuitPython BMP3XX](https://github.com/adafruit/Adafruit_CircuitPython_BMP3XX)&nbsp;module.&nbsp; This module allows you to easily write Python code that reads the barometric pressure, temperature and more from the sensor.

You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python&nbsp;[thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

## CircuitPython Microcontroller Wiring

First wire up a BMP3xx to your board as shown below.&nbsp; You can use either I2C or SPI wiring, although it's recommended to use I2C for simplicity.&nbsp; Here's an example of wiring a Feather to the sensor with I2C:

- **Board 3V** &nbsp;to&nbsp;**sensor VIN (red wire on STEMMA QT version)**  
- **Board GND** &nbsp;to&nbsp;**sensor GND (black wire on STEMMA QT version)**  
- **Board SCL** &nbsp;to&nbsp;**sensor SCK/SCL (yellow wire on STEMMA QT version)**  
- **Board SDA** &nbsp;to&nbsp;**sensor SDI/SDA (blue wire on STEMMA QT version)**  

![sensors_BMP390_FeatherM4_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/897/medium640/sensors_BMP390_FeatherM4_STEMMA_bb.jpg?1604944338)

![sensors_BMP390_FeatherM4_I2C_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/898/medium640/sensors_BMP390_FeatherM4_I2C_breadboard_bb.jpg?1604944358)

![sensors_FeatherM0_BMP388_I2C_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/899/medium640/sensors_FeatherM0_BMP388_I2C_bb.jpg?1604944395)

![sensors_BMP388_Feather_I2C_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/727/medium640/sensors_BMP388_Feather_I2C_STEMMA_bb.jpg?1614184538)

![sensors_BMP388_Feather_I2C_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/728/medium640/sensors_BMP388_Feather_I2C_breadboard_bb.jpg?1614184555)

And an example of a Feather wired with hardware SPI:

- **Board 3V** &nbsp;to&nbsp; **sensor VIN**
- **Board GND** &nbsp;to&nbsp; **sensor GND**
- **Board SCK** &nbsp;to&nbsp; **sensor SCK/SCL**
- **Board&nbsp;MOSI&nbsp;** to&nbsp; **sensor SDI/SDA**
- **Board MISO** &nbsp;to&nbsp; **sensor SDO**
- **Board D5** &nbsp;to&nbsp; **sensor CS** &nbsp;(or use any other free digital I/O pin)

![sensors_FeatherM0_BMP388_SPI_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/671/medium640/sensors_FeatherM0_BMP388_SPI_bb.jpg?1599848958)

![sensors_BMP390_FeatherM4_SPI_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/900/medium640/sensors_BMP390_FeatherM4_%10SPI_bb.jpg?1604944686)

![sensors_BMP388_Feather_SPI_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/731/medium640/sensors_BMP388_Feather_SPI_breadboard_bb.jpg?1614184688)

## Python Computer Wiring

Since there's&nbsp;_dozens_&nbsp;of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For other platforms,&nbsp;[please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi wired with I2C:

- **Pi 3V3** &nbsp;to&nbsp; **sensor VIN**
- **Pi GND** &nbsp;to&nbsp; **sensor GND**
- **Pi SCL** &nbsp;to&nbsp; **sensor SCK/SCL**
- **Pi SDA** &nbsp;to&nbsp; **sensor SDI/SDA**

![sensors_BMP390_RasPi_I2C_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/901/medium640/sensors_BMP390_RasPi_I2C_STEMMA_bb.jpg?1604945660)

![sensors_BMP390_RasPi_I2C_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/902/medium640/sensors_BMP390_RasPi_I2C_breadboard_bb.jpg?1604945709)

![sensors_RasPi_BMP388_I2C_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/903/medium640/sensors_RasPi_BMP388_I2C_bb.jpg?1604945739)

![sensors_BMP388_RasPi_I2C_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/732/medium640/sensors_BMP388_RasPi_I2C_STEMMA_bb.jpg?1614184715)

![sensors_BMP388_RasPi_I2C_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/733/medium640/sensors_BMP388_RasPi_I2C_breadboard_bb.jpg?1614184738)

And an example on the Raspberry Pi 3 Model B wired with SPI:

- **Pi 3V3** &nbsp;to&nbsp; **sensor VIN**
- **Pi GND** &nbsp;to&nbsp; **sensor GND**
- **Pi MOSI&nbsp;** to&nbsp; **sensor SDI/SDA**
- **Pi MISO** &nbsp;to&nbsp; **sensor SDO**
- **Pi SCLK** &nbsp;to&nbsp; **sensor SCK/SCL**
- **Pi #5** &nbsp;to&nbsp; **sensor CS** &nbsp;(or use any other free GPIO pin)

![sensors_RasPi_BMP388_SPI_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/151/medium640/sensors_RasPi_BMP388_SPI_bb.jpg?1552667775)

![sensors_BMP390_RasPi_SPI_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/096/904/medium640/sensors_BMP390_RasPi_SPI_bb.jpg?1604945777)

![sensors_BMP388_RasPi_SPI_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/734/medium640/sensors_BMP388_RasPi_SPI_breadboard_bb.jpg?1614184757)

## CircuitPython Installation of BMP3XX Library

You'll need to install the&nbsp;[Adafruit CircuitPython BMP3XX](https://github.com/adafruit/Adafruit_CircuitPython_BMP3XX)&nbsp;library on your CircuitPython board.

First make sure you are running the&nbsp;[latest version of Adafruit CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython)&nbsp;for your board.

Next you'll need to install the necessary libraries&nbsp;to use the hardware--carefully follow the steps to find and install these libraries from&nbsp;[Adafruit's CircuitPython library bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases).&nbsp; Our CircuitPython starter guide has [a great page on how to install the library bundle](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries).

For non-express boards like the Trinket M0 or Gemma M0, you'll need to manually install the necessary libraries from the bundle:

- **adafruit\_bmp3xx.mpy**
- **adafruit\_bus\_device**

Before continuing, make sure your board's **lib** folder or root filesystem has the&nbsp; **adafruit\_bmp3xx.mpy,** and **adafruit\_bus\_device**** &nbsp; **files and folders** &nbsp;**copied over.

Next&nbsp;[connect to the board's serial REPL&nbsp;](https://learn.adafruit.com/welcome-to-circuitpython/the-repl)so you are at the CircuitPython&nbsp; **\>\>\>** &nbsp;prompt.

## Python Installation of BMP3XX Library

You'll need to install the **Adafruit\_Blinka** library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3.&nbsp;[Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `sudo pip3 install adafruit-circuitpython-bmp3xx`

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## CircuitPython & Python Usage

To demonstrate the usage of the sensor, we'll initialize it and read the pressure, temperature and more from the Python REPL.

If you're using an I2C connection, run the following code to import the necessary modules and initialize the I2C connection with the sensor:

```python
import time
import board
import adafruit_bmp3xx
i2c = board.I2C()
bmp = adafruit_bmp3xx.BMP3XX_I2C(i2c)
```

Or if you're using a SPI connection run this code instead to setup the SPI connection and sensor:

```python
import time
import board
import adafruit_bmp3xx
import digitalio
spi = board.SPI()
cs = digitalio.DigitalInOut(board.D5)
bmp = adafruit_bmp3xx.BMP3XX_SPI(spi, cs)
```

Now you're ready to read values from the sensor using any of these properties:

- `temperature`&nbsp;- The sensor temperature in degrees Celsius.
- `pressure`&nbsp;- The pressure in hPa.
- `altitude`&nbsp;- The altitude in meters.

For example to print temperature and pressure:

```
print("Pressure: {:6.1f}".format(bmp.pressure))
print("Temperature: {:5.2f}".format(bmp.temperature))
```

![](https://cdn-learn.adafruit.com/assets/assets/000/073/152/medium800/sensors_BMP388_REPL_print.png?1552668780)

For altitude, you'll want to set the pressure at sea level for your location to get the most accurate measurement (remember these sensors can only infer altitude based on pressure and need a set calibration point).&nbsp; Look at your local weather report for a pressure at sea level reading and set the `sea_level_pressure` property:

```
bmp.sea_level_pressure = 1013.25
```

Then read the `altitude` property for a more accurate altitude reading (but remember this altitude will fluctuate based on atmospheric pressure changes!):

```
print('Altitude: {} meters'.format(bmp.altitude))
```

![](https://cdn-learn.adafruit.com/assets/assets/000/073/153/medium800/sensors_BMP388_REPL_Pressure.png?1552669000)

Warning: The first reading may be inaccurate. You should look to read the sensor once and discard the reading. Subsequent readings should be accurate.

That's all there is to using the BMP388 sensor with CircuitPython!

## Full Example Code
https://github.com/adafruit/Adafruit_CircuitPython_BMP3XX/blob/main/examples/bmp3xx_simpletest.py

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Python Docs

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## WipperSnapper

![](https://cdn-learn.adafruit.com/assets/assets/000/123/940/medium800/sensors_IVSo4tDSPn.png?1692970533)

## What is WipperSnapper

WipperSnapper is a firmware designed to turn any WiFi-capable board into an Internet-of-Things device without programming a single line of code. WipperSnapper connects to [Adafruit IO](https://io.adafruit.com/), a web&nbsp;platform designed ([by Adafruit!](https://www.adafruit.com/about)) to&nbsp;_display_,&nbsp;_respond_, and&nbsp;_interact_&nbsp;with your project's data.

Simply load the WipperSnapper firmware onto your board, add credentials, and plug it into power. Your board will automatically register itself with your Adafruit IO account.

From there, you can add&nbsp;_components_&nbsp;to your board such as buttons, switches, potentiometers, sensors, and more! Components are&nbsp;_dynamically&nbsp;_added to hardware, so you can&nbsp;immediately start interacting, logging, and streaming the data your projects produce without writing code.

If you've never used WipperSnapper, click below to read through the quick start guide before continuing.

[Quickstart: Adafruit IO WipperSnapper](https://learn.adafruit.com/quickstart-adafruit-io-wippersnapper)
## Wiring
First, wire up a BMP388 to your board exactly as follows. Here is an example of the BMP388 wired to an&nbsp;[Adafruit ESP32 Feather V2](https://www.adafruit.com/product/5400)&nbsp;using I2C&nbsp;[with a STEMMA QT cable (no soldering required)](https://www.adafruit.com/product/4210)

- **Board 3V** &nbsp;to&nbsp;**sensor VIN (red wire on STEMMA QT)**  
- **Board GND** &nbsp;to&nbsp;**sensor GND (black wire on STEMMA QT)**  
- **Board SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire on STEMMA QT)**  
- **Board SDA** &nbsp;to&nbsp;**sensor SDA (blue wire on STEMMA QT)**

![Circuit showing BMP388 joined to Feather with Stemma QT / Qwiic / JST-SH 4-pin cable.](https://cdn-learn.adafruit.com/assets/assets/000/123/948/medium640/sensors_BMP388_bb.png?1692973298)

![sensors_BMP388_Breadboard_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/124/255/medium640/sensors_BMP388_Breadboard_bb.png?1694094624)

## Usage

Connect your board to Adafruit IO Wippersnapper and **[navigate to the WipperSnapper board list](https://io.adafruit.com/wippersnapper).**

On this page, **select the WipperSnapper board you're using** to be brought to the board's interface page.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/950/medium800/sensors_i0ySt5MmWt.png?1692973462)

If you do not see your board listed here - you need [to connect your board to Adafruit IO](https://learn.adafruit.com/quickstart-adafruit-io-wippersnapper) first.

On the device page, quickly&nbsp; **check that you're running the latest version of the WipperSnapper firmware**.

The device tile on the left indicates the version number of the firmware running on the connected board.

- **If the firmware version is green with a checkmark -** &nbsp;continue with this guide.
- **If the firmware version is red with an exclamation mark "!" -** &nbsp;[update to the latest WipperSnapper firmware](https://learn.adafruit.com/quickstart-adafruit-io-wippersnapper)&nbsp;on your board before continuing.

![sensors_version70_arrow_L94t15BUzv.png](https://cdn-learn.adafruit.com/assets/assets/000/123/952/medium640/sensors_version70_arrow_L94t15BUzv.png?1692973645)

![sensors_DeviceListPage_UpdateRequired.png](https://cdn-learn.adafruit.com/assets/assets/000/123/953/medium640/sensors_DeviceListPage_UpdateRequired.png?1692973659)

Next, make sure the sensor is plugged into your board and click the **&nbsp;I2C Scan&nbsp;** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/113/177/medium800/sensor_page_crop_scan.png?1657724520)

You should see the BMP388's default I2C address of&nbsp;`0x77`&nbsp;pop-up in the I2C scan list.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/954/medium800/sensors_Screenshot_2023-08-22_174635.png?1692973797)

###  I don't see the sensor's I2C address listed! 


First, double-check the connection and/or wiring between the sensor and the board.

Then, reset the board and let it re-connect to Adafruit IO WipperSnapper.

With the sensor detected in an I2C scan, you're ready to add the sensor to your board.

**Click the New Component button or the + button** to bring up the component picker.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/931/medium800/sensor_page_temperature___humidity_06_AddComponent.png?1708631009)

Adafruit IO supports a large amount of components. To quickly find your sensor, type&nbsp;`BMP3`&nbsp;into the search bar, then select the&nbsp; **BMP388** or **BMP390** &nbsp;component.

![](https://cdn-learn.adafruit.com/assets/assets/000/128/246/medium800/sensors_KnQkrrnfDf.png?1709161059)

On the component configuration page, the BMP388's sensor address should be listed along with the sensor's settings.

The&nbsp; **Send Every** &nbsp;option is specific to each sensor's measurements. This option will tell the Feather how often it should read from the BMP388 sensor and send the data to Adafruit IO. Measurements can range from every 30 seconds to every 24 hours.

For this example, set the&nbsp; **Send Every&nbsp;** interval to every 30 seconds.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/957/medium800/sensors_lg5zZ7pchh_cropped.png?1692974270)

Your device interface should now show the sensor components you created. After the interval you configured elapses, WipperSnapper will automatically read values from the sensor(s) and send them to Adafruit IO.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/958/medium800/sensors_5Xks2OZxHk.png?1692974392)

To view the data that has been logged from the sensor, click on the graph next to the sensor name.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/960/medium800/sensors_ETp37tyMNt.png?1692974569)

Here you can see the feed history and edit things about the feed such as the name, privacy, webhooks associated with the feed and more. If you want to learn more about how feeds work, [check out this page](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/advanced-feeds).

![](https://cdn-learn.adafruit.com/assets/assets/000/123/961/medium800/sensors_Mv2eXGYIOi.png?1692974679)

# Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter

## Downloads

## Files

- [BMP388 datasheet](https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp388-ds001.pdf)
- [BMP390 datasheet](https://cdn-learn.adafruit.com/assets/assets/000/096/781/original/bst-bmp390-fl000.pdf?1604526926)
- [BMP388 STEMMA QT Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20BMP388.fzpz)
- [BMP388 Original Version Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20BMP388%20-%20Barometric%20Pressure%20and%20Altimeter.fzpz)
- [BMP390 Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20BMP390.fzpz)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-BMP3xx-PCB)
- [3D models for BMP388 QT](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/3966%20BMP388%20QT)
- [3D models for BMP390 QT](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/4816%20BMP390%20QT)

# Schematic and Fab Print for BMP390
![](https://cdn-learn.adafruit.com/assets/assets/000/096/777/medium800/sensors_BMP390_sch.png?1604525784)

![](https://cdn-learn.adafruit.com/assets/assets/000/096/778/medium800/sensors_BMP390_fab_print.png?1604525807)

# Schematic and Fab Print for BMP388 STEMMA QT Version
![](https://cdn-learn.adafruit.com/assets/assets/000/099/712/medium800/sensors_BMP388_STEMMA_sch.png?1614107317)

![](https://cdn-learn.adafruit.com/assets/assets/000/099/711/medium800/sensors_BMP388_STEMMA_fab_print.png?1614107300)

# Schematic and Fab Print for BMP388 Original Version
![](https://cdn-learn.adafruit.com/assets/assets/000/072/608/medium800/sensors_BMP388_Sch.png?1552411092)

![](https://cdn-learn.adafruit.com/assets/assets/000/072/609/medium800/sensors_BMP388_Fab_Print.png?1552411101)

# 3D Model of BMP390
![](https://cdn-learn.adafruit.com/assets/assets/000/120/898/medium800/sensors_4816_BMP390_QT.jpg?1683649040)

# 3D Model of BMP388 QT
![](https://cdn-learn.adafruit.com/assets/assets/000/120/899/medium800/sensors_3966_BMP388_QT.jpg?1683649063)


## Primary Products

### Adafruit BMP388 - Precision Barometric Pressure and Altimeter

[Adafruit BMP388 - Precision Barometric Pressure and Altimeter](https://www.adafruit.com/product/3966)
Bosch has been a leader in barometric pressure sensors, from the [BMP085](https://www.adafruit.com/product/391). [BMP180](https://www.adafruit.com/product/1603), and [BMP280](https://www.adafruit.com/product/2651)... now we've got the next generation, the...

In Stock
[Buy Now](https://www.adafruit.com/product/3966)
[Related Guides to the Product](https://learn.adafruit.com/products/3966/guides)

## Featured Products

### Adafruit BMP390 - Precision Barometric Pressure and Altimeter

[Adafruit BMP390 - Precision Barometric Pressure and Altimeter](https://www.adafruit.com/product/4816)
Bosch has been a leader in barometric pressure sensors, from the [BMP085](https://www.adafruit.com/product/391). [BMP180](https://www.adafruit.com/product/1603), [BMP280](https://www.adafruit.com/product/2651), <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4816)
[Related Guides to the Product](https://learn.adafruit.com/products/4816/guides)
### Half Sized Premium Breadboard - 400 Tie Points

[Half Sized Premium Breadboard - 400 Tie Points](https://www.adafruit.com/product/64)
This is a cute, half-size breadboard with&nbsp;400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm&nbsp;x 5.5cm&nbsp;with a standard double-strip in the middle and two power rails on both sides.&nbsp;You can pull the power rails off easily to make the breadboard as...

Out of Stock
[Buy Now](https://www.adafruit.com/product/64)
[Related Guides to the Product](https://learn.adafruit.com/products/64/guides)
### Adafruit METRO 328 - Arduino Compatible - with Headers

[Adafruit METRO 328 - Arduino Compatible - with Headers](https://www.adafruit.com/product/2488)
This is the&nbsp; **Adafruit METRO Arduino-Compatible - with&nbsp;headers.&nbsp;** It's a fully assembled and tested microcontroller and physical computing board with through-hole headers attached.&nbsp; If you don't want a&nbsp;Metro with the headers attached for...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2488)
[Related Guides to the Product](https://learn.adafruit.com/products/2488/guides)
### Breadboarding wire bundle

[Breadboarding wire bundle](https://www.adafruit.com/product/153)
75 flexible stranded core wires with stiff ends molded on in red, orange, yellow, green, blue, brown, black and white. These are a major improvement over the "box of bent wires" that are sometimes sold with breadboards, and faster than stripping your own solid core wires. Makes...

In Stock
[Buy Now](https://www.adafruit.com/product/153)
[Related Guides to the Product](https://learn.adafruit.com/products/153/guides)
### Adafruit Feather M0 Express

[Adafruit Feather M0 Express](https://www.adafruit.com/product/3403)
At the Feather M0's heart is an ATSAMD21G18 ARM Cortex M0+ processor, clocked at 48 MHz and at 3.3V logic, the same one used in the new&nbsp;[Arduino Zero](https://www.adafruit.com/products/2843). This chip has a whopping 256K of FLASH (8x more than the Atmega328 or 32u4) and...

In Stock
[Buy Now](https://www.adafruit.com/product/3403)
[Related Guides to the Product](https://learn.adafruit.com/products/3403/guides)
### Adafruit Feather M0 Adalogger

[Adafruit Feather M0 Adalogger](https://www.adafruit.com/product/2796)
Feather is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Adafruit Feather M0 Adalogger** &nbsp;- our take on an...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2796)
[Related Guides to the Product](https://learn.adafruit.com/products/2796/guides)

## Related Guides

- [Adafruit Feather M0 Adalogger](https://learn.adafruit.com/adafruit-feather-m0-adalogger.md)
- [Adafruit Feather M0 Express](https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython.md)
- [Sensor Plotting with Mu and CircuitPython](https://learn.adafruit.com/sensor-plotting-with-mu-and-circuitpython.md)
- [LED Acrylic Sign](https://learn.adafruit.com/led-acrylic-sign.md)
- [CircuitPython Hardware: Charlieplex LED Matrix](https://learn.adafruit.com/micropython-hardware-charlieplex-led-matrix.md)
- [MP3 Feather - Gordon Cole](https://learn.adafruit.com/mp3-feather-gordon-cole.md)
- [CircuitPython Hardware: PCA9685 PWM & Servo Driver](https://learn.adafruit.com/micropython-hardware-pca9685-pwm-and-servo-driver.md)
- [MicroPython Basics: How to Load MicroPython on a Board](https://learn.adafruit.com/micropython-basics-how-to-load-micropython-on-a-board.md)
- [Kombucha Thermostat with CircuitPython and Feather ](https://learn.adafruit.com/kombucha-thermostat-with-circuitpython-and-feather.md)
- [Stand-alone programming AVRs using CircuitPython](https://learn.adafruit.com/stand-alone-programming-avrs-using-circuitpython.md)
- [¡Bienvenido a CircuitPython!](https://learn.adafruit.com/bienvenido-a-circuitpython-2.md)
- [I Vote(d) Pin](https://learn.adafruit.com/i-vote-d-pin.md)
- [CircuitPython Hardware: LED Backpacks & FeatherWings](https://learn.adafruit.com/micropython-hardware-led-backpacks-and-featherwings.md)
- [Portable Solar Charging Tracker](https://learn.adafruit.com/portable-solar-charging-tracker.md)
- [Creating and sharing a CircuitPython library](https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library.md)
- [MicroBlocks Circuit Playground Express Ornament](https://learn.adafruit.com/microblocks-circuitplayground-express-ornament.md)
