ina219 0.6.1

Node.js INA219 driver for Adafruit INA219 High Side DC Current Sensor

Homepage: https://github.com/brettmarl/node-ina219

Platform: npm

Language: JavaScript

License: MIT

Keywords: raspberry, pi, adafruit, voltage, current, monitor, ina219, i2c-bus, i2c

View on registry: https://www.npmjs.com/package/ina219

Direct download link: https://registry.npmjs.org/ina219/-/ina219-0.6.1.tgz

Install: npm install [email protected]


node-ina219

Node.js Driver for Adafruit INA219

Install

$ npm install ina219

Usage

  var ina219 = require('ina219');

  ina219.init();
  ina219.enableLogging(true);

  ina219.calibrate32V1A(function () {

    ina219.getBusVoltage_V(function (volts) {

      console.log("Voltage: " + volts);
      ina219.getCurrent_mA(function (current){

        console.log("Current (mA): " + current );
      });   
    });
  });

Classes

Ina219

Typedefs

onCompleteCallback : function

Callback for standard oncomplete

onHaveValueCallback : function

Callback for returning a single value

Ina219

Kind: global class

new Ina219()

Ina219 is the main class exported from the Node module

ina219.init(address, device)

Called to initilize the INA219 board, you should calibrate it after this.

Kind: instance method of Ina219

Param Type Description
address string Address you want to use. Defaults to INA219_ADDRESS
device string Device to connect to. Defaults to "/dev/i2c-1"

ina219.enableLogging(enable)

Enabled debug logging to console.log

Kind: instance method of Ina219

Param Type Description
enable bool True to enable, False to disable

ina219.writeRegister(register, value, callback)

Reads a 16 bit value over I2C

Kind: instance method of Ina219

Param Type Description
register integer Register to read from (One of INA219_REG_*)
value integer Value to be written
callback writeRegisterCallback Callback to be invoked when complete

ina219.readRegister(register, callback)

Reads a 16 bit value over I2C

Kind: instance method of Ina219

Param Type Description
register integer Register to read from (One of INA219_REG_*)
callback onHaveValueCallback Callback to be invoked when complete

ina219.calibrate32V1A(callback)

Configures to INA219 to be able to measure up to 32V and 1A of current. Each unit of current corresponds to 40uA, and each unit of power corresponds to 800mW. Counter overflow occurs at 1.3A. Note: These calculations assume a 0.1 ohm resistor is present

Kind: instance method of Ina219

Param Type Description
callback onCompleteCallback Callback to be invoked when complete

ina219.log(s)

Logs a string to the console if logging enabled

Kind: instance method of Ina219

Param Type Description
s string String to log

ina219.getBusVoltage_raw(callback)

Reads the raw bus voltage

Kind: instance method of Ina219

Param Type Description
callback onHaveValueCallback Callback to be invoked when complete.

ina219.getShuntVoltage_raw(callback)

Reads the raw shunt voltage

Kind: instance method of Ina219

Param Type Description
callback onHaveValueCallback Callback to be invoked when complete.

ina219.getCurrent_raw(callback)

Reads the raw current value

Kind: instance method of Ina219

Param Type Description
callback onHaveValueCallback Callback to be invoked when complete.

ina219.getBusVoltage_V(callback)

Gets the bus voltage in volts

Kind: instance method of Ina219

Param Type Description
callback onHaveValueCallback Callback to be invoked when complete.

ina219.getShuntVoltage_mV(callback)

Gets the shunt voltage in mV (so +-327mV)

Kind: instance method of Ina219

Param Type Description
callback onHaveValueCallback Callback to be invoked when complete.

ina219.getCurrent_mA(callback)

Gets the current value in mA, taking into account the config settings and current LSB

Kind: instance method of Ina219

Param Type Description
callback onHaveValueCallback Callback to be invoked when complete.

onCompleteCallback : function

Callback for standard oncomplete

Kind: global typedef

onHaveValueCallback : function

Callback for returning a single value

Kind: global typedef

Param Type Description
value int value returned by async operation

Dependencies Requirements Latest Stable Latest Release Licenses
i2c-bus ^1.1.1 1.2.1 1.2.1 MIT
Explore the resolved dependency tree for ina219 0.6.1

Releases

  • 0.6.1 - July 29, 2016 01:53
  • 0.6.0 - November 19, 2015 03:25
  • 0.5.0 - November 19, 2015 03:22
  • 0.3.0 - November 12, 2015 06:59
  • 0.2.0 - November 12, 2015 05:50
  • 0.1.0 - November 12, 2015 05:33

Project Statistics

SourceRank 7
Dependencies 1
Dependent projects 1
Dependent repositories 1
Total releases 6
Latest release
First release
Stars 0
Forks 0
Watchers 1
Contributors 1
Repo Size: 13.7 KB

Top Contributors See all

Brett Marl

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2016-10-13 12:11:05 UTC

Login to resync this project