Erriez I2C/SMB DC Voltage/Current/Power sensor library for Arduino  1.0.0
This is an I2C/SMB DC Voltage/Current/Power sensor library for Arduino
Classes | Macros
ErriezINA219.h File Reference

INA219 voltage and current sensor library for Arduino. More...

#include <stdint.h>
Include dependency graph for ErriezINA219.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  INA219
 INA219 class. More...
 

Macros

#define INA219_I2C_ADDRESS   0x40
 Default I2C address.
 
#define INA219_SHUNT_RESISTOR   0.1
 Default shunt resistor in Ohm.
 
#define INA219_REG_CONFIG   0x00
 Config register.
 
#define INA219_REG_SHUNTVOLTAGE   0x01
 Shunt/voltage register.
 
#define INA219_REG_BUSVOLTAGE   0x02
 Bus voltage register.
 
#define INA219_REG_POWER   0x03
 Power register.
 
#define INA219_REG_CURRENT   0x04
 Current register.
 
#define INA219_REG_CALIBRATION   0x05
 Calibration register.
 
#define INA219_CONFIG_RST   15
 Reset.
 
#define INA219_CONFIG_BRNG   13
 Bus voltage range.
 
#define INA219_CONFIG_BRNG_16V   (0 << 13)
 Bus voltage range 16V.
 
#define INA219_CONFIG_BRNG_32V   (1 << 13)
 Bus voltage range 32V.
 
#define INA219_CONFIG_GAIN_MASK   (3 << 12)
 PGA Gain and Range.
 
#define INA219_CONFIG_GAIN_1   (0 << 12)
 ±40 mV.
 
#define INA219_CONFIG_GAIN_2   (1 << 12)
 ±80 mV.
 
#define INA219_CONFIG_GAIN_4   (2 << 12)
 ±160 mV.
 
#define INA219_CONFIG_GAIN_8   (3 << 12)
 ±320 mV.
 
#define INA219_CONFIG_BADC_MASK   0x0780
 Bus ADC Resolution/Averaging.
 
#define INA219_CONFIG_BADC(adc)   ((adc & INA219_CONFIG_BADC_MASK) << 7)
 Bus ADC mask and shift.
 
#define INA219_CONFIG_SADC_MASK   0x0078
 Shunt ADC Resolution/Averaging.
 
#define INA219_CONFIG_SADC(adc)   ((adc & INA219_CONFIG_BADC_MASK) << 3)
 Shunt ADC mask and shift.
 
#define INA219_CONFIG_xADC_9B   0
 9 bit
 
#define INA219_CONFIG_xADC_10B   1
 10 bit
 
#define INA219_CONFIG_xADC_11B   2
 11 bit
 
#define INA219_CONFIG_xADC_12B   3
 12 bit
 
#define INA219_CONFIG_xADC_2S   9
 2 samples
 
#define INA219_CONFIG_xADC_4S   10
 4 samples
 
#define INA219_CONFIG_xADC_8S   11
 8 samples
 
#define INA219_CONFIG_xADC_16S   12
 16 samples
 
#define INA219_CONFIG_xADC_32S   13
 32 samples
 
#define INA219_CONFIG_xADC_64S   14
 64 samples
 
#define INA219_CONFIG_xADC_128S   15
 128 samples
 
#define INA219_CONFIG_MODE_MASK   0x0007
 Operating Mode.
 
#define INA219_CONFIG_MODE(mode)   ((mode & INA219_CONFIG_MODE_MASK) << 0)
 Config mode mask and shift.
 
#define INA219_CONFIG_MODE_POWER_DOWN   0
 Power-Down.
 
#define INA219_CONFIG_MODE_SHUNT_TRG   1
 Shunt voltage, triggered.
 
#define INA219_CONFIG_MODE_BUS_TRG   2
 Bus voltage, triggered.
 
#define INA219_CONFIG_MODE_SHUNT_BUS_TRG   3
 Shunt and bus voltage, triggered.
 
#define INA219_CONFIG_MODE_ADC_OFF   4
 ADC off (disabled)
 
#define INA219_CONFIG_MODE_SHUNT_CNT   5
 Shunt voltage, continuous.
 
#define INA219_CONFIG_MODE_BUS_CNT   6
 Bus voltage, continuous.
 
#define INA219_CONFIG_MODE_SHUNT_BUS_CNT   7
 Shunt and bus voltage, continuous.
 
#define REG_CONFIG_VALUE   0x399F
 Default config register value. More...
 

Detailed Description

INA219 voltage and current sensor library for Arduino.

Source: https://github.com/Erriez/ErriezINA219 Documentation: https://erriez.github.io/ErriezINA219

Definition in file ErriezINA219.h.

Macro Definition Documentation

◆ REG_CONFIG_VALUE

#define REG_CONFIG_VALUE   0x399F

Default config register value.

Shunt and bus: BADC: +/-320 mV Continuous conversion 532 us conversion time

Definition at line 100 of file ErriezINA219.h.