Skip to main content

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 mV
  • adc_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

ina229_ft232h-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ina229_ft232h-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

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

Hashes for ina229_ft232h-0.1.0.tar.gz
Algorithm Hash digest
SHA256 78240bfbf0c15fbc65cd3fb18b0c485cbcf3f3f2f092e1fa86a46f1815d38a36
MD5 8dd0aea0f0ae5db282313becf15a9726
BLAKE2b-256 fc962b93e3081636e8053af95d1ff08ae3d1a01ed3c20c47fa2c202e3ed1fb05

See more details on using hashes here.

Provenance

The following attestation bundles were made for ina229_ft232h-0.1.0.tar.gz:

Publisher: publish.yml on SiboVG/ina229-ft232h

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for ina229_ft232h-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c0df11bbc21a51ae5957a7cfd4999fcddce7805ecc0b84603087131ceabb3fe
MD5 0fe15911dbfdf09919b6b57f938faf5d
BLAKE2b-256 7ee05573ac12788b34f4cc33c98109a79d535ad84974ddb8a420ab1679e4564d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ina229_ft232h-0.1.0-py3-none-any.whl:

Publisher: publish.yml on SiboVG/ina229-ft232h

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page