It's easy to use the Pi Stemma QT Breakout with Python and Blinka. To demo the I2C functionality, you can run an I2C scan with one of many STEMMA QT / Qwiic compatible boards like the AHT20 STEMMA QT breakout below.
You can use this breakout with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library.
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 the Pi Stemma QT Breakout and an AHT20 breakout:
Plug the Pi Stemma QT Breakout header into the Raspberry Pi GPIO. Then, plug the AHT20 sensor into the breakout with a STEMMA QT cable.
No soldering required, making it quick and easy.
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
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# pylint: disable=broad-except, eval-used, unused-import
"""CircuitPython I2C Device Address Scan"""
import time
import board
import busio
# List of potential I2C busses
ALL_I2C = ("board.I2C()", "board.STEMMA_I2C()", "busio.I2C(board.GP1, board.GP0)")
# Determine which busses are valid
found_i2c = []
for name in ALL_I2C:
try:
print("Checking {}...".format(name), end="")
bus = eval(name)
bus.unlock()
found_i2c.append((name, bus))
print("ADDED.")
except Exception as e:
print("SKIPPED:", e)
# Scan valid busses
if len(found_i2c):
print("-" * 40)
print("I2C SCAN")
print("-" * 40)
while True:
for bus_info in found_i2c:
name = bus_info[0]
bus = bus_info[1]
while not bus.try_lock():
pass
print(
name,
"addresses found:",
[hex(device_address) for device_address in bus.scan()],
)
bus.unlock()
time.sleep(2)
else:
print("No valid I2C bus found.")
First, the I2C bus is found. Then, in the loop, the connected I2C device addresses are printed to the console. The AHT20 is on address 0x38. If you have that breakout connected, then you should see that address printed repeatedly.
If you have a different breakout, a different address specific to that board would typically be printed.
Page last edited July 15, 2025
Text editor powered by tinymce.