Fork me on GitHub

Project Notes

#826 BMP280 Module

Examine the BMP280 barometric pressure and temperature sensor. Demonstrate its functionality with a common GY-BMP280-3.3 module and an Arduino Mini with 128x32 OLED display operating at 3.3V.

Build

Here’s a quick demo..

clip

Notes

I purchased a BMP280 sensor module “GY-68 BMP180 BMP280 Digital Barometric Pressure Sensor Module for arduino” (aliexpress seller listing) for SG$0.82 (Jun-2020).

In this little project, I’ll test the module with an Arduino sketch, with readings streamed to the serial port as well as shown on an OLED display.

Note: the BMP280 superseded the BMP180, improving resolution and offering SPI in addition to the I²C interface. See LEAP#827 BMP180 Module for a demonstration of the BMP180.

About the BMP280

BMP280 is an absolute barometric pressure sensor especially designed for mobile applications. The sensor module is housed in an extremely compact package. Its small dimensions and its low power consumption allow for the implementation in battery driven devices such as mobile phones, GPS modules or watches.

As its predecessor BMP180, the BMP280 is based on Bosch’s proven piezo-resistive pressure sensor technology featuring high accuracy and linearity as well as long term stability and high EMC robustness.

Numerous device operation options offer highest flexibility to optimize the device regarding power consumption, resolution and filter performance. A tested set of default settings for example use case is provided to the developer in order to make design-in as easy as possible.

bmp280-ref

Absolute maximum ratings

  • Voltage at any supply pin (VDD): -0.3 to 4.25V
  • Voltage at any interface pin: -0.3 to VDD + 0.3V
  • Storage Temperature: -45 to +85°C
  • Pressure: 0 to 20 000 hPa

Specifications:

  • Sensor Supply Voltage: 1.71 - 3.6V DC
  • Interface Supply Voltage: 1.2 - 3.6V DC
  • Interface: I²C (up to 3.4MHz), SPI (up to 10 MHz)
  • Resolution:
    • Temperature: 0.01 °C
    • Pressure: 0.0016 hPa
  • Accuracy:
    • Temperature: +-0.5 °C
    • Pressure: +-1 hPa
  • I²C address:
    • SDO LOW : 0x76
    • SDO HIGH: 0x77
  • Interface selection:
    • CSB LOW : SPI
    • CSB HIGH (VDDIO): I²C

About the GY-BMP280-3.3 Module

Some modules are designed for 3.3V or 5V operation, but the module I have exposes the BMP280 directly and therefore must be used within the BMP280’s voltage limits (4.25V max).

Module specifications:

  • GY-BMP280 module high-precision atmospheric pressure sensor module altimeter sensor 3.3V
  • Module model: GY-BMP280-3.3
  • Use chip: BMP280
  • Power supply: 3V
  • Communication method: standard IIC/SPI communication protocol
  • Air pressure range: 300-1100hPa
  • Using Immersion Gold PCB, machine welding process to ensure quality
  • Pin spacing: 2.54mm
  • Module size: 11.5mm*15mm

The module simplifies power management by tieing VDD and VDDIO together - the same power supply is used for both. The module is also fitted with four 10kΩ resistors and two capacitors that minimise the number of external components required:

  • C1 and C2 decoupling capacitors for VDD and VDDIO
  • a 10kΩ resistor pulls SDO to ground, pre-selecting I²C address 0x76
  • a 10kΩ resistor pulls CSB high, pre-selecting the I²C interface
  • 10kΩ resistor pull SDA and SCL lines high, eliminating the need for external pull-up resistors on the communication lines

module

Here’s a quick sketch of how the components on the breakout board are connected:

module-internals

Arduino Test Circuit Design

Since my module is 3.3V only, I’m going to test this with an Arduino Mini running at 3.3V rather than mess around with level shifters. Note:

  • I²C interface is selected by default (module built-in pull-up)
  • I²C address 0x76 is selected by default (module built-in pull-down)
  • pull-up resistors are not required on the I²C lines as they are built-in to the module
  • 0.91” 128x32 white OLED LCD display module with SSD1306 Driver is attached to I²C for the display of readings

Designed with Fritzing: see Module.fzz.

bb

schematic

Connected on a breadboard with USB-Serial adapter for programming:

bb_build

The Sketch

See Module.ino for the test sketch. It uses the following libraries:

Sketch behaviour:

  • during setup:
    • initialises the BMP280, OLED screen, and built-in LED
    • displays a splash screen on the OLED
  • each loop:
    • turns on the built-in LED during sampling
    • samples readings and calculates altitude
    • updates OLED display
    • streams sample to serial port

Calculating the approximate altitude requires the current sea level pressure for one’s locale to be configured. I’m using an estimate from https://tides4fishing.com/sg/singapore/singapore/forecast/atmospheric-pressure that is typically 1010-1015 hPa. Hard-coding this is obviously not very convenient - a live feed of the actual value would be ideal!

Test Results

Connecting to the serial console using screen (e.g. screen /dev/cu.wchusbserial2420 115200) I can following the readings:

console

And following along with the readings on the display.

test

Switching over to power-only (no serial/USB), I’ve attached 3.3V from a power supply so the module can be run stand-along (not connected to a computer)

test-power-only-splash

test-power-only

Credits and References

About LEAP#826 BMP280SensorsArduinoOLEDI2C

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics projects - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader