Skip to content

An Node.js module to interface a BMP085 temperature and pressure sensor with the Raspberry Pi

License

Notifications You must be signed in to change notification settings

dbridges/bmp085-sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 }
  });                                                                                                                                                                                                                                                                          
});

Resources

About

An Node.js module to interface a BMP085 temperature and pressure sensor with the Raspberry Pi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published