Espruino module for BME280

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

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

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

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

To save space, debugging is now turned off on this module. To enable debugging, make a local copy of the module, uncomment lines where indicated, and connect like so:

  var bme = require("BME280").connect(I2C1, {debug:true});

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