Part

Pressure and temperature, BMP280

The same sensor without the humidity: pressure, temperature, and so altitude.

See every part
  • 4 pins
  • 3 settings
  • In 1 project
  • In 1 lesson
Drawn live by the editor's own code, at the size you see it.
At a glance

The Pressure and temperature, BMP280 in brief

What it is, and every setting the properties panel gives it.

The BMP280 is the BME280 without the humidity sensor: the same Bosch die and the same purple four-pin breakout, VIN, GND, SCL and SDA, so the two are told apart by the chip id at register 0xD0, 0x58 here and 0x60 on the BME280. A sketch that needs humidity should check it. The module regulates VIN, so 3.3 or 5 V both work; SDA and SCL go to A4 and A5 on an Uno, or GPIO 21 and 22 on an ESP32. The address is 0x76 by default and 0x77 with the strap, and Adafruit_BMP280’s begin() wants it spelled out for a purple board. Mokxi models raw twenty-bit counts, the factory coefficients the driver must apply, temperature first because pressure needs its t_fine, forced and normal modes, oversampling times and the IIR filter. The temperature slider runs from -40 to 85 degrees and pressure from 300 to 1100 hPa; every 12 hPa or so less is about 100 m higher, which is what readAltitude(1013.25) turns it into. The classic mistake is the address. Noise, which oversampling and the filter exist to beat, and SPI mode are not modeled.

Family
Sensors
Pins
4
address
118
temperature
22
pressure
1013.25
Pins

4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
VIN
Supply. The module has its own regulator, so 3.3 V or 5 V.
GND
Ground.
SCL
I2C clock. The module carries the pull-ups.
SDA
I2C data.
How to use it

How to use the BMP280 barometer with an Arduino

In the rocket flight computer the BMP280 shares the Uno’s I2C bus with an MPU6050: VIN and GND go to the 5 V and ground rails, and SCL and SDA reach A5 and A4 through two columns of the breadboard. The barometer is at 0x76 and the IMU at 0x68, so the same two wires serve both.

baro.begin(0x76) is the line that matters. Adafruit_BMP280 looks at 0x77 unless told, and checks for chip id 0x58; a BME280 answers 0x60, so begin(0x76, 0x60) reads one of those as a barometer. The sketch then sets normal mode with 16x pressure oversampling and reads readAltitude(1013.25), the height above standard sea-level pressure. To fly it, hold ARM and drag the pressure slider down about 2 hPa, roughly 17 m of climb, and back up.

Part pin
Board pin
VIN
5 V
GND
GND
SCL
A5 (shared with the MPU6050)
SDA
A4 (shared with the MPU6050)

The module regulates VIN, so on an ESP32 it runs from 3.3 V with SDA on GPIO 21 and SCL on 22, and the library calls are the same.

Arduino Uno: rocket flight computerlive0.000 s 0.00x
Hold the button
This is the simulator itself, running here. Click anything to open it in the editor.
The barometer’s setup, from the flight computer
#include <Wire.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 baro;
bool haveBaro = false;
long baroCm() {
  return (long)(baro.readAltitude(1013.25) * 100);
}
void setup() {
  Serial.begin(9600);
  haveBaro = baro.begin(0x76);
  if (haveBaro) {
    baro.setSampling(Adafruit_BMP280::MODE_NORMAL, Adafruit_BMP280::SAMPLING_X2,
                     Adafruit_BMP280::SAMPLING_X16, Adafruit_BMP280::FILTER_OFF,
                     Adafruit_BMP280::STANDBY_MS_1);
  }
}
How it is modeled

What is true about the Pressure and temperature, BMP280, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

The register map and the reset values: asleep at power-up, data registers at 0x80000 and 0x8000 until something is measured, im_update set for the 2 ms the chip spends copying its coefficients. Forced mode takes one measurement and goes back to sleep; normal mode measures, waits the standby time, and repeats. A measurement takes the datasheet's typical time, from 8 ms at 1x oversampling to 113 ms at 16x, with measuring set while it runs.

ctrl_hum only takes effect at the next write to ctrl_meas, and humidity oversampling left at 0 means no humidity at all: the register reads its reset value. Both are straight from the datasheet and both catch people.

Resolution follows oversampling, 16 bits at 1x up to 20 at 16x, and the IIR filter blends each result into the last, so a slider moved with the filter on is followed smoothly rather than in a jump.

Not modeled

Noise. A real reading wanders by a few pascals and a few hundredths of a degree, which is what oversampling and the filter are for; here more samples change only the time and the number of bits. The drivers use Bosch's 32-bit pressure formula, since the smaller boards have no 64-bit multiply, and it reads a few pascals off the 64-bit one. SPI mode, and so CSB and SDO as pins, are not modeled: this is the I2C module. The humidity sensor's slow response to a change in the air is not modeled.

From BME280 and BMP280 pressure sensors, in full.

Projects

See the Pressure and temperature, BMP280 in a project

One built-in project uses it. It opens in the editor, already wired.

Lessons

Where it turns up in a lesson

One lesson places it in its own circuit.

Boards

The boards it is shown on

This board has a built-in project with the Pressure and temperature, BMP280 in it.

Boards

The Pressure and temperature, BMP280 on each board

The pins, the voltage and the code change from board to board. Each page has that board’s wiring and a circuit you can run.

Libraries

Arduino libraries for the Pressure and temperature, BMP280

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the Pressure and temperature, BMP280

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.