It's easy to use LED AlphaNumeric Displays with CircuitPython and the Adafruit CircuitPython HT16K33 library.  This module allows you to easily write CircuitPython code to control the display.

You can use this backpack with any CircuitPython microcontroller board.

First assemble your AlphaNumeric Display.

Wiring STEMMA QT Version

Here is an example of the STEMMA QT version wired to a Feather RP2040 using the STEMMA QT connector on the backpack.

  • Board 3.3V to backpack Vio (red wire)
  • Board GND to backpack GND (black wire)
  • Board SCL to backpack SCL (yellow wire)
  • Board SDA to backpack SDA (blue wire)

Here is an example of the STEMMA QT version wired to a Feather RP2040 using a solderless breadboard. This example also includes how to wire up the VHi pin, which makes the LEDs appear brighter.

  • Board 5V to backpack Vio (red wire connected along the bottom of the Feather)
  • Board GND to backpack GND (black wire)
  • Board SCL to backpack SCL (yellow wire)
  • Board SDA to backpack SDA (blue wire)
  • Board USB to backpack VHi (red wire connected along the top of the Feather)

Wiring Original Version

Connect the AlphaNumeric Display to your microcontroller board as shown below.

  • Microcontroller 3V to AlphaNumeric Display I2C VIN
  • Microcontroller 3V to AlphaNumeric Display VIN
  • Microcontroller GND to AlphaNumeric Display GND
  • Microcontroller SCL to AlphaNumeric Display SCL
  • Microcontroller SDA to AlphaNumeric Display SDA

HT16K33 Library Installation

To use with CircuitPython, you need to first install the HT16K33 library, and its dependencies, into the lib folder on your CIRCUITPY drive. Then you need to update with the example script.

Thankfully, you can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the file in a zip file. Extract the contents of the zip file, and copy the entire lib folder and the file to your CIRCUITPY drive.

Your CIRCUITPY/lib folder should contain the following folders:

  • adafruit_bus_device/
  • adafruit_ht16k33/
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
from adafruit_ht16k33 import segments

# Create the display object.
# Display connected to STEMMA QT connector.
display = segments.Seg14x4(board.STEMMA_I2C())
# Display connected to I2C pins.
# display = segments.Seg14x4(board.I2C())  # uses board.SCL and board.SDA

# This section displays four 0's across the display. The code shows four
# different ways to use the set_digit_raw function. Each is labeled below.
# 16-bit Hexadecimal number
display.set_digit_raw(0, 0x2D3F)
# 16-bit Binary number
display.set_digit_raw(1, 0b0010110100111111)
# 8-bit Binary Tuple
display.set_digit_raw(2, (0b00101101, 0b00111111))
# 8-bit Hexadecimal List
display.set_digit_raw(3, [0x2D, 0x3F])

# Delay between.

# Scroll "Hello, world!" across the display. Setting the loop parameter to false allows you to
# tell the marquee function to run only once. By default, marquee loops indefinitely.
display.marquee("Hello, world!", loop=False)

# Delay between.

# Scroll special characters, uppercase and lowercase letters, and numbers across
# the display in a loop. This section will continue to run indefinitely.
display.marquee("".join(chr(character) for character in range(ord("!"), ord("z") + 1)))

This guide was first published on Jul 29, 2012. It was last updated on Jun 18, 2024.

This page (CircuitPython Wiring and Setup) was last updated on Jun 18, 2024.

Text editor powered by tinymce.