Arduino driver for the Texas Instruments INA745A-Q1 / INA745B-Q1 — a 40 V,
16-bit precision I²C digital power monitor with an integrated 800 µΩ EZShunt™.
Because the shunt is on-die, the device ships fully calibrated and no
SHUNT_CAL programming is needed.
Datasheet: INA745A-Q1 (SBOSAK9A, May 2025, revised October 2025).
- Reads bus voltage, current, power, die temperature, energy (40-bit) and charge (40-bit signed) over I²C.
- Configurable operating mode (continuous / triggered / shutdown), per-input ADC conversion time (50 µs … 4.12 ms) and sample averaging (1 … 1024).
- ALERT pin support: over/under current, bus over/under voltage, over-temperature, over-power, and conversion-ready, with latch and polarity options.
- All measurements available in engineering units (V, A, W, °C, J, C) or as raw register values.
- Connection check via the
MANUFACTURER_IDregister (0x5449="TI").
| Part | Variant | Address pins (A1, A0) |
|---|---|---|
| INA745A-Q1 | A | 16 selectable addresses, 0x40 … 0x4F |
| INA745B-Q1 | B | 16 selectable addresses, 0x40 … 0x4F |
The 800 µΩ integrated shunt sets the fixed full-scale range to ±39.32 A with a 1.2 mA/LSB current resolution. Bus voltage range is 0 – 40 V at 3.125 mV/LSB.
Either install from the built-in Library Manager (search INA745) or:
- Download the repository as a ZIP.
Sketch→Include Library→Add .ZIP Library….- Select the downloaded ZIP.
Add to your platformio.ini:
lib_deps = https://github.com/jegjessing/INA745.git#include <Wire.h>
#include <INA745.h>
INA745 ina;
void setup() {
Serial.begin(115200);
Wire.begin();
if (!ina.begin(INA745_ADDR_DEFAULT)) { // 0x40 with A1=A0=GND
Serial.println("INA745 not found");
while (true) {}
}
ina.setAveraging(INA745_AVG_64); // smoother readings
}
void loop() {
Serial.print("Vbus="); Serial.print(ina.busVoltage(), 3); // V
Serial.print(" I="); Serial.print(ina.current() * 1000, 2); // mA
Serial.print(" P="); Serial.print(ina.power(), 3); // W
Serial.print(" T="); Serial.print(ina.dieTemperature(), 1); // °C
Serial.println();
delay(500);
}| Sketch | Purpose |
|---|---|
BasicMeasurement |
Continuous-conversion loop printing V/I/P/T. |
TriggeredSingleShot |
Wakes the device once per period, polls CNVRF, reads, returns to shutdown. |
AlertOnOvercurrent |
Latched over-current alert on the ALERT pin via an interrupt. |
| Method | Description |
|---|---|
INA745() |
Constructor. Uses Wire and address 0x40 until begin() overrides them. |
bool begin(uint8_t address = 0x40, TwoWire *wire = &Wire) |
Verifies the device by reading MANUFACTURER_ID. Returns true if 0x5449 is read. |
bool reset() |
Soft-reset (sets CONFIG.RST). |
bool resetAccumulators() |
Clears the ENERGY and CHARGE registers (sets CONFIG.RSTACC). |
| Method | Notes |
|---|---|
setMode(INA745_Mode) |
Continuous / triggered combinations or shutdown. |
setBusConvTime(INA745_ConvTime) |
50 µs … 4120 µs (default 1052 µs). |
setShuntConvTime(INA745_ConvTime) |
Current conversion time = shunt + temp. |
setTempConvTime(INA745_ConvTime) |
As above. |
setAveraging(INA745_Avg) |
1, 4, 16, 64, 128, 256, 512, 1024. |
setConvDelay(uint8_t steps2ms) |
0 … 510 ms initial delay before first conversion. |
| Method | Unit | Notes |
|---|---|---|
float busVoltage() |
V | 0 … 40 V, 3.125 mV/LSB. |
float current() |
A | Signed, 1.2 mA/LSB. |
float power() |
W | 240 µW/LSB, unsigned. |
float dieTemperature() |
°C | 125 m°C/LSB, signed (12-bit). |
double energy() |
J | 3.84 mJ/LSB, 40-bit unsigned. |
double charge() |
C | 75 µC/LSB, 40-bit signed. |
Raw counterparts are also exposed: busVoltageRaw(), currentRaw(),
powerRaw() (24-bit), dieTemperatureRaw() (sign-extended from 12-bit),
energyRaw() (40-bit), chargeRaw() (40-bit signed).
Each takes a value in the same engineering unit as the matching measurement
and writes the corresponding limit register (COL, CUL, BOVL, BUVL,
TEMP_LIMIT, PWR_LIMIT):
ina.setCurrentOverLimit(2.5f); // amperes
ina.setCurrentUnderLimit(-0.5f);
ina.setBusOverVoltage(28.0f); // volts (>= 0)
ina.setBusUnderVoltage(10.0f);
ina.setTemperatureOverLimit(85.0f); // °C
ina.setPowerOverLimit(50.0f); // watts (61.44 mW/LSB)| Method | Description |
|---|---|
setAlertLatched(bool) |
Latched (cleared by reading DIAG_ALRT) vs. transparent. |
setAlertPolarityInverted(bool) |
Active-low (default) vs. active-high (still open-drain). |
setAlertOnAveraged(bool) |
Trigger on averaged value rather than every ADC sample. |
enableConversionReadyAlert(bool) |
Pulse ALERT when a conversion completes. |
uint16_t readDiagAlert() |
Read raw DIAG_ALRT register; reading clears latched flags. |
bool conversionReady() |
Convenience: DIAG_ALRT.CNVRF is set. |
uint16_t manufacturerID() |
Should always return 0x5449. |
Bit masks for DIAG_ALRT are exposed as INA745_DIAG_* macros
(INA745_DIAG_CURRENTOL, INA745_DIAG_BUSUL, INA745_DIAG_CNVRF, etc.).
If you need to poke at registers directly:
bool writeRegister16(uint8_t reg, uint16_t value);
bool readRegister16(uint8_t reg, uint16_t &value);
bool readRegister24(uint8_t reg, uint32_t &value);
bool readRegister40(uint8_t reg, uint8_t bytes[5]); // MSB firstRegister address constants are exposed as INA745_REG_*.
- Triggered mode updates VBUS / CURRENT / DIETEMP / POWER on each trigger, but does not accumulate ENERGY or CHARGE — those only update in continuous mode.
- The 12-bit
DIETEMPvalue is sign-extended by an arithmetic right shift on aint16_t. This is the natural behaviour on every Arduino toolchain (AVR / ARM / Xtensa GCC) but is technically implementation-defined for negative values before C++20. - The integrated shunt has a
±0.5 %temperature coefficient; the library does not apply any temperature compensation since the measurement engine inside the chip already does that.
MIT — see LICENSE if included. If a LICENSE file is not present yet,
treat the contents of this repository as MIT-licensed unless stated
otherwise.
Issues and pull requests are welcome. If you have hardware and bench measurements to validate the conversion math, that's especially helpful — the initial version was written from the datasheet only.