ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
ina219.h File Reference

TI INA219 high-side current / power monitor codec (PROTOCORE_ENABLE_INA219). More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

TI INA219 high-side current / power monitor codec (PROTOCORE_ENABLE_INA219).

The INA219 measures the voltage across a shunt resistor (LSB 10 uV) and the bus voltage (LSB 4 mV, in the upper 13 bits of its register), and - once a calibration value derived from the shunt resistance and a chosen current LSB is programmed - reports current and power directly. From those you get how much current and power a circuit draws.

This codec is pure and host-tested: ::protocore_ina219_bus_mv / ::protocore_ina219_shunt_uv decode the voltage registers, ::protocore_ina219_calibration computes the calibration register, and ::protocore_ina219_current_ua / ::protocore_ina219_power_uw scale the raw current / power registers by the current LSB. On an ESP32 the binding programs the calibration + config and reads the registers over I2C (Wire); only that touches hardware.

A cheap solder-and-bench-test breakout: put it in series with a load and watch the current.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file ina219.h.