INA229 FT232H
A small Python driver for the Texas Instruments INA229 SPI power/energy/charge monitor, including an FT232H helper for Adafruit Blinka and pyftdi.
Installation
Install the released package from PyPI:
python -m pip install ina229-ft232h
For local development, clone the repository and install it in editable mode:
python -m pip install -e .
Set BLINKA_FT232H=1 before starting Python whenever the FT232H helper is
used.
FT232H wiring
| FT232H | INA229 |
|---|---|
| D0 (SCK) | SCLK |
| D1 (MOSI) | SDI |
| D2 (MISO) | SDO |
| D3 | /CS |
| GND | GND |
The FT232H uses 3.3 V logic. Keep the SPI harness short and provide a solid ground return. For longer harnesses, reduce the baud rate and consider source series termination on SCK, MOSI, and /CS.
Basic usage
import ina229_ft232h as ina229
spi = ina229.ft232h_spi(baudrate=1_000_000)
device = ina229.INA229(
spi,
shunt_ohms=0.01,
max_current=8.0,
)
print(device.bus_voltage)
print(device.shunt_voltage)
print(device.current)
print(device.power)
print(device.energy)
print(device.charge)
print(device.temperature)
max_current defines the signed CURRENT-register full scale and therefore
the current LSB. Choose it above the largest expected transient. The shunt drop
must also remain within the selected ADC range:
adc_range=False: +/-163.84 mVadc_range=True: +/-40.96 mV, four times finer resolution
ADC configuration
device.configure_adc(
mode=ina229.MODE_CONT_ALL,
vbus_ct=ina229.CT_50US,
vshunt_ct=ina229.CT_50US,
temp_ct=ina229.CT_50US,
avg=ina229.AVG_1,
)
The module exports the INA229 register addresses and MODE_*, CT_*, and
AVG_* field constants for lower-level use.
SPI mode note
The INA229 requires falling-edge sampling. Blinka's FT232H backend rejects
CPHA=1, while pyftdi's mode-1 three-phase emulation shifted received INA229
words by one bit on the tested hardware. ft232h_spi() therefore defaults the
underlying pyftdi port to mode 2, which provides the working edge timing
without three-phase emulation. Override it with
ft232h_spi(mode=...) if another adapter requires different timing.
Tests
python -m unittest discover -v
Release maintainers can find the trusted-publishing setup and release process in RELEASING.md.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ina229_ft232h-0.1.0.tar.gz.
File metadata
- Download URL: ina229_ft232h-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78240bfbf0c15fbc65cd3fb18b0c485cbcf3f3f2f092e1fa86a46f1815d38a36
|
|
| MD5 |
8dd0aea0f0ae5db282313becf15a9726
|
|
| BLAKE2b-256 |
fc962b93e3081636e8053af95d1ff08ae3d1a01ed3c20c47fa2c202e3ed1fb05
|
Provenance
The following attestation bundles were made for ina229_ft232h-0.1.0.tar.gz:
Publisher:
publish.yml on SiboVG/ina229-ft232h
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ina229_ft232h-0.1.0.tar.gz -
Subject digest:
78240bfbf0c15fbc65cd3fb18b0c485cbcf3f3f2f092e1fa86a46f1815d38a36 - Sigstore transparency entry: 2638317061
- Sigstore integration time:
-
Permalink:
SiboVG/ina229-ft232h@599d99a1c9489e8d2c0cc26ee21d7c6b7c4379bd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SiboVG
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@599d99a1c9489e8d2c0cc26ee21d7c6b7c4379bd -
Trigger Event:
release
-
Statement type:
File details
Details for the file ina229_ft232h-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ina229_ft232h-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c0df11bbc21a51ae5957a7cfd4999fcddce7805ecc0b84603087131ceabb3fe
|
|
| MD5 |
0fe15911dbfdf09919b6b57f938faf5d
|
|
| BLAKE2b-256 |
7ee05573ac12788b34f4cc33c98109a79d535ad84974ddb8a420ab1679e4564d
|
Provenance
The following attestation bundles were made for ina229_ft232h-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on SiboVG/ina229-ft232h
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ina229_ft232h-0.1.0-py3-none-any.whl -
Subject digest:
0c0df11bbc21a51ae5957a7cfd4999fcddce7805ecc0b84603087131ceabb3fe - Sigstore transparency entry: 2638317717
- Sigstore integration time:
-
Permalink:
SiboVG/ina229-ft232h@599d99a1c9489e8d2c0cc26ee21d7c6b7c4379bd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SiboVG
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@599d99a1c9489e8d2c0cc26ee21d7c6b7c4379bd -
Trigger Event:
release
-
Statement type: