INA260 Driver
Introduction
This Python package provides a platform agnostic driver for the TI 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
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.
Release files for ina260 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ina260-0.0.3.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ina260-0.0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 6.6 kB
Release files / ina260-0.0.3.tar.gz
| Download URL | ina260-0.0.3.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2017077b8c587eaf5a53df8038ad3a9b1ea2404c1420033403e09ea8c750a96
|
|
BLAKE2b-256 checksum How to use checksums |
b5d3ccb08bc904d5276d0c052467aaa9bae056519a5347fd92640e9ceed9f179
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.7.7 Linux/5.3.0-64-generic
|
Release files / ina260-0.0.3-py2.py3-none-any.whl
| Download URL | ina260-0.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4fede1d974b7ddd7369300b9f1764019095c694e79961c7ee3fac155d55e65d4
|
|
BLAKE2b-256 checksum How to use checksums |
ae4c1bbecf834e376792ff6494305e7fa4efa3e44222374ceef048d76aa8121d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.7.7 Linux/5.3.0-64-generic
|