4 releases (2 breaking)
0.3.0 | May 11, 2024 |
---|---|
0.2.0 | Jan 30, 2024 |
0.1.1 | Jan 30, 2024 |
0.1.0 | Mar 27, 2022 |
#484 in Hardware support
659 downloads per month
24KB
388 lines
ina226
Rust embedded-hal
driver for the Texas Instruments INA226.
License
Rand is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.
lib.rs
:
This is a platform agnostic Rust driver for the INA226
, an I2C output
current/voltage/power monitor with alerts, using the embedded-hal
traits.
This driver allows you to:
- Callibrate the device. See
callibrate()
. - Read the shunt voltage. See
shunt_voltage_microvolts()
. - Read the bus voltage. See
bus_voltage_millivolts()
. - Read the current. See
current_amps()
. - Read the power. See
power_watts()
.
The device
The INA226 is a current shunt and power monitor with an I2C™- or SMBUS-compatible interface. The device monitors both a shunt voltage drop and bus supply voltage. Programmable calibration value, conversion times, and averaging, combined with an internal multiplier, enable direct readouts of current in amperes and power in watts.
The INA226 senses current on common-mode bus voltages that can vary from 0 V to 36 V, independent of the supply voltage. The device operates from a single 2.7-V to 5.5-V supply, drawing a typical of 330 µA of supply current. The device is specified over the operating temperature range between –40°C and 125°C and features up to 16 programmable addresses on the I2C-compatible interface.
Datasheet:
Dependencies
~2MB
~44K SLoC