🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@abandonware/bmp085-sensor

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abandonware/bmp085-sensor

A module to interface a BMP085 temperature and pressure sensor to the raspberry pi.

0.0.6-2
latest
Source
npm
Version published
Maintainers
2
Created
Source

BMP085.js

Access a BMP085 temperature & barometric pressure sensor from your Raspberry Pi using Node.js.

NPM

Install

$ npm install bmp085-sensor

Usage

With no units specified, returns inHg and degree F.

var bmp085 = require('bmp085-sensor');

var sensor = bmp085({address: 0x77,
                     mode: 3});

sensor.calibrate(function (err, data) {                                                                                                                                                                                                                                        
  if(err || !data) {                                                                                                                                                                                                                                                           
     throw err;                                                                                                                                                                                                                                                                
  }                                                                                                                                                                                                                                                                            
  console.log(data);                                                                                                                                                                                                                                                           
  sensor.read(function (err, data) {                                                                                                                                                                                                                                           
    if(err || !data) {                                                                                                                                                                                                                                                         
      throw err;                                                                                                                                                                                                                                                               
    }                                                                                                                                                                                                                                                                          
    // data is { pressure: 29.957463223223005, temp: 68.9 }
  });                                                                                                                                                                                                                                                                          
});

You can also specify metric units, returning Pa and degree C:

var bmp085 = require('bmp085-sensor');

var sensor = bmp085({address: 0x77,
                     mode: 3,
                     units: 'metric'});

sensor.calibrate(function (err, data) {                                                                                                                                                                                                                                        
  if(err || !data) {                                                                                                                                                                                                                                                           
     throw err;                                                                                                                                                                                                                                                                
  }                                                                                                                                                                                                                                                                            
  console.log(data);                                                                                                                                                                                                                                                           
  sensor.read(function (err, data) {                                                                                                                                                                                                                                           
    if(err || !data) {                                                                                                                                                                                                                                                         
      throw err;                                                                                                                                                                                                                                                               
    }                                                                                                                                                                                                                                                                          
    // data is { pressure: 101435.97, temp: 20.5 }
  });                                                                                                                                                                                                                                                                          
});

Using alt runtime IoT.js

make runtime=iotjs
# iotjs test.js 
# ...
#   "temperature": 32.3
#   "pressure": 100855.38749926083,
# ...

Resources

Keywords

bmp085

FAQs

Package last updated on 13 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts