BMP280 Environment sensor

This module reads values from Bosch Sensortec's BMP280 sensor. Use the BMP280 module for it.

Note: This module is specifically for BMP280 so doesn't include humidity readings. If you need these, use the BME280 module.

Wiring

You can wire this up as follows:

Device Pin Espruino
1 (GND) GND
8 (VCore) 3.3
3 (SDI) B9(I2C1 SDA)
4 (SCK) B8(I2C1 SCL)
2(CSB) 3.3
5(SDO) GND
6(Vio) 3.3

Don't forget to pull-up both of the I2C pins with 10k resistors.

Software

Simple SPI

var spi = new SPI();
spi.setup({miso : ..., mosi : ..., sck: ...});
var bme = require("BMP280").connectSPI(spi, cs_pin);
console.log(bme.getData());
// prints { "temp": 23.70573815741, "pressure": 1017.27733597036 }

Simple I2C

I2C1.setup({scl:B8,sda:B9});
var bme = require("BMP280").connect(I2C1);;
console.log(bme.getData());
// prints { "temp": 23.70573815741, "pressure": 1017.27733597036 }

Manual usage

Sometimes you might want to read the raw data in separately, in which case you can do:

  I2C1.setup({scl:B8,sda:B9});
  var bme = require("BMP280").connect(I2C1);
  bme.readRawData();
  var temp_cal = bme.calibration_T(bme.temp_raw);
  var press_cal = bme.calibration_P(bme.pres_raw);
  var temp_act = temp_cal / 100.0;
  var press_act = press_cal / 100.0;

  console.log("Pressure: " + press_act + " hPa");
  console.log("Temperature: " + temp_act + " C");

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.