Metadata-Version: 2.1
Name: ina260
Version: 0.0.2
Summary: A generic Python library for the INA260 power monitor chip
Home-page: https://github.com/jveitchmichaelis/ina260
License: MIT
Author: Josh Veitch-Michaelis
Author-email: j.veitchmichaelis@gmail.com
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: smbus2 (>=0.3.0,<0.4.0)
Project-URL: Repository, https://github.com/jveitchmichaelis/ina260
Description-Content-Type: text/markdown

# INA260 Driver

![coverage](coverage.svg)

## Introduction

This Python package provides a platform agnostic driver for the [TI INA260](https://www.ti.com/product/INA260) precision power monitor. Conveniently, the INA260 has a built-in sense resistor so it's very easy to integrate into your projects. It can sense from 0 to 36V and up to 15A(!) with 16-bit resolution. Thus, it's perfect for pretty much all hobbyist projects.

The only dependency for this library is `smbus2` so provided your I2C device is addressable by that, this library should work (for example on a Raspberry Pi or other dev board).

## Examples

```python

from ina260.controller import Controller

c = Controller(address=0x40)

print(c.voltage())
print(c.current())
print(c.power()))

```

see the example script in the repository. Note that the power measurement is usually not the same as voltage times current unless you read all three registers instantaneously.

Obviously check what address you've set the chip to (there is a table in the datasheet).

## Hardware notes

The chip itself is very easy to hook up (although it comes in a VSSOP package which can be challenging to solder if you've not had much experience with SMD soldering).

Be sure to follow TI's guidelines in the datasheet about proper power planes and PCB layout. The package is designed so that your power rail goes in one side and out the other. Otherwise the chip is very easy to integrate and minimally just needs a standard 0.1uF bypass capacitor.

## Test suite

This package has a comprehensive test suite which you can use to check that commands are being recieved and interpreted properly. You need `pytest`. Run with:

```
python -m pytest test
```

Coverage is 99% because there should also be a check for reverse current which is obviously difficult to do simultaneously with forward current.


