### Install circup Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/docs/index.md Install the circup utility, which helps manage CircuitPython libraries. ```shell pip3 install circup ``` -------------------------------- ### Install INA3221 Driver with pip Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/README.rst Install the driver using pip for local or system-wide installation on supported GNU/Linux systems. ```shell pip3 install adafruit-circuitpython-ina3221 ``` ```shell sudo pip3 install adafruit-circuitpython-ina3221 ``` ```shell mkdir project-name && cd project-name python3 -m venv .venv source .env/bin/activate pip3 install adafruit-circuitpython-ina3221 ``` -------------------------------- ### Install adafruit-circuitpython-ina3221 in a virtual environment Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/docs/index.md Install the driver within a virtual environment for a specific project. ```shell mkdir project-name && cd project-name python3 -m venv .venv source .env/bin/activate pip3 install adafruit-circuitpython-ina3221 ``` -------------------------------- ### Install adafruit-circuitpython-ina3221 with pip3 Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/docs/index.md Install the driver locally for the current user using pip3. ```shell pip3 install adafruit-circuitpython-ina3221 ``` -------------------------------- ### Install adafruit-circuitpython-ina3221 system-wide with pip3 Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/docs/index.md Install the driver system-wide using pip3. This may be required in some cases. ```shell sudo pip3 install adafruit-circuitpython-ina3221 ``` -------------------------------- ### INA3221 Usage Example Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/README.rst Example code demonstrating how to initialize the INA3221 sensor and read bus voltage, shunt voltage, and current for up to three channels in a loop. ```python import time import board from adafruit_ina3221 import INA3221 i2c = board.I2C() ina = INA3221(i2c) while True: for i in range(3): bus_voltage = ina[i].bus_voltage shunt_voltage = ina[i].shunt_voltage current = ina[i].current_amps * 1000 print(f"Channel {i + 1}:") print(f" Bus Voltage: {bus_voltage:.6f} V") print(f" Shunt Voltage: {shunt_voltage:.6f} V") print(f" Current: {current:.6f} mA") print("-" * 30) time.sleep(2) ``` -------------------------------- ### Install INA3221 Driver with Circup Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/README.rst Install or update the INA3221 driver on a connected CircuitPython device using the circup tool. ```shell pip3 install circup ``` ```shell circup install adafruit_ina3221 ``` ```shell circup update ``` -------------------------------- ### Update adafruit_ina3221 with circup Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/docs/index.md Update an existing installation of the INA3221 driver on a CircuitPython device using circup. ```shell circup update ``` -------------------------------- ### Simple INA3221 Test Source: https://github.com/adafruit/adafruit_circuitpython_ina3221/blob/main/docs/examples.md This snippet shows how to initialize the INA3221 sensor and continuously read voltage, shunt voltage, and current for up to three channels. Ensure the I2C bus is correctly configured and the sensor is connected. ```python # SPDX-FileCopyrightText: Copyright (c) 2024 Liz Clark for Adafruit Industries # # SPDX-License-Identifier: MIT import time import board from adafruit_ina3221 import INA3221 i2c = board.I2C() ina = INA3221(i2c, enable=[0, 1, 2]) while True: for i in range(3): bus_voltage = ina[i].bus_voltage shunt_voltage = ina[i].shunt_voltage current = ina[i].current print(f"Channel {i + 1}:") print(f" Bus Voltage: {bus_voltage:.6f} V") print(f" Shunt Voltage: {shunt_voltage:.6f} mV") print(f" Current: {current:.6f} mA") print("-" * 30) time.sleep(2) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.