Skip to content

idenisovs/yet-another-bmp280

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yet another BMP280.

Yet another Bosch Sensortect BMP280 sensor library for Node.js

This library uses i2c-bus which should provide access with Node.js on Linux boards like the Raspberry Pi, BeagleBone or Intel Edison.

This library is heavily inspired by Ptax's BMP 280 sensor library.

Install

npm install @idenisovs/bmp280 --save

Usage

Simple

In this case you need to provide just bus number and address of the device.

  • Device address can be found by i2cdetect -y 1 command, where 1 is number of I2C bus.
const { BMP280 } = require('@idenisovs/bmp280');

(async () => {
    const bmp280 = new BMP280({
        bus: 1,
        address: 0x76
    });

    await bmp280.connect();

    const values = await bmp280.sensors();
    console.log(values);

    await bmp280.disconnect();
})();

Expected output:

{ 
  "temperature": 22.81, 
  "pressure": 991.9874688444662 
}

If configuration is not provided, then library will use the configuration options from official datasheet, page 19 ("Weather station" use case):

{
    mode: Mode.forced,
    filter: Filter.off,
    standby: Standby.SB_1000MS,
    oversampling: {
        temperature: Oversampling.x1,
        pressure: Oversampling.x1
    }
}

About

Yet another BMP280 sensor library for Node.js

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published