1.. zephyr:code-sample:: ina219
2   :name: INA219 Bidirectional Power/Current Monitor
3   :relevant-api: sensor_interface
4
5   Get shunt voltage, bus voltage, power and current from an INA219 sensor.
6
7Overview
8********
9
10This sample application measures shunt voltage, bus voltage, power and current
11every 2 seconds and prints them to console.
12The calibration/configuration parameters can be set in the devicetree file.
13
14References
15**********
16
17 - `INA219 sensor <https://www.ti.com/product/INA219>`_
18
19Wiring
20******
21
22The supply voltage of the INA219 can be in the 3V to 5.5V range.
23The common mode voltage of the measured bus can be in the 0V to 26V range.
24
25Building and Running
26********************
27
28.. zephyr-app-commands::
29   :zephyr-app: samples/sensor/ina219
30   :board: blackpill_f411ce
31   :goals: build flash
32
33Sample Output
34=============
35When monitoring a 3.3 V bus with a 0.1 Ohm shunt resistor
36you should get a similar output as below, repeated every 2 seconds:
37
38.. code-block:: console
39
40        Shunt: 0.001570 [V] -- Bus: 3.224000 [V] -- Power: 0.504000 [W] -- Current: 0.157000 [A]
41
42
43A negative sign indicates current flowing in reverse direction:
44
45.. code-block:: console
46
47        Shunt: -0.001560 [V] -- Bus: 3.224000 [V] -- Power: 0.502000 [W] -- Current: -0.156000 [A]
48