It's easy to use the INA23x with Python or CircuitPython, and the Adafruit_CircuitPython_INA23x module. This module allows you to easily write Python code to monitor high or low side power measurements.
You can use this driver with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library.
The INA237 and INA238 are completely code and hardware equivalent. The only difference is that the INA238 has better gain error and offset voltage than the INA237.
CircuitPython Microcontroller Wiring
First wire up the monitor to your board exactly as follows. The following is the monitor wired to a Feather RP2040 using the STEMMA connector for high side monitoring:
-
Board STEMMA 3V to breakout VIN (red wire)
-
Board STEMMA GND to breakout GND (black wire)
-
Board STEMMA SCL to breakout SCL (yellow wire)
- Board STEMMA SDA to breakout SDA (blue wire)
- Breakout Vin- to load's highest potential (yellow wire)
- Breakout Vin+ to highest project voltage (red wire)
Here is the monitor wired to a Feather RP2040 using a solderless breadboard for high side monitoring:
-
Board 3V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
- Breakout Vin- to load's highest potential (yellow wire)
- Breakout Vin+ to highest project voltage (red wire)
For low side monitoring, you'll need to cut the VBus jumper on the back of the breakout and use this wiring:
-
Board STEMMA 3V to breakout VIN (red wire)
-
Board STEMMA GND to breakout GND (black wire)
-
Board STEMMA SCL to breakout SCL (yellow wire)
- Board STEMMA SDA to breakout SDA (blue wire)
- Breakout Vin- to GND (black wire)
- Breakout VBus to highest potential voltage (red wire)
- Breakout Vin+ to load's lowest potential (yellow wire)
Python Computer Wiring
Since there are dozens of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported.
Here's the Raspberry Pi wired with I2C using the STEMMA connector for high side monitoring:
-
Pi 3.3V to breakout VIN (red wire)
-
Pi GND to breakout GND (black wire)
-
Pi SCL to breakout SCL (yellow wire)
- Pi SDA to breakout SDA (blue wire)
- Breakout Vin- to load's highest potential (yellow wire)
- Breakout Vin+ to highest project voltage (red wire)
Here's the wiring using a solderless breadboard for high side monitoring:
-
Pi 3.3V to breakout VIN (red wire)
-
Pi GND to breakout GND (black wire)
-
Pi SCL to breakout SCL (yellow wire)
- Pi SDA to breakout SDA (blue wire)
- Breakout Vin- to load's highest potential (yellow wire)
- Breakout Vin+ to highest project voltage (red wire)
For low side monitoring, you'll need to cut the VBus jumper on the back of the breakout and use this wiring:
-
Pi 3.3V to breakout VIN (red wire)
-
Pi GND to breakout GND (black wire)
-
Pi SCL to breakout SCL (yellow wire)
- Pi SDA to breakout SDA (blue wire)
- Breakout VIN- to GND (black wire)
- Breakout VBUS to highest potential voltage (red wire)
- Breakout VIN+ to load's lowest potential (yellow wire)
Python Installation of INA23x Library
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!
Once that's done, from your command line run the following command:
pip3 install adafruit-circuitpython-ina23x
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!
CircuitPython Usage
To use with CircuitPython, you need to first install the Adafruit_CircuitPython_INA23x library, and its dependencies, into the lib folder on your CIRCUITPY drive. Then you need to update code.py with the example script.
Thankfully, we can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file. Extract the contents of the zip file, and copy the entire lib folder and the code.py file to your CIRCUITPY drive.
Your CIRCUITPY/lib folder should contain the following folders and file:
- adafruit_bus_device/
- adafruit_register/
- adafruit_ina228.mpy
- adafruit_ina23x.mpy

Python Usage
Once you have the library pip3
installed on your computer, copy or download the following example to your computer, and run the following, replacing code.py with whatever you named the file:
python3 code.py
Example Code
If running CircuitPython: Once everything is saved to the CIRCUITPY drive, connect to the serial console to see the data printed out!
If running Python: The console output will appear wherever you are running Python.
# SPDX-FileCopyrightText: Copyright (c) 2025 Liz Clark for Adafruit Industries # # SPDX-License-Identifier: MIT """Adafruit CircuitPython INA23x Simpletest""" import time import adafruit_ina228 import board import adafruit_ina23x # Create I2C bus i2c = board.I2C() # Create INA237/238 instance ina23x = adafruit_ina23x.INA23X(i2c) # Configure the sensor (optional - these are just examples) # ina23x.set_calibration(0.015, 10.0) # Default values # ina23x.mode = adafruit_ina228.Mode.CONTINUOUS # Already default # ina23x.averaging_count = adafruit_ina228.AveragingCount.COUNT_4 conv_times = [50, 84, 150, 280, 540, 1052, 2074, 4120] avg_counts = [1, 4, 16, 64, 128, 256, 512, 1024] print("CircuitPython INA23x Test") print(f"Bus conversion time: {conv_times[ina23x.bus_voltage_conv_time]} microseconds") print(f"Shunt conversion time: {conv_times[ina23x.shunt_voltage_conv_time]} microseconds") print(f"Samples averaged: {avg_counts[ina23x.averaging_count]}") print() while True: print(f"Current: {ina23x.current * 1000:.2f} mA") print(f"Bus Voltage: {ina23x.bus_voltage:.2f} V") print(f"Shunt Voltage: {ina23x.shunt_voltage * 1000:.2f} mV") print(f"Power: {ina23x.power * 1000:.2f} mW") print(f"Temperature: {ina23x.die_temperature:.2f} °C") print() # Check if conversion is ready (useful in triggered mode) # if ina23x.conversion_ready: # print("Conversion ready!") time.sleep(2)
First, the sensor is instantiated over I2C. Then, in the loop, the measurements for current, bus voltage, shunt voltage, power and temperature are printed to the serial console.
Page last edited June 11, 2025
Text editor powered by tinymce.