Family of atmospheric sensors


bmxx80 provides support for a popular sensor family from Bosch:

  • BMP180 and BMP280, temperature and pressure
  • BME280, temperature, pressure and relative humidity

BMP180 can be used over I²C. BME280 and BMP280 can use either I²C or SPI.

They all provide low precision temperature measurement.



The driver as the following functionality:

  • Fast integer only calculation
  • Support for both I²C and SPI (BMx280 only) connectivity


Use cmd/bmxx80 to retrieve measurement from the device.

Learn more


Purpose: gather temperature, pressure and relative humidity (BME280 only).

This example uses either a BME280 or BMP280 connected via I²C.

package main

import (


func main() {
    // Load all the drivers:
    if _, err := host.Init(); err != nil {

    // Open a handle to the first available I²C bus:
    bus, err := i2creg.Open("")
    if err != nil {
    defer bus.Close()

    // Open a handle to a bme280/bmp280 connected on the I²C bus using default
    // settings:
    dev, err := bmxx80.NewI2C(bus, 0x76, &bmxx80.DefaultOpts)
    if err != nil {
    defer dev.Halt()

    // Read temperature from the sensor:
    var env physic.Env
    if err = dev.Sense(&env); err != nil {
    fmt.Printf("%8s %10s %9s\n", env.Temperature, env.Pressure, env.Humidity)

Smoke test

Setup for BME280/BMP280 smoke test:

  • Two BME280 or BMP280 connected to a Raspberry Pi 3:
    • the top one is connected via I²C
    • the bottom one is connected via SPI:


It confirms that two BME280/BMP280 sensors can be driven simultaneously, one connected via I²C, one via SPI. They shall measure mostly the same atmospheric properties.


These links are for the BME280:

The periph authors do not endorse any specific seller. These are only provided for your convenience.