Beam Bots Logo

bb_sensor_ina219

CILicense: Apache 2.0Hex version badgeHexdocs badgeREUSE statusAsk DeepWiki

Beam Bots integration for the INA219 voltage / current / power monitor over I2C.

Polls the chip at a configurable rate and publishes BB.Message.Sensor.PowerState messages with bus voltage (V), current (A), power (W), and shunt voltage (V).

Usage

defmodule MyRobot do
use BB
topology do
link :chassis do
sensor :main_bus, {BB.Sensor.INA219,
bus: "i2c-1",
address: 0x40,
calibration: :calibrate_32V_2A,
publish_rate: ~u(10 hertz)
}
end
end
end

Subscribe to readings:

BB.subscribe(MyRobot, [:sensor, :chassis, :main_bus])

See BB.Sensor.INA219 for full options.

Options

OptionDefaultDescription
busrequiredI2C bus name (e.g. "i2c-1")
address0x40I2C address
calibration:calibrate_32V_2AOne of three INA219 presets (see below)
publish_rate~u(1 hertz)Polling / publish rate

Calibration presets (all assume a 0.1Ω shunt — Adafruit breakout):