Adafruit INA219 Arduino Library
Public Member Functions | List of all members
Adafruit_INA219 Class Reference

Class that stores state and functions for interacting with INA219 current/power monitor IC. More...

#include <Adafruit_INA219.h>

Public Member Functions

 Adafruit_INA219 (uint8_t addr=INA219_ADDRESS)
 Instantiates a new INA219 class. More...
 
void begin (TwoWire *theWire=&Wire)
 Setups the HW (defaults to 32V and 2A for calibration values) More...
 
void setCalibration_32V_2A ()
 Configures to INA219 to be able to measure up to 32V and 2A of current. Each unit of current corresponds to 100uA, and each unit of power corresponds to 2mW. Counter overflow occurs at 3.2A. More...
 
void setCalibration_32V_1A ()
 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 800�W. Counter overflow occurs at 1.3A. More...
 
void setCalibration_16V_400mA ()
 set device to alibration which uses the highest precision for current measurement (0.1mA), at the expense of only supporting 16V at 400mA max.
 
float getBusVoltage_V ()
 Gets the shunt voltage in volts. More...
 
float getShuntVoltage_mV ()
 Gets the shunt voltage in mV (so +-327mV) More...
 
float getCurrent_mA ()
 Gets the current value in mA, taking into account the config settings and current LSB. More...
 
float getPower_mW ()
 Gets the power value in mW, taking into account the config settings and current LSB. More...
 
void powerSave (bool on)
 Set power save mode according to parameters. More...
 

Detailed Description

Class that stores state and functions for interacting with INA219 current/power monitor IC.

Constructor & Destructor Documentation

◆ Adafruit_INA219()

Adafruit_INA219::Adafruit_INA219 ( uint8_t  addr = INA219_ADDRESS)

Instantiates a new INA219 class.

Parameters
addrthe I2C address the device can be found on. Default is 0x40

Member Function Documentation

◆ begin()

void Adafruit_INA219::begin ( TwoWire *  theWire = &Wire)

Setups the HW (defaults to 32V and 2A for calibration values)

Parameters
theWirethe TwoWire object to use

◆ setCalibration_32V_2A()

void Adafruit_INA219::setCalibration_32V_2A ( )

Configures to INA219 to be able to measure up to 32V and 2A of current. Each unit of current corresponds to 100uA, and each unit of power corresponds to 2mW. Counter overflow occurs at 3.2A.

Note
These calculations assume a 0.1 ohm resistor is present

◆ setCalibration_32V_1A()

void Adafruit_INA219::setCalibration_32V_1A ( )

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 800�W. Counter overflow occurs at 1.3A.

Note
These calculations assume a 0.1 ohm resistor is present

◆ getBusVoltage_V()

float Adafruit_INA219::getBusVoltage_V ( )

Gets the shunt voltage in volts.

Returns
the bus voltage converted to volts

◆ getShuntVoltage_mV()

float Adafruit_INA219::getShuntVoltage_mV ( )

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

Returns
the shunt voltage converted to millivolts

◆ getCurrent_mA()

float Adafruit_INA219::getCurrent_mA ( )

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

Returns
the current reading convereted to milliamps

◆ getPower_mW()

float Adafruit_INA219::getPower_mW ( )

Gets the power value in mW, taking into account the config settings and current LSB.

Returns
power reading converted to milliwatts

◆ powerSave()

void Adafruit_INA219::powerSave ( bool  on)

Set power save mode according to parameters.

Parameters
onboolean value

The documentation for this class was generated from the following files: