INA219 DC Current Sensor

See Application::make_ina219().

API Reference

class INA219Component : public PollingComponent, public I2CDevice

Public Functions

INA219Component(I2CComponent *parent, float shunt_resistance_ohm, float max_current_a, float max_voltage_v, uint8_t address = 0x40, uint32_t update_interval = 15000)
void setup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing nothing.

void dump_config()
float get_setup_priority() const

priority of setup().

higher -> executed earlier

Defaults to 0.

The setup priority of this component

void update()
INA219VoltageSensor *make_bus_voltage_sensor(const std::string &name)
INA219VoltageSensor *make_shunt_voltage_sensor(const std::string &name)
INA219CurrentSensor *make_current_sensor(const std::string &name)
INA219PowerSensor *make_power_sensor(const std::string &name)

Protected Attributes

float shunt_resistance_ohm_
float max_current_a_
float max_voltage_v_
uint32_t calibration_lsb_
INA219VoltageSensor *bus_voltage_sensor_ = {nullptr}
INA219VoltageSensor *shunt_voltage_sensor_ = {nullptr}
INA219CurrentSensor *current_sensor_ = {nullptr}
INA219PowerSensor *power_sensor_ = {nullptr}
using sensor::INA219VoltageSensor = typedef EmptyPollingParentSensor<2, ICON_FLASH, UNIT_V>
using sensor::INA219CurrentSensor = typedef EmptyPollingParentSensor<3, ICON_FLASH, UNIT_A>
using sensor::INA219PowerSensor = typedef EmptyPollingParentSensor<2, ICON_FLASH, UNIT_W>